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

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

Issue 621743004: Fix update_homebrew script for releasing Dart on Mac using homebrew. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months 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;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 final moduleName = (channel == 'dev') ? 'DartDev' : 'DartStable'; 43 final moduleName = (channel == 'dev') ? 'DartDev' : 'DartStable';
44 buffer.writeln('module $moduleName'); 44 buffer.writeln('module $moduleName');
45 final files = {'SDK64': 'sdk/dartsdk-macos-x64-release.zip', 45 final files = {'SDK64': 'sdk/dartsdk-macos-x64-release.zip',
46 'SDK32': 'sdk/dartsdk-macos-ia32-release.zip', 46 'SDK32': 'sdk/dartsdk-macos-ia32-release.zip',
47 'DARTIUM': 'dartium/dartium-macos-ia32-release.zip'}; 47 'DARTIUM': 'dartium/dartium-macos-ia32-release.zip'};
48 return Future.forEach(files.keys, (key) { 48 return Future.forEach(files.keys, (key) {
49 return getHash256(channel, revision, files[key]).then((hash) { 49 return getHash256(channel, revision, files[key]).then((hash) {
50 final file = "channels/$channel/release/$revision/${files[key]}"; 50 final file = "channels/$channel/release/$revision/${files[key]}";
51 buffer.writeln(' ${key}_FILE = "$file"'); 51 buffer.writeln(' ${key}_FILE = "$file"');
52 buffer.writeln(' ${key}_HASH = "$hash"'); 52 buffer.writeln(' ${key}_HASH = "$hash"');
53 }) 53 });
54 }) 54 })
55 .then((_) => getVersion(channel, revision)) 55 .then((_) => getVersion(channel, revision))
56 .then((version) { 56 .then((version) {
57 buffer.writeln(' VERSION = "$version"'); 57 buffer.writeln(' VERSION = "$version"');
58 buffer.writeln('end'); 58 buffer.writeln('end');
59 return (new File('$repository/data/${channel}_info.rb').openWrite() 59 return (new File('$repository/data/${channel}_info.rb').openWrite()
60 ..write(buffer)) 60 ..write(buffer))
61 .close(); 61 .close();
62 }); 62 });
63 } 63 }
64 64
65 Future runGit(List<String> args) { 65 Future runGit(List<String> args) {
66 print("git ${args.join(' ')}"); 66 print("git ${args.join(' ')}");
67 return Process.run('git', args, workingDirectory: repository, 67 return Process.run('git', args, workingDirectory: repository,
68 environment: gitEnvironment) 68 environment: gitEnvironment)
69 .then((result) { 69 .then((result) {
70 print(result.stdout); 70 print(result.stdout);
71 print(result.stderr); 71 print(result.stderr);
72 }); 72 });
73 } 73 }
74 74
75 main(args) { 75 main(args) {
76 final parser = new ArgParser() 76 final parser = new ArgParser()
77 ..addOption('revision', abbr: 'r') 77 ..addOption('revision', abbr: 'r')
78 ..addOption('channel', abbr: 'c', allowed: ['dev', 'stable']) 78 ..addOption('channel', abbr: 'c', allowed: ['dev', 'stable'])
79 ..addOption('key', abbr: 'k'); 79 ..addOption('key', abbr: 'k');
80 final options = parser.parse(args); 80 final options = parser.parse(args);
81 final revision = options['revision']; 81 final revision = options['revision'];
82 final channel = options['channel']; 82 final channel = options['channel'];
83 if ([revision, channel, options['key']].contains(null)) {
84 print("Usage: update_homebrew.dart -r revision -c channel -k ssh_key\n"
85 " ssh_key should allow pushes to dart-lang/homebrew-dart on github");
86 return;
87 }
83 final sshWrapper = Platform.script.resolve('ssh_with_key').toFilePath(); 88 final sshWrapper = Platform.script.resolve('ssh_with_key').toFilePath();
84 gitEnvironment = {'GIT_SSH': sshWrapper, 89 gitEnvironment = {'GIT_SSH': sshWrapper,
85 'SSH_KEY_PATH': options['key']}; 90 'SSH_KEY_PATH': options['key']};
86 91
87 Directory.systemTemp.createTemp('update_homebrew') 92 Directory.systemTemp.createTemp('update_homebrew')
88 .then((tempDir) { 93 .then((tempDir) {
89 repository = tempDir.path; 94 repository = tempDir.path;
90 }) 95 })
91 .then((_) => runGit( 96 .then((_) => runGit(
92 ['clone', 'git@github.com:dart-lang/homebrew-dart.git', '.'])) 97 ['clone', 'git@github.com:dart-lang/homebrew-dart.git', '.']))
93 .then((_) => writeHomebrewInfo(channel, revision)) 98 .then((_) => writeHomebrewInfo(channel, revision))
94 .then((_) => runGit(['add', '${channel}_info.rb']))
Bill Hesse 2014/10/01 14:18:43 Now that the files are in the repository, the -a o
95 .then((_) => runGit(['commit', '-a', '-m', 99 .then((_) => runGit(['commit', '-a', '-m',
96 'Updated $channel branch to revision $revision'])) 100 'Updated $channel branch to revision $revision']))
97 .then((_) => runGit(['push'])) 101 .then((_) => runGit(['push']))
98 .whenComplete(() => new Directory(repository).delete(recursive: true)); 102 .whenComplete(() => new Directory(repository).delete(recursive: true));
99 } 103 }
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