@@ -1030,18 +1030,14 @@ namespace :all do
10301030 Rake ::Task [ 'all:docs' ] . invoke
10311031 Rake ::Task [ 'all:version' ] . invoke ( 'nightly' )
10321032
1033- puts "Staging nightly version updates"
1034- @git . add ( [ 'java/version.bzl' ,
1035- 'rb/lib/selenium/webdriver/version.rb' ,
1036- 'rb/Gemfile.lock' ,
1037- 'rust/BUILD.bazel' ,
1038- 'rust/Cargo.Bazel.lock' ,
1039- 'rust/Cargo.lock' ,
1040- 'rust/Cargo.toml' ] ,
1041- all : true )
10421033 puts "Committing nightly version updates"
1043- @git . commit ( 'update versions to nightly' )
1044- puts "Pushing changes to upstream repository"
1034+ commit! ( 'update versions to nightly' , [ 'java/version.bzl' ,
1035+ 'rb/lib/selenium/webdriver/version.rb' ,
1036+ 'rb/Gemfile.lock' ,
1037+ 'rust/BUILD.bazel' ,
1038+ 'rust/Cargo.Bazel.lock' ,
1039+ 'rust/Cargo.lock' ,
1040+ 'rust/Cargo.toml' ] )
10451041
10461042 print 'Do you want to push the committed changes? (Y/n): '
10471043 response = STDIN . gets . chomp . downcase
@@ -1175,15 +1171,12 @@ def update_gh_pages
11751171 end
11761172 end
11771173
1178- puts "Staging changes for commit"
1179- @git . add ( 'docs/api' , all : true )
1180-
11811174 print 'Do you want to commit the changes? (Y/n): '
11821175 response = STDIN . gets . chomp . downcase
11831176 return restore_git ( origin_reference ) unless response == 'y' || response == 'yes'
11841177
11851178 puts "Committing changes"
1186- @git . commit ( 'updating all API docs' )
1179+ commit! ( 'updating all API docs' , 'docs/api/ ')
11871180
11881181 puts "Pushing changes to upstream repository"
11891182 @git . push
@@ -1246,3 +1239,13 @@ def update_changelog(version, language, path, changelog, header)
12461239 file . truncate ( file . pos )
12471240 end
12481241end
1242+
1243+ def commit! ( message , files = [ ] , all : false )
1244+ files . each do |file |
1245+ puts "adding: #{ file } "
1246+ @git . add ( file )
1247+ end
1248+ all ? @git . commit_all ( message ) : @git . commit ( message )
1249+ rescue Git ::FailedError => ex
1250+ puts ex . message
1251+ end
0 commit comments