Skip to content

Commit 51988ef

Browse files
committed
updates to release script
1 parent d209554 commit 51988ef

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

rakelib/create_release.rake

+14-9
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ task :create_release, %i[gem_version dry_run] do |_t, args|
3939
puts 'Updating ujs:update'
4040
Rake::Task['ujs:update'].invoke
4141

42-
Release.commit_the_changes unless is_dry_run
42+
Release.commit_the_changes('Update pre-bundled react and React ujs') unless is_dry_run
4343

4444
Release.bump_gem_version(gem_version, is_dry_run)
4545
Release.release_the_new_npm_version(npm_version, is_dry_run)
@@ -62,11 +62,16 @@ module Release
6262
puts "sh_in_dir, shell_commands = #{shell_commands}"
6363
puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
6464

65-
shell_commands.flatten.each { |shell_command| sh %(cd #{dir} && #{shell_command.strip}) }
65+
shell_commands.flatten.compact.each { |shell_command| sh %(cd #{dir} && #{shell_command.strip}) }
6666
end
6767

68-
def commit_the_changes
69-
sh_in_dir(gem_root, 'git commit -am "Update pre-bundled react and React ujs"')
68+
def commit_the_changes(message)
69+
sh_in_dir(gem_root, "git commit -am #{message}") unless nothing_to_commit?
70+
end
71+
72+
def nothing_to_commit?
73+
status = `git status --porcelain`
74+
$CHILD_STATUS.success? && status == ''
7075
end
7176

7277
def ensure_there_is_nothing_to_commit
@@ -112,7 +117,7 @@ module Release
112117
gem_root,
113118
"gem bump --no-commit #{gem_version == '' ? '' : %(--version #{gem_version})}",
114119
'bundle install',
115-
(is_dry_run ? "": "git commit -am 'Bump version to #{gem_version}'")
120+
(is_dry_run ? nil: "git commit -am 'Bump version to #{gem_version}'")
116121
)
117122
end
118123

@@ -127,14 +132,14 @@ module Release
127132
def release_the_new_npm_version(npm_version, is_dry_run)
128133
puts "Making npm release, #{is_dry_run ? 'dry run' : 'real run'}"
129134
# Will bump the yarn version, commit, tag the commit, push to repo, and release on yarn
135+
puts 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'
136+
puts 'Use the OTP for NPM!'
137+
puts 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'
130138
release_it_command = +'release-it'
131139
release_it_command << " #{npm_version}" unless npm_version == ''
132140
release_it_command << ' --npm.publish --no-git.requireCleanWorkingDir'
133141
release_it_command << ' --dry-run --verbose' if is_dry_run
134-
puts 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'
135-
puts 'Use the OTP for NPM!'
136-
puts 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ'
137-
sh_in_dir(release_it_command)
142+
sh_in_dir(gem_root, release_it_command)
138143
end
139144

140145
def push

0 commit comments

Comments
 (0)