diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64de1e8..4000cd6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,11 @@ jobs: run: bundle exec rake spec - name: Run behavior tests run: bundle exec cucumber + env: + GIT_COMMITTER_NAME: 'Aruba' + GIT_COMMITTER_EMAIL: 'aruba@example.com' + GIT_AUTHOR_NAME: 'Aruba' + GIT_AUTHOR_EMAIL: 'aruba@example.com' - name: Build gem run: gem build --strict --verbose *.gemspec tests: diff --git a/lib/modulesync.rb b/lib/modulesync.rb index 16e3baf..b61ac78 100644 --- a/lib/modulesync.rb +++ b/lib/modulesync.rb @@ -178,7 +178,7 @@ def self.update(cli_options) # managed_modules is either an array or a hash managed_modules.each do |puppet_module| manage_module(puppet_module, module_files, defaults) - rescue ModuleSync::Error, Git::GitExecuteError => e + rescue ModuleSync::Error, Git::Error => e message = e.message || 'Error during `update`' warn "#{puppet_module.given_name}: #{message}" exit 1 unless options[:skip_broken] diff --git a/lib/modulesync/repository.rb b/lib/modulesync/repository.rb index 3f55625..0a2596f 100644 --- a/lib/modulesync/repository.rb +++ b/lib/modulesync/repository.rb @@ -158,7 +158,7 @@ def submit_changes(files, options) repo.push('origin', branch, opts_push) puts "Changes have been pushed to: '#{branch}'" end - rescue Git::GitExecuteError => e + rescue Git::Error => e raise unless e.message.match?(/working (directory|tree) clean/) puts "There were no changes in '#{@directory}'. Not committing." diff --git a/lib/monkey_patches.rb b/lib/monkey_patches.rb index 232118c..d16833f 100644 --- a/lib/monkey_patches.rb +++ b/lib/monkey_patches.rb @@ -2,9 +2,9 @@ module Git module LibMonkeyPatch - # Monkey patch set_custom_git_env_variables due to our ::Git::GitExecuteError handling. + # Monkey patch set_custom_git_env_variables due to our ::Git::Error handling. # - # We rescue on the GitExecuteError and proceed differently based on the output of git. + # We rescue on the Git::Error and proceed differently based on the output of git. # This way makes code language-dependent, so here we ensure that Git gem throw git commands with the "C" language def set_custom_git_env_variables super diff --git a/modulesync.gemspec b/modulesync.gemspec index 3921e6e..95e4b8d 100644 --- a/modulesync.gemspec +++ b/modulesync.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'simplecov', '~> 0.22.0' spec.add_development_dependency 'voxpupuli-rubocop', '~> 2.8.0' - spec.add_runtime_dependency 'git', '~>1.7' + spec.add_runtime_dependency 'git', '>=1.7', '<3.0' spec.add_runtime_dependency 'gitlab', '>=4', '<6' spec.add_runtime_dependency 'octokit', '>=4', '<9' spec.add_runtime_dependency 'puppet-blacksmith', '>= 3.0', '< 8'