MCPcopy Index your code
hub / github.com/bugy/script-server / create_version_file

Function create_version_file

tools/build.py:64–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62
63
64def create_version_file():
65 process_invoker = ProcessInvoker(EnvVariables(os.environ))
66
67 if 'TRAVIS_BRANCH' in os.environ:
68 current_branch = os.environ['TRAVIS_BRANCH']
69 else:
70 current_branch = process_invoker.invoke('git rev-parse --abbrev-ref HEAD').strip()
71
72 npm_version = get_npm_version()
73 if current_branch == 'stable':
74 last_tag = process_invoker.invoke('git describe --exclude dev --abbrev=0 --tags').strip()
75 last_tag_version = parse_semver_str(last_tag)
76 if (last_tag_version[0] == npm_version[0]) and (last_tag_version[1] == npm_version[1]):
77 new_version = [last_tag_version[0], last_tag_version[1], last_tag_version[2] + 1]
78 else:
79 new_version = npm_version
80 new_version = '.'.join([str(v) for v in new_version])
81 else:
82 git_hash = process_invoker.invoke('git rev-parse --short HEAD').strip()
83
84 new_version = str(npm_version[0])
85 new_version += '.' + str(npm_version[1] + 1)
86 new_version += '.0-'
87 new_version += current_branch + '@' + git_hash
88 print('version.txt version: ' + new_version + ', current_branch: ' + current_branch)
89 file_utils.write_file(VERSION_FILE, new_version)
90
91
92if os.path.exists(BUILD_FOLDER):

Callers 1

build.pyFile · 0.85

Calls 5

invokeMethod · 0.95
ProcessInvokerClass · 0.90
EnvVariablesClass · 0.90
get_npm_versionFunction · 0.85
parse_semver_strFunction · 0.85

Tested by

no test coverage detected