Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: tools/apps/update_homebrew/bin/update_homebrew.dart

Issue 788043004: Add MacOS content_shell download to homebrew formula update app. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move block to fix unknown error Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library update_homebrew; 5 library update_homebrew;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:async'; 9 import 'dart:async';
10 import 'package:http/http.dart' as http; 10 import 'package:http/http.dart' as http;
11 import 'package:args/args.dart'; 11 import 'package:args/args.dart';
12 import 'package:googleapis/storage/v1.dart' as storage; 12 import 'package:googleapis/storage/v1.dart' as storage;
13 import 'package:googleapis/common/common.dart' show DownloadOptions, Media; 13 import 'package:googleapis/common/common.dart' show DownloadOptions, Media;
14 14
15 String repository; // The path to the temporary git checkout of dart-homebrew. 15 String repository; // The path to the temporary git checkout of dart-homebrew.
16 Map gitEnvironment; // Pass a wrapper script for SSH to git in the environment. 16 Map gitEnvironment; // Pass a wrapper script for SSH to git in the environment.
17 17
18 final CHANNELS = ['dev', 'stable']; 18 final CHANNELS = ['dev', 'stable'];
19 19
20 final SDK_FILES = ['sdk/dartsdk-macos-x64-release.zip', 20 final SDK_FILES = ['sdk/dartsdk-macos-x64-release.zip',
21 'sdk/dartsdk-macos-ia32-release.zip' ]; 21 'sdk/dartsdk-macos-ia32-release.zip' ];
22 final DARTIUM_FILES = ['dartium/dartium-macos-ia32-release.zip' ]; 22 final DARTIUM_FILES = ['dartium/dartium-macos-ia32-release.zip',
23 'dartium/content_shell-macos-ia32-release.zip'];
23 final FILES = []..addAll(SDK_FILES)..addAll(DARTIUM_FILES); 24 final FILES = []..addAll(SDK_FILES)..addAll(DARTIUM_FILES);
24 25
25 26
26 Future<String> getHash256(String channel, int revision, String download) { 27 Future<String> getHash256(String channel, int revision, String download) {
27 var client = new http.Client(); 28 var client = new http.Client();
28 var api = new storage.StorageApi(client); 29 var api = new storage.StorageApi(client);
29 return 30 return
30 api.objects.get('dart-archive', 31 api.objects.get('dart-archive',
31 'channels/$channel/release/$revision/$download.sha256sum', 32 'channels/$channel/release/$revision/$download.sha256sum',
32 downloadOptions: DownloadOptions.FullMedia) 33 downloadOptions: DownloadOptions.FullMedia)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 .close(); 100 .close();
100 }); 101 });
101 } 102 }
102 103
103 String DartiumFile(Map revisions, 104 String DartiumFile(Map revisions,
104 Map hashes, 105 Map hashes,
105 String devVersion, 106 String devVersion,
106 String stableVersion) { 107 String stableVersion) {
107 final urlBase = 'https://storage.googleapis.com/dart-archive/channels'; 108 final urlBase = 'https://storage.googleapis.com/dart-archive/channels';
108 final dartiumFile = 'dartium/dartium-macos-ia32-release.zip'; 109 final dartiumFile = 'dartium/dartium-macos-ia32-release.zip';
110 final contentShellFile = 'dartium/content_shell-macos-ia32-release.zip';
109 111
110 return ''' 112 return '''
111 require 'formula' 113 require 'formula'
112 114
113 class Dartium < Formula 115 class Dartium < Formula
114 homepage "https://www.dartlang.org" 116 homepage "https://www.dartlang.org"
115 117
116 version '$stableVersion' 118 version '$stableVersion'
117 url '$urlBase/stable/release/${revisions['stable']}/$dartiumFile' 119 url '$urlBase/stable/release/${revisions['stable']}/$dartiumFile'
118 sha256 '${hashes['stable'][dartiumFile]}' 120 sha256 '${hashes['stable'][dartiumFile]}'
119 121
120 devel do 122 devel do
121 version '$devVersion' 123 version '$devVersion'
122 url '$urlBase/dev/release/${revisions['dev']}/$dartiumFile' 124 url '$urlBase/dev/release/${revisions['dev']}/$dartiumFile'
123 sha256 '${hashes['dev'][dartiumFile]}' 125 sha256 '${hashes['dev'][dartiumFile]}'
126
127 resource 'content_shell' do
128 url '$urlBase/dev/release/${revisions['dev']}/$contentShellFile'
129 version '$devVersion'
130 sha256 '${hashes['dev'][contentShellFile]}'
131 end
132 end
133
134 resource 'content_shell' do
135 url '$urlBase/stable/release/${revisions['stable']}/$contentShellFile'
136 version '$stableVersion'
137 sha256 '${hashes['stable'][contentShellFile]}'
124 end 138 end
125 139
126 def shim_script target 140 def shim_script target
127 <<-EOS.undent 141 <<-EOS.undent
128 #!/bin/bash 142 #!/bin/bash
129 open "#{prefix}/#{target}" "\$@" 143 "#{prefix}/#{target}" "\$@"
130 EOS 144 EOS
131 end 145 end
132 146
133 def install 147 def install
148 dartium_binary = 'Chromium.app/Contents/MacOS/Chromium'
134 prefix.install Dir['*'] 149 prefix.install Dir['*']
135 (bin+"dartium").write shim_script "Chromium.app" 150 (bin+"dartium").write shim_script dartium_binary
151
152 content_shell_binary = 'Content Shell.app/Contents/MacOS/Content Shell'
153 prefix.install resource('content_shell')
154 (bin+"content_shell").write shim_script content_shell_binary
136 end 155 end
137 156
138 def caveats; <<-EOS.undent 157 def caveats; <<-EOS.undent
139 To use with IntelliJ, set the Dartium execute home to: 158 To use with IntelliJ, set the Dartium execute home to:
140 #{prefix}/Chromium.app 159 #{prefix}/Chromium.app
141 EOS 160 EOS
142 end 161 end
143 162
144 test do 163 test do
145 system "#{bin}/dartium" 164 system "#{bin}/dartium"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 repository = tempDir.path; 258 repository = tempDir.path;
240 }) 259 })
241 .then((_) => runGit( 260 .then((_) => runGit(
242 ['clone', 'git@github.com:dart-lang/homebrew-dart.git', '.'])) 261 ['clone', 'git@github.com:dart-lang/homebrew-dart.git', '.']))
243 .then((_) => writeHomebrewInfo(channel, revision)) 262 .then((_) => writeHomebrewInfo(channel, revision))
244 .then((_) => runGit(['commit', '-a', '-m', 263 .then((_) => runGit(['commit', '-a', '-m',
245 'Updated $channel branch to revision $revision'])) 264 'Updated $channel branch to revision $revision']))
246 .then((_) => runGit(['push'])) 265 .then((_) => runGit(['push']))
247 .whenComplete(() => new Directory(repository).delete(recursive: true)); 266 .whenComplete(() => new Directory(repository).delete(recursive: true));
248 } 267 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698