modulesync 4.0.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf27b8e1ab5da1a382062fb50cf5fef7b1c24ec6df90988b9033b03a8293a5ae
4
- data.tar.gz: f45b4745c56ecb09f2e41e7b7df376fa55da074d0e7eda123428282734ed1e4f
3
+ metadata.gz: 79b92d3120eabd8034f28fec21a10f0a5d67327cb4317018067493260b87082d
4
+ data.tar.gz: 4c3fffab7cd0aa697a90164485b36efad501e6432170373aabe1e911a9d8c7c1
5
5
  SHA512:
6
- metadata.gz: 04116e1a9f754869a52d7b008bc079ab5b9018fbc5a2d92a0f065a5b65dcdaf7970701e35787b2f781dc7a8b74856e7fc81c9b4bc2de76b6ac8d5006ea29dcc1
7
- data.tar.gz: 5bb03dd6cfd926a4f4249647dd54b5cf088a81015d6bf5493a7e7c6cfff657597e82884421c48814aedfcf01dba4da99290c8a89f848ac8eb6d0b5bea1595477
6
+ metadata.gz: 98cd5f5b84af7b68b042ecb240f995e3d597eae0e9cb86eab1001f56df7ff0ac22916cd4c21654409c79955cfb74455a53a4fa748685b8764819c7dbf53f334b
7
+ data.tar.gz: 589f8009a87934a82935434e4e657f87065efc179e7326f713a74bf3c5c403ef3e93b11856532e3b2f5466e24d24afacceb3b2cddd82af78f52da0871a6f27c2
@@ -46,6 +46,11 @@ jobs:
46
46
  run: bundle exec rake spec
47
47
  - name: Run behavior tests
48
48
  run: bundle exec cucumber
49
+ env:
50
+ GIT_COMMITTER_NAME: 'Aruba'
51
+ GIT_COMMITTER_EMAIL: 'aruba@example.com'
52
+ GIT_AUTHOR_NAME: 'Aruba'
53
+ GIT_AUTHOR_EMAIL: 'aruba@example.com'
49
54
  - name: Build gem
50
55
  run: gem build --strict --verbose *.gemspec
51
56
 
data/.rubocop.yml CHANGED
@@ -3,6 +3,3 @@ inherit_from: .rubocop_todo.yml
3
3
 
4
4
  inherit_gem:
5
5
  voxpupuli-rubocop: rubocop.yml
