OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 3 # Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 # | 6 # |
7 | 7 |
8 import os | 8 import os |
9 import optparse | 9 import optparse |
10 import subprocess | 10 import subprocess |
11 import sys | 11 import sys |
12 import utils | 12 import utils |
13 | 13 |
14 import bots.fletch_namer as gcs_namer | 14 import bots.dartino_namer as gcs_namer |
15 import bots.bot_utils as bot_utils | 15 import bots.bot_utils as bot_utils |
16 | 16 |
17 def ParseOptions(): | 17 def ParseOptions(): |
18 parser = optparse.OptionParser() | 18 parser = optparse.OptionParser() |
19 parser.add_option('--version') | 19 parser.add_option('--version') |
20 parser.add_option('--dryrun', action='store_true') | 20 parser.add_option('--dryrun', action='store_true') |
21 (options, args) = parser.parse_args() | 21 (options, args) = parser.parse_args() |
22 return options | 22 return options |
23 | 23 |
24 def Main(): | 24 def Main(): |
(...skipping 15 matching lines...) Expand all Loading... |
40 gsutil.execute(cmd) | 40 gsutil.execute(cmd) |
41 | 41 |
42 def Run(cmd, shell=False): | 42 def Run(cmd, shell=False): |
43 print "Running: %s" % ' '.join(cmd) | 43 print "Running: %s" % ' '.join(cmd) |
44 if shell: | 44 if shell: |
45 subprocess.check_call(' '.join(cmd), shell=shell) | 45 subprocess.check_call(' '.join(cmd), shell=shell) |
46 else: | 46 else: |
47 subprocess.check_call(cmd, shell=shell) | 47 subprocess.check_call(cmd, shell=shell) |
48 | 48 |
49 # Currently we only release on dev | 49 # Currently we only release on dev |
50 raw_namer = gcs_namer.FletchGCSNamer(channel=bot_utils.Channel.DEV) | 50 raw_namer = gcs_namer.DartinoGCSNamer(channel=bot_utils.Channel.DEV) |
51 release_namer = gcs_namer.FletchGCSNamer( | 51 release_namer = gcs_namer.DartinoGCSNamer( |
52 channel=bot_utils.Channel.DEV, | 52 channel=bot_utils.Channel.DEV, |
53 release_type=bot_utils.ReleaseType.RELEASE) | 53 release_type=bot_utils.ReleaseType.RELEASE) |
54 for target_version in [version, 'latest']: | 54 for target_version in [version, 'latest']: |
55 for system in ['linux', 'mac']: | 55 for system in ['linux', 'mac']: |
56 for arch in ['x64']: | 56 for arch in ['x64']: |
57 src = raw_namer.fletch_sdk_zipfilepath(version, system, arch, 'release') | 57 src = raw_namer.dartino_sdk_zipfilepath(version, system, arch, 'release'
) |
58 target = release_namer.fletch_sdk_zipfilepath(target_version, system, | 58 target = release_namer.dartino_sdk_zipfilepath(target_version, system, |
59 arch, 'release') | 59 arch, 'release') |
60 gsutil_cp(src, target) | 60 gsutil_cp(src, target) |
61 | 61 |
62 with utils.TempDir('version') as temp_dir: | 62 with utils.TempDir('version') as temp_dir: |
63 version_file = os.path.join(temp_dir, 'version') | 63 version_file = os.path.join(temp_dir, 'version') |
64 target = release_namer.version_filepath('latest') | 64 target = release_namer.version_filepath('latest') |
65 with open(version_file, 'w') as f: | 65 with open(version_file, 'w') as f: |
66 f.write(version) | 66 f.write(version) |
67 gsutil_cp(version_file, target) | 67 gsutil_cp(version_file, target) |
68 | 68 |
69 with utils.TempDir('docs') as temp_dir: | 69 with utils.TempDir('docs') as temp_dir: |
70 docs = raw_namer.docs_filepath(version) | 70 docs = raw_namer.docs_filepath(version) |
71 print 'Downloading docs from %s' % docs | 71 print 'Downloading docs from %s' % docs |
72 gsutil_cp(docs, temp_dir, recursive=True, public=False) | 72 gsutil_cp(docs, temp_dir, recursive=True, public=False) |
73 local_docs = os.path.join(temp_dir, 'docs') | 73 local_docs = os.path.join(temp_dir, 'docs') |
74 with utils.ChangedWorkingDirectory(temp_dir): | 74 with utils.ChangedWorkingDirectory(temp_dir): |
75 print 'Cloning the fletch-api repo' | 75 print 'Cloning the dartino-api repo' |
76 Run(['git', 'clone', 'git@github.com:dart-lang/fletch-api.git']) | 76 Run(['git', 'clone', 'git@github.com:dart-lang/dartino-api.git']) |
77 with utils.ChangedWorkingDirectory(os.path.join(temp_dir, 'fletch-api')): | 77 with utils.ChangedWorkingDirectory(os.path.join(temp_dir, 'dartino-api')): |
78 print 'Checking out gh-pages which serves our documentation' | 78 print 'Checking out gh-pages which serves our documentation' |
79 Run(['git', 'checkout', 'gh-pages']) | 79 Run(['git', 'checkout', 'gh-pages']) |
80 print 'Cleaning out old version of docs locally' | 80 print 'Cleaning out old version of docs locally' |
81 Run(['git', 'rm', '-r', '*']) | 81 Run(['git', 'rm', '-r', '*']) |
82 # shell=True to allow us to expand the *. | 82 # shell=True to allow us to expand the *. |
83 print 'Copying in new docs' | 83 print 'Copying in new docs' |
84 Run(['cp', '-r', os.path.join(local_docs, '*'), '.'], shell=True) | 84 Run(['cp', '-r', os.path.join(local_docs, '*'), '.'], shell=True) |
85 print 'Git adding all new docs' | 85 print 'Git adding all new docs' |
86 Run(['git', 'add', '*']) | 86 Run(['git', 'add', '*']) |
87 print 'Commiting docs locally' | 87 print 'Commiting docs locally' |
88 Run(['git', 'commit', '-m', | 88 Run(['git', 'commit', '-m', |
89 'Publish API docs for version %s' % version]) | 89 'Publish API docs for version %s' % version]) |
90 print 'Pushing docs to github' | 90 print 'Pushing docs to github' |
91 Run(['git', 'push']) | 91 Run(['git', 'push']) |
92 | 92 |
93 if __name__ == '__main__': | 93 if __name__ == '__main__': |
94 sys.exit(Main()) | 94 sys.exit(Main()) |
OLD | NEW |