From b09accebd0b23715014f73be3eaa7220d821d322 Mon Sep 17 00:00:00 2001 From: rkiel Date: Tue, 10 Oct 2017 20:23:06 -0400 Subject: [PATCH] 12-package.json: update when release candidate created --- lib/release/create.rb | 2 +- lib/release/finish.rb | 6 ++---- lib/release/leave.rb | 8 ++++---- lib/release/start.rb | 2 ++ lib/release/trash.rb | 4 ++-- lib/shared/runnable.rb | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/release/create.rb b/lib/release/create.rb index e816bc8..71170be 100644 --- a/lib/release/create.rb +++ b/lib/release/create.rb @@ -21,7 +21,7 @@ module Release validate_version_is_new version - update_package_json version + update_package_json version, version git_local_tag release_tag_from_version(version) diff --git a/lib/release/finish.rb b/lib/release/finish.rb index f6f9f6a..25b33da 100644 --- a/lib/release/finish.rb +++ b/lib/release/finish.rb @@ -18,15 +18,13 @@ module Release git_fetch_and_merge release_branch - update_package_json version_from_release_branch(release_branch) - git_local_tag release_tag_from_version(version_from_release_branch(release_branch)) git_push release_branch git_push_tags - git_checkout 'master' - git_fetch_and_merge current_branch + git_checkout :master + git_fetch_and_merge :master git_local_branch_delete release_branch diff --git a/lib/release/leave.rb b/lib/release/leave.rb index 59e7aaf..712a236 100644 --- a/lib/release/leave.rb +++ b/lib/release/leave.rb @@ -19,15 +19,15 @@ module Release end release_branch = current_branch - + error "Missing confirmation of branch: #{release_branch}" if confirmation_branch == '' error "Confirmation branch does not match current branch: #{confirmation_branch} vs #{release_branch}" if release_branch != confirmation_branch validate_current_branch_is_release - git_checkout 'master' - git_fetch_and_merge current_branch + git_checkout :master + git_fetch_and_merge :master - git_local_branch_trash current_branch + git_local_branch_trash release_branch end end diff --git a/lib/release/start.rb b/lib/release/start.rb index 468d3d2..9487e99 100644 --- a/lib/release/start.rb +++ b/lib/release/start.rb @@ -43,6 +43,8 @@ module Release git_local_branch_create release_branch_from_version(new_version), release_tag_from_version(version) git_push_upstream(release_branch_from_version(new_version)) + + update_package_json new_version, "#{new_version} started" end private diff --git a/lib/release/trash.rb b/lib/release/trash.rb index aca5c20..0ce9a95 100644 --- a/lib/release/trash.rb +++ b/lib/release/trash.rb @@ -24,8 +24,8 @@ module Release error "Confirmation branch does not match current branch: #{confirmation_branch} vs #{release_branch}" if release_branch != confirmation_branch validate_current_branch_is_release - git_checkout 'master' - git_fetch_and_merge current_branch + git_checkout :master + git_fetch_and_merge :master git_local_branch_trash release_branch diff --git a/lib/shared/runnable.rb b/lib/shared/runnable.rb index af15bff..ed122c0 100644 --- a/lib/shared/runnable.rb +++ b/lib/shared/runnable.rb @@ -21,14 +21,14 @@ module Shared exit end - def update_package_json (version) + def update_package_json (version, message) if File.exist? 'package.json' package_json = File.read('package.json') json = JSON.parse(package_json) json['version'] = version File.write('package.json', JSON.pretty_generate(json)) git_add 'package.json' - git_commit version + git_commit message end end @@ -49,11 +49,11 @@ module Shared end def git_fetch - run_cmd "git fetch origin && git fetch origin --tags" + run_cmd "git fetch origin -p && git fetch origin --tags" end def git_remote_merge ( branch ) - run_cmd "git merge origin/#{branch}" + run_cmd "git merge origin/#{branch} -m 'merged by release'" end def is_remote_branch (branch)