6
-
7
- AllCops:
8
- TargetRubyVersion: 3.2
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --no-auto-gen-timestamp`
3
- # using RuboCop version 1.79.2.
3
+ # using RuboCop version 1.81.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -66,8 +66,7 @@ RSpec/NestedGroups:
66
66
  Max: 5
67
67
 
68
68
  # Offense count: 2
69
- # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
70
- # Include: **/*_spec.rb
69
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata.
71
70
  RSpec/SpecFilePathFormat:
72
71
  Exclude:
73
72
  - '**/spec/routing/**/*'
@@ -108,7 +107,7 @@ Style/OptionalBooleanParameter:
108
107
  Exclude:
109
108
  - 'lib/modulesync/puppet_module.rb'
110
109
 
111
- # Offense count: 6
110
+ # Offense count: 7
112
111
  # This cop supports safe autocorrection (--autocorrect).
113
112
  # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
114
113
  # URISchemes: http, https
data/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [4.2.0](https://github.com/voxpupuli/modulesync/tree/4.2.0) (2025-10-16)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/modulesync/compare/4.1.0...4.2.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - git: Allow 4.x [\#327](https://github.com/voxpupuli/modulesync/pull/327) ([bastelfreak](https://github.com/bastelfreak))
12
+ - puppet-blacksmith: Allow 9.x [\#325](https://github.com/voxpupuli/modulesync/pull/325) ([bastelfreak](https://github.com/bastelfreak))
13
+
14
+ **Merged pull requests:**
15
+
16
+ - Update gitlab requirement from \>= 4, \< 6 to \>= 4, \< 7 [\#330](https://github.com/voxpupuli/modulesync/pull/330) ([dependabot[bot]](https://github.com/apps/dependabot))
17
+ - Update octokit requirement from \>= 4, \< 10 to \>= 4, \< 11 [\#329](https://github.com/voxpupuli/modulesync/pull/329) ([dependabot[bot]](https://github.com/apps/dependabot))
18
+ - Update cucumber requirement from ~\> 9.2 to ~\> 10.1 [\#328](https://github.com/voxpupuli/modulesync/pull/328) ([dependabot[bot]](https://github.com/apps/dependabot))
19
+ - voxpupuli-rubocop: Update 4.2.0-\>5.0.0 [\#324](https://github.com/voxpupuli/modulesync/pull/324) ([bastelfreak](https://github.com/bastelfreak))
20
+
21
+ ## [4.1.0](https://github.com/voxpupuli/modulesync/tree/4.1.0) (2025-10-16)
22
+
23
+ [Full Changelog](https://github.com/voxpupuli/modulesync/compare/4.0.1...4.1.0)
24
+
25
+ **Implemented enhancements:**
26
+
27
+ - Add execute option to preserve env vars [\#321](https://github.com/voxpupuli/modulesync/pull/321) ([Joris29](https://github.com/Joris29))
28
+ - Update git requirement from ~\> 3.0 [\#280](https://github.com/voxpupuli/modulesync/pull/280) ([dependabot[bot]](https://github.com/apps/dependabot))
29
+
5
30
  ## [4.0.1](https://github.com/voxpupuli/modulesync/tree/4.0.1) (2025-09-02)
6
31
 
7
32
  [Full Changelog](https://github.com/voxpupuli/modulesync/compare/4.0.0...4.0.1)
data/README.md CHANGED
@@ -395,6 +395,14 @@ msync update -m "Commit message" --bump --tag --tag_pattern 'v%s'
395
395
 
396
396
  The default for the tag pattern is `%s`.
397
397
 
398
+ #### Executing bundle command with a shared bundle path and gemfile
399
+
400
+ By default `msync execute` will remove bundler related env vars (^BUNDLE|^SOURCE_DATE_EPOCH$|^GEM_|RUBY), you can use `--env` flag to keep specified env vars:
401
+
402
+ ```
403
+ msync execute --env BUNDLE_PATH,BUNDLE_GEMFILE bundle exec rake lint
404
+ ```
405
+
398
406
  #### Updating the CHANGELOG
399
407
 
400
408
  When bumping the version in `metadata.json`, modulesync can let you
data/features/cli.feature CHANGED
@@ -45,5 +45,5 @@ Feature: CLI
45
45
  When I successfully run `msync update --verbose --noop --namespace fakenamespace --branch command-line-branch`
46
46
  Then the output should contain:
47
47
  """
48
- Creating new branch command-line-branch
48
+ Creating new branch command-line-branch from master
49
49
  """
@@ -49,3 +49,14 @@ Feature: execute
49
49
  [--fail-fast], [--no-fail-fast], [--skip-fail-fast] # Abort the run after a command execution failure
50
50
  """
51
51
  # NOTE: It seems there is a Thor bug here: default value is missing in help when sets to 'false'
52
+
53
+ Scenario: Show preserved bundle env var.
54
+ Given a basic setup with a puppet module "puppet-test" from "awesome"
55
+ And I set the environment variables to:
56
+ | variable | value |
57
+ | BUNLE_PATH | /opt/msync/bundle |
58
+ When I successfully run `msync exec --env BUNLE_PATH -- env`
59
+ Then the stdout should contain:
60
+ """
61
+ BUNLE_PATH=/opt/msync/bundle
62
+ """
@@ -184,6 +184,9 @@ module ModuleSync
184
184
  type: :boolean,
185
185
  desc: 'Abort the run after a command execution failure',
186
186
  default: CLI.defaults[:fail_fast].nil? || CLI.defaults[:fail_fast]
187
+ option :env,
188
+ aliases: '-e',
189
+ desc: 'Comma-separated list of environment variables to preserve.'
187
190
  def execute(*command_args)
188
191
  raise Thor::Error, 'COMMAND is a required argument' if command_args.empty?
189
192
 
@@ -145,10 +145,15 @@ module ModuleSync
145
145
  opts_commit = { amend: true } if options[:amend]
146
146
  opts_push = { force: true } if options[:force]
147
147
  if options[:pre_commit_script]
148
- script = "#{File.dirname(__FILE__, 2)}/../contrib/#{options[:pre_commit_script]}"
149
- `#{script} #{@directory}`
148
+ script = "#{File.dirname(__FILE__, 3)}/contrib/#{options[:pre_commit_script]}"
149
+ system(script, @directory)
150
+ end
151
+ if repo.status.changed.empty? && repo.status.added.empty? && repo.status.deleted.empty?
152
+ puts "There were no changes in '#{@directory}'. Not committing."
153
+ return false
154
+ else
155
+ repo.commit(message, opts_commit)
150
156
  end
