@@ -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
@@ -127,14 +132,14 @@ module Release
127
132
def release_the_new_npm_version ( npm_version , is_dry_run )
128
133
puts "Making npm release, #{ is_dry_run ? 'dry run' : 'real run' } "
129
134
# 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'
130
138
release_it_command = +'release-it'
131
139
release_it_command << " #{ npm_version } " unless npm_version == ''
132
140
release_it_command << ' --npm.publish --no-git.requireCleanWorkingDir'
133
141
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 )
138
143
end
139
144
140
145
def push
0 commit comments