@@ -39,7 +39,7 @@ task :create_release, %i[gem_version dry_run] do |_t, args|
39
39
puts 'Updating ujs:update'
40
40
Rake ::Task [ 'ujs:update' ] . invoke
41
41
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
43
43
44
44
Release . bump_gem_version ( gem_version , is_dry_run )
45
45
Release . release_the_new_npm_version ( npm_version , is_dry_run )
@@ -62,11 +62,16 @@ module Release
62
62
puts "sh_in_dir, shell_commands = #{ shell_commands } "
63
63
puts "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
64
64
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 } ) }
66
66
end
67
67
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 == ''
70
75
end
71
76
72
77
def ensure_there_is_nothing_to_commit
@@ -112,7 +117,7 @@ module Release
112
117
gem_root ,
113
118
"gem bump --no-commit #{ gem_version == '' ? '' : %(--version #{ gem_version } ) } " ,
114
119
'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 } '" )
116
121
)
117
122
end
118
123
0 commit comments