151
- repo.commit(message, opts_commit)
152
157
  if options[:remote_branch]
153
158
  if remote_branch_differ?(branch, options[:remote_branch])
154
159
  repo.push('origin', "#{branch}:#{options[:remote_branch]}", opts_push)
@@ -158,11 +163,8 @@ module ModuleSync
158
163
  repo.push('origin', branch, opts_push)
159
164
  puts "Changes have been pushed to: '#{branch}'"
160
165
  end
161
- rescue Git::GitExecuteError => e
162
- raise unless e.message.match?(/working (directory|tree) clean/)
163
-
164
- puts "There were no changes in '#{@directory}'. Not committing."
165
- return false
166
+ rescue Git::Error => e
167
+ raise e.message
166
168
  end
167
169
 
168
170
  true
@@ -191,7 +193,7 @@ module ModuleSync
191
193
  checkout_branch(options[:branch])
192
194
 
193
195
  $stdout.puts 'Files changed:'
194
- repo.diff('HEAD', '--').each do |diff|
196
+ repo.diff('HEAD').each do |diff|
195
197
  $stdout.puts diff.patch
196
198
  end
197
199
 
@@ -203,7 +205,7 @@ module ModuleSync
203
205
  $stdout.puts "\n\n"
204
206
  $stdout.puts '--------------------------------'
205
207
 
206
- git.diff('HEAD', '--').any? || untracked_unignored_files.any?
208
+ git.diff('HEAD').any? || untracked_unignored_files.any?
207
209
  end
208
210
 
209
211
  def puts(*)
data/lib/modulesync.rb CHANGED
@@ -178,7 +178,7 @@ module ModuleSync
178
178
  # managed_modules is either an array or a hash
179
179
  managed_modules.each do |puppet_module|
180
180
  manage_module(puppet_module, module_files, defaults)
181
- rescue ModuleSync::Error, Git::GitExecuteError => e
181
+ rescue ModuleSync::Error, Git::Error => e
182
182
  message = e.message || 'Error during `update`'
183
183
  warn "#{puppet_module.given_name}: #{message}"
184
184
  exit 1 unless options[:skip_broken]
@@ -216,11 +216,12 @@ module ModuleSync
216
216
  end
217
217
 
218
218
  command_args = cli_options[:command_args]
219
+ env_whitelist = (@options[:env] || '').split(',')
219
220
  local_script = File.expand_path command_args[0]
220
221
  command_args[0] = local_script if File.exist?(local_script)
221
222
 
222
- # Remove bundler-related env vars to allow the subprocess to run `bundle`
223
- command_env = ENV.reject { |k, _v| k.match?(/(^BUNDLE|^SOURCE_DATE_EPOCH$|^GEM_|RUBY)/) }
223
+ # Remove bundler-related env vars to allow the subprocess to run `bundle` unless explicitly whitelisted.
224
+ command_env = ENV.reject { |k, _v| k.match?(/(^BUNDLE|^SOURCE_DATE_EPOCH$|^GEM_|RUBY)/) && !env_whitelist.include?(k) }
224
225
 
225
226
  result = system command_env, *command_args, unsetenv_others: true, chdir: puppet_module.working_directory
226
227
  unless result
@@ -2,9 +2,9 @@
2
2
 
3
3
  module Git
4
4
  module LibMonkeyPatch
5
- # Monkey patch set_custom_git_env_variables due to our ::Git::GitExecuteError handling.
5
+ # Monkey patch set_custom_git_env_variables due to our ::Git::Error handling.
6
6
  #
7
- # We rescue on the GitExecuteError and proceed differently based on the output of git.
7
+ # We rescue on the Git::Error and proceed differently based on the output of git.
8
8
  # This way makes code language-dependent, so here we ensure that Git gem throw git commands with the "C" language
9
9
  def set_custom_git_env_variables
10
10
  super
data/modulesync.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'modulesync'
8
- spec.version = '4.0.1'
8
+ spec.version = '4.2.0'
9
9
  spec.authors = ['Vox Pupuli']
10
10
  spec.email = ['voxpupuli@groups.io']
11
11
  spec.summary = 'Puppet Module Synchronizer'
@@ -19,14 +19,14 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_development_dependency 'aruba', '~>2.0'
22
- spec.add_development_dependency 'cucumber', '~> 9.2'
22
+ spec.add_development_dependency 'cucumber', '~> 10.1'
23
23
  spec.add_development_dependency 'rake', '~> 13.2', '>= 13.2.1'
24
24
  spec.add_development_dependency 'rspec', '~> 3.13'
25
- spec.add_development_dependency 'voxpupuli-rubocop', '~> 4.2.0'
25
+ spec.add_development_dependency 'voxpupuli-rubocop', '~> 5.0.0'
26
26
 
27
- spec.add_dependency 'git', '~>1.7'
28
- spec.add_dependency 'gitlab', '>=4', '<6'
29
- spec.add_dependency 'octokit', '>=4', '<10'
30
- spec.add_dependency 'puppet-blacksmith', '>= 3.0', '< 9'
27
+ spec.add_dependency 'git', '>= 3.0', '< 5'
28
+ spec.add_dependency 'gitlab', '>=4', '<7'
29
+ spec.add_dependency 'octokit', '>=4', '<11'
30
+ spec.add_dependency 'puppet-blacksmith', '>= 3.0', '< 10'
31
31
  spec.add_dependency 'thor', '~> 1.4'
32
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulesync
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '9.2'
32
+ version: '10.1'
33
33
  type: :development
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '9.2'
39
+ version: '10.1'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rake
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -77,28 +77,34 @@ dependencies:
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: 4.2.0
80
+ version: 5.0.0
81
81
  type: :development
82
82
  prerelease: false
83
83
  version_requirements: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: 4.2.0
87
+ version: 5.0.0
88
88
  - !ruby/object:Gem::Dependency
89
89
  name: git
90
90
  requirement: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - "~>"
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
- version: '1.7'
94
+ version: '3.0'
95
+ - - "<"
96
+ - !ruby/object:Gem::Version
97
+ version: '5'
95
98
  type: :runtime
96
99
  prerelease: false
97
100
  version_requirements: !ruby/object:Gem::Requirement
98
101
  requirements:
99
- - - "~>"
102
+ - - ">="
100
103
  - !ruby/object:Gem::Version
101
- version: '1.7'
104
+ version: '3.0'
105
+ - - "<"
106
+ - !ruby/object:Gem::Version
107
+ version: '5'
102
108
  - !ruby/object:Gem::Dependency
103
109
  name: gitlab
104
110
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +114,7 @@ dependencies:
108
114
  version: '4'
109
115
  - - "<"
110
116
  - !ruby/object:Gem::Version
111
- version: '6'
117
+ version: '7'
112
118
  type: :runtime
113
119
  prerelease: false
114
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -118,7 +124,7 @@ dependencies:
118
124
  version: '4'
119
125
  - - "<"
120
126
  - !ruby/object:Gem::Version
121
- version: '6'
127
+ version: '7'
122
128
  - !ruby/object:Gem::Dependency
123
129
  name: octokit
124
130
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +134,7 @@ dependencies:
128
134
  version: '4'
129
135
  - - "<"
130
136
  - !ruby/object:Gem::Version
131
- version: '10'
137
+ version: '11'
132
138
  type: :runtime
133
139
  prerelease: false
134
140
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +144,7 @@ dependencies:
138
144
  version: '4'
139
145
  - - "<"
140
146
  - !ruby/object:Gem::Version
141
- version: '10'
147
+ version: '11'
142
148
  - !ruby/object:Gem::Dependency
143
149
  name: puppet-blacksmith
144
150
  requirement: !ruby/object:Gem::Requirement
@@ -148,7 +154,7 @@ dependencies:
148
154
  version: '3.0'
149
155
  - - "<"
150
156
  - !ruby/object:Gem::Version
151
- version: '9'
157
+ version: '10'
152
158
  type: :runtime
153
159
  prerelease: false
154
160
  version_requirements: !ruby/object:Gem::Requirement
@@ -158,7 +164,7 @@ dependencies:
158
164
  version: '3.0'
159
165
  - - "<"
160
166
  - !ruby/object:Gem::Version
161
- version: '9'
167
+ version: '10'
162
168
  - !ruby/object:Gem::Dependency
163
169
  name: thor
164
170
  requirement: !ruby/object:Gem::Requirement