modulesync 3.2.0 → 3.3.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +4 -2
  3. data/.github/workflows/release.yml +3 -3
  4. data/.rubocop_todo.yml +23 -64
  5. data/.simplecov +2 -0
  6. data/CHANGELOG.md +24 -0
  7. data/Gemfile +2 -0
  8. data/Rakefile +3 -1
  9. data/bin/msync +1 -0
  10. data/features/step_definitions/git_steps.rb +2 -0
  11. data/features/support/env.rb +2 -0
  12. data/lib/modulesync/cli/thor.rb +2 -0
  13. data/lib/modulesync/cli.rb +7 -0
  14. data/lib/modulesync/constants.rb +7 -5
  15. data/lib/modulesync/git_service/base.rb +2 -0
  16. data/lib/modulesync/git_service/factory.rb +2 -0
  17. data/lib/modulesync/git_service/github.rb +2 -0
  18. data/lib/modulesync/git_service/gitlab.rb +2 -0
  19. data/lib/modulesync/git_service.rb +2 -0
  20. data/lib/modulesync/hook.rb +2 -0
  21. data/lib/modulesync/puppet_module.rb +2 -0
  22. data/lib/modulesync/renderer.rb +2 -0
  23. data/lib/modulesync/repository.rb +2 -0
  24. data/lib/modulesync/settings.rb +2 -0
  25. data/lib/modulesync/source_code.rb +2 -0
  26. data/lib/modulesync/util.rb +2 -0
  27. data/lib/modulesync.rb +7 -1
  28. data/lib/monkey_patches.rb +2 -0
  29. data/modulesync.gemspec +12 -10
  30. data/spec/helpers/faker/puppet_module_remote_repo.rb +2 -0
  31. data/spec/helpers/faker.rb +2 -0
  32. data/spec/spec_helper.rb +2 -0
  33. data/spec/unit/{modulesync → module_sync}/git_service/factory_spec.rb +4 -4
  34. data/spec/unit/{modulesync → module_sync}/git_service/github_spec.rb +3 -1
  35. data/spec/unit/{modulesync → module_sync}/git_service/gitlab_spec.rb +3 -1
  36. data/spec/unit/{modulesync → module_sync}/git_service_spec.rb +38 -36
  37. data/spec/unit/{modulesync → module_sync}/settings_spec.rb +8 -6
  38. data/spec/unit/{modulesync → module_sync}/source_code_spec.rb +3 -1
  39. data/spec/unit/{modulesync_spec.rb → module_sync_spec.rb} +5 -3
  40. metadata +50 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3d5f0aeaef1a9f1931977a20b9d2e1ccc8791336f99643492f0d0a3a22d4566
4
- data.tar.gz: a4ba51d9b0d1652255478df9bd980a80eea9113125f867c65ed15b96ec223343
3
+ metadata.gz: 615bffaa29507db526e145f6237667c29c4bb4e86542293b0d0645c11136fd64
4
+ data.tar.gz: 0cee8e4725e11f2087b5a916d668cbf614e25d40ea064c82f6f6979675a3d11c
5
5
  SHA512:
6
- metadata.gz: 2f91356d53a10ebb48d686c964bb17f5a4ed636c91ad16b9c76a9639ee42b935956287f461c4a35b47af132760d6fc1f84912c4f4420525a6123d3827028e865
7
- data.tar.gz: 2c9ecf3e76db7f5439953d29bd0bf6a19b09a51d6dcc87b3e64fdc412214870db6a3de17b5e19a46c82a06214053367428178a8ade31b13e8a363d19a62f90cc
6
+ metadata.gz: 86528c3b79d79bcfd57b13e0d999f653c6d1a5855db4078f812830f5326b9af52d511174914ed821999e014f151bab48c789364697e579ec8bcc9b9c4881d516
7
+ data.tar.gz: ee485fee4217c6677c6d8d9c2fa15b42c3f8d8f33bde34b02598966315dd86b8bc54ec02d74a999c03afa98f254fe1799824c6057182a3a83e5efe5bcd84cd2a
@@ -18,7 +18,7 @@ jobs:
18
18
  - name: Setup ruby
19
19
  uses: ruby/setup-ruby@v1
20
20
  with:
21
- ruby-version: '3.1'
21
+ ruby-version: "3.4"
22
22
  bundler-cache: true
23
23
  - name: Run linter
24
24
  run: bundle exec rake rubocop
@@ -34,6 +34,8 @@ jobs:
34
34
  - ruby: "3.1"
35
35
  codecov: "yes"
36
36
  - ruby: "3.2"
37
+ - ruby: "3.3"
38
+ - ruby: "3.4"
37
39
  env:
38
40
  CODECOV: ${{ matrix.codecov }}
39
41
  steps:
@@ -48,7 +50,7 @@ jobs:
48
50
  - name: Run behavior tests
49
51
  run: bundle exec cucumber
50
52
  - name: Build gem
51
- run: gem build --verbose *.gemspec
53
+ run: gem build --strict --verbose *.gemspec
52
54
  tests:
53
55
  needs:
54
56
  - rubocop
@@ -11,14 +11,14 @@ jobs:
11
11
  if: github.repository_owner == 'voxpupuli'
12
12
  steps:
13
13
  - uses: actions/checkout@v4
14
- - name: Install Ruby 3.2
14
+ - name: Install Ruby 3.4
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: '3.2'
17
+ ruby-version: "3.4"
18
18
  env:
19
19
  BUNDLE_WITHOUT: release
20
20
  - name: Build gem
21
- run: gem build --verbose *.gemspec
21
+ run: gem build --strict --verbose *.gemspec
22
22
  - name: Publish gem to rubygems.org
23
23
  run: gem push *.gem
24
24
  env:
data/.rubocop_todo.yml CHANGED
@@ -1,82 +1,45 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2023-06-16 18:17:35 UTC using RuboCop version 1.50.2.
3
+ # on 2024-05-17 11:57:48 UTC using RuboCop version 1.63.5.
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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
11
- Lint/DuplicateBranch:
12
- Exclude:
13
- - 'lib/modulesync/renderer.rb'
14
-
15
9
  # Offense count: 1
16
10
  # Configuration parameters: AllowComments, AllowNil.
17
11
  Lint/SuppressedException:
18
12
  Exclude:
19
13
  - 'Rakefile'
20
14
 
21
- # Offense count: 1
22
- # This cop supports unsafe autocorrection (--autocorrect-all).
23
- Performance/StringInclude:
24
- Exclude:
25
- - 'Rakefile'
26
-
27
- # Offense count: 5
28
- # This cop supports unsafe autocorrection (--autocorrect-all).
29
- RSpec/BeEq:
30
- Exclude:
31
- - 'spec/unit/modulesync/settings_spec.rb'
32
-
33
15
  # Offense count: 3
34
16
  # Configuration parameters: Prefixes, AllowedPatterns.
35
17
  # Prefixes: when, with, without
36
18
  RSpec/ContextWording:
37
19
  Exclude:
38
- - 'spec/unit/modulesync/git_service/github_spec.rb'
39
- - 'spec/unit/modulesync/git_service/gitlab_spec.rb'
40
- - 'spec/unit/modulesync_spec.rb'
41
-
42
- # Offense count: 17
43
- # This cop supports unsafe autocorrection (--autocorrect-all).
44
- # Configuration parameters: SkipBlocks, EnforcedStyle.
45
- # SupportedStyles: described_class, explicit
46
- RSpec/DescribedClass:
47
- Exclude:
48
- - 'spec/unit/modulesync/git_service/factory_spec.rb'
49
- - 'spec/unit/modulesync/git_service/github_spec.rb'
50
- - 'spec/unit/modulesync/git_service/gitlab_spec.rb'
51
- - 'spec/unit/modulesync/git_service_spec.rb'
52
- - 'spec/unit/modulesync/settings_spec.rb'
53
- - 'spec/unit/modulesync/source_code_spec.rb'
54
- - 'spec/unit/modulesync_spec.rb'
20
+ - 'spec/unit/module_sync/git_service/github_spec.rb'
21
+ - 'spec/unit/module_sync/git_service/gitlab_spec.rb'
22
+ - 'spec/unit/module_sync_spec.rb'
55
23
 
56
24
  # Offense count: 11
57
25
  # Configuration parameters: CountAsOne.
58
26
  RSpec/ExampleLength:
59
27
  Max: 16
60
28
 
61
- # Offense count: 7
29
+ # Offense count: 2
62
30
  # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
63
31
  # Include: **/*_spec*rb*, **/spec/**/*
64
32
  RSpec/FilePath:
65
33
  Exclude:
66
- - 'spec/unit/modulesync/git_service/factory_spec.rb'
67
- - 'spec/unit/modulesync/git_service/github_spec.rb'
68
- - 'spec/unit/modulesync/git_service/gitlab_spec.rb'
69
- - 'spec/unit/modulesync/git_service_spec.rb'
70
- - 'spec/unit/modulesync/settings_spec.rb'
71
- - 'spec/unit/modulesync/source_code_spec.rb'
72
- - 'spec/unit/modulesync_spec.rb'
34
+ - 'spec/unit/module_sync/git_service/github_spec.rb'
35
+ - 'spec/unit/module_sync/git_service/gitlab_spec.rb'
73
36
 
74
37
  # Offense count: 19
75
38
  # Configuration parameters: AssignmentOnly.
76
39
  RSpec/InstanceVariable:
77
40
  Exclude:
78
- - 'spec/unit/modulesync/git_service/github_spec.rb'
79
- - 'spec/unit/modulesync/git_service/gitlab_spec.rb'
41
+ - 'spec/unit/module_sync/git_service/github_spec.rb'
42
+ - 'spec/unit/module_sync/git_service/gitlab_spec.rb'
80
43
 
81
44
  # Offense count: 7
82
45
  # Configuration parameters: .
@@ -93,20 +56,29 @@ RSpec/MultipleExpectations:
93
56
  # SupportedStyles: always, named_only
94
57
  RSpec/NamedSubject:
95
58
  Exclude:
96
- - 'spec/unit/modulesync/settings_spec.rb'
97
- - 'spec/unit/modulesync/source_code_spec.rb'
59
+ - 'spec/unit/module_sync/settings_spec.rb'
60
+ - 'spec/unit/module_sync/source_code_spec.rb'
98
61
 
99
62
  # Offense count: 9
100
63
  # Configuration parameters: AllowedGroups.
101
64
  RSpec/NestedGroups:
102
65
  Max: 5
103
66
 
67
+ # Offense count: 2
68
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
69
+ # Include: **/*_spec.rb
70
+ RSpec/SpecFilePathFormat:
71
+ Exclude:
72
+ - '**/spec/routing/**/*'
73
+ - 'spec/unit/module_sync/git_service/github_spec.rb'
74
+ - 'spec/unit/module_sync/git_service/gitlab_spec.rb'
75
+
104
76
  # Offense count: 6
105
77
  RSpec/StubbedMock:
106
78
  Exclude:
107
- - 'spec/unit/modulesync/git_service/github_spec.rb'
108
- - 'spec/unit/modulesync/git_service/gitlab_spec.rb'
109
- - 'spec/unit/modulesync_spec.rb'
79
+ - 'spec/unit/module_sync/git_service/github_spec.rb'
80
+ - 'spec/unit/module_sync/git_service/gitlab_spec.rb'
81
+ - 'spec/unit/module_sync_spec.rb'
110
82
 
111
83
  # Offense count: 9
112
84
  # Configuration parameters: AllowedConstants.
@@ -128,19 +100,6 @@ Style/FetchEnvVar:
128
100
  Exclude:
129
101
  - 'lib/modulesync/git_service.rb'
130
102
 
131
- # Offense count: 34
132
- # This cop supports unsafe autocorrection (--autocorrect-all).
133
- # Configuration parameters: EnforcedStyle.
134
- # SupportedStyles: always, always_true, never
135
- Style/FrozenStringLiteralComment:
136
- Enabled: false
137
-
138
- # Offense count: 2
139
- # This cop supports unsafe autocorrection (--autocorrect-all).
140
- Style/IdenticalConditionalBranches:
141
- Exclude:
142
- - 'lib/modulesync/renderer.rb'
143
-
144
103
  # Offense count: 1
145
104
  # Configuration parameters: AllowedMethods.
146
105
  # AllowedMethods: respond_to_missing?
data/.simplecov CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  SimpleCov.start do
2
4
  if ENV['SIMPLECOV_ROOT']
3
5
  SimpleCov.root(ENV['SIMPLECOV_ROOT'])
data/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [3.3.0](https://github.com/voxpupuli/modulesync/tree/3.3.0) (2025-02-26)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/modulesync/compare/3.2.0...3.3.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - Add Ruby 3.4 to CI [\#295](https://github.com/voxpupuli/modulesync/pull/295) ([kenyon](https://github.com/kenyon))
12
+ - gemspec: allow puppet-blacksmith 8.x [\#294](https://github.com/voxpupuli/modulesync/pull/294) ([kenyon](https://github.com/kenyon))
13
+ - CI: Build gems with strict and verbose mode [\#292](https://github.com/voxpupuli/modulesync/pull/292) ([bastelfreak](https://github.com/bastelfreak))
14
+ - Add Ruby 3.3 to CI [\#291](https://github.com/voxpupuli/modulesync/pull/291) ([bastelfreak](https://github.com/bastelfreak))
15
+ - Add a flag to `msync execute` on the default branch [\#288](https://github.com/voxpupuli/modulesync/pull/288) ([smortex](https://github.com/smortex))
16
+ - Update octokit requirement from \>= 4, \< 9 to \>= 4, \< 10 [\#287](https://github.com/voxpupuli/modulesync/pull/287) ([dependabot[bot]](https://github.com/apps/dependabot))
17
+ - update to voxpupuli-rubocop 2.7.0; adjust path to unit files & rubocop: autofix & regen todo file [\#281](https://github.com/voxpupuli/modulesync/pull/281) ([bastelfreak](https://github.com/bastelfreak))
18
+
19
+ **Fixed bugs:**
20
+
21
+ - pin thor to 1.3.0 [\#282](https://github.com/voxpupuli/modulesync/pull/282) ([bastelfreak](https://github.com/bastelfreak))
22
+
23
+ **Merged pull requests:**
24
+
25
+ - Update voxpupuli-rubocop requirement from ~\> 2.7.0 to ~\> 2.8.0 [\#290](https://github.com/voxpupuli/modulesync/pull/290) ([dependabot[bot]](https://github.com/apps/dependabot))
26
+ - Update gitlab requirement from ~\> 4.0 to \>= 4, \< 6 [\#289](https://github.com/voxpupuli/modulesync/pull/289) ([dependabot[bot]](https://github.com/apps/dependabot))
27
+ - rubocop: Fix Style/FrozenStringLiteralComment [\#285](https://github.com/voxpupuli/modulesync/pull/285) ([bastelfreak](https://github.com/bastelfreak))
28
+
5
29
  ## [3.2.0](https://github.com/voxpupuli/modulesync/tree/3.2.0) (2023-10-31)
6
30
 
7
31
  [Full Changelog](https://github.com/voxpupuli/modulesync/compare/3.1.0...3.2.0)
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake/clean'
2
4
  require 'cucumber/rake/task'
3
5
  require 'rubocop/rake_task'
@@ -37,7 +39,7 @@ begin
37
39
 
38
40
  # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715
39
41
  require 'rbconfig'
40
- if /linux/.match?(RbConfig::CONFIG['host_os'])
42
+ if RbConfig::CONFIG['host_os'].include?('linux')
41
43
  task :changelog do
42
44
  puts 'Fixing line endings...'
43
45
  changelog_file = File.join(__dir__, 'CHANGELOG.md')
data/bin/msync CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  if ENV['COVERAGE']
4
5
  # This block allow us to grab code coverage when running this script.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../../spec/helpers/faker/puppet_module_remote_repo'
2
4
 
3
5
  Given 'a basic setup with a puppet module {string} from {string}' do |name, namespace|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simplecov'
2
4
 
3
5
  SimpleCov.command_name 'Cucumber'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
  require 'modulesync/cli'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
 
3
5
  require 'modulesync'
@@ -173,6 +175,11 @@ module ModuleSync
173
175
  aliases: '-b',
174
176
  desc: 'Branch name to make the changes in.',
175
177
  default: CLI.defaults[:branch]
178
+ option :default_branch,
179
+ aliases: '-B',
180
+ type: :boolean,
181
+ desc: 'Work on the default branch (take precedence over --branch).',
182
+ default: false
176
183
  option :fail_fast,
177
184
  type: :boolean,
178
185
  desc: 'Abort the run after a command execution failure',
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ModuleSync
2
4
  module Constants
3
- MODULE_FILES_DIR = 'moduleroot/'.freeze
4
- CONF_FILE = 'config_defaults.yml'.freeze
5
- MODULE_CONF_FILE = '.sync.yml'.freeze
6
- MODULESYNC_CONF_FILE = 'modulesync.yml'.freeze
7
- HOOK_FILE = '.git/hooks/pre-push'.freeze
5
+ MODULE_FILES_DIR = 'moduleroot/'
6
+ CONF_FILE = 'config_defaults.yml'
7
+ MODULE_CONF_FILE = '.sync.yml'
8
+ MODULESYNC_CONF_FILE = 'modulesync.yml'
9
+ HOOK_FILE = '.git/hooks/pre-push'
8
10
  GLOBAL_DEFAULTS_KEY = :global
9
11
  end
10
12
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ModuleSync
2
4
  module GitService
3
5
  # Generic class for git services
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ModuleSync
2
4
  module GitService
3
5
  # Git service's factory
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'modulesync/git_service'
2
4
  require 'modulesync/git_service/base'
3
5
  require 'octokit'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'gitlab'
2
4
  require 'modulesync/git_service'
3
5
  require 'modulesync/git_service/base'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ModuleSync
2
4
  class Error < StandardError; end
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'modulesync'
2
4
 
3
5
  module ModuleSync
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet_blacksmith'
2
4
 
3
5
  require 'modulesync/source_code'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'erb'
2
4
  require 'find'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'git'
2
4
 
3
5
  module ModuleSync
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ModuleSync
2
4
  # Encapsulate a configs for a module, providing easy access to its parts
3
5
  # All configs MUST be keyed by the relative target filename
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'modulesync'
2
4
  require 'modulesync/git_service'
3
5
  require 'modulesync/git_service/factory'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module ModuleSync
data/lib/modulesync.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'English'
2
4
  require 'fileutils'
3
5
  require 'pathname'
@@ -207,7 +209,11 @@ module ModuleSync
207
209
  $stdout.puts "#{puppet_module.given_name}:"
208
210
 
209
211
  puppet_module.repository.clone unless puppet_module.repository.cloned?
210
- puppet_module.repository.switch branch: @options[:branch]
212
+ if @options[:default_branch]
213
+ puppet_module.repository.switch branch: false
214
+ else
215
+ puppet_module.repository.switch branch: @options[:branch]
216
+ end
211
217
 
212
218
  command_args = cli_options[:command_args]
213
219
  local_script = File.expand_path command_args[0]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Git
2
4
  module LibMonkeyPatch
3
5
  # Monkey patch set_custom_git_env_variables due to our ::Git::GitExecuteError handling.
data/modulesync.gemspec CHANGED
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
 
4
6
  Gem::Specification.new do |spec|
5
7
  spec.name = 'modulesync'
6
- spec.version = '3.2.0'
8
+ spec.version = '3.3.0'
7
9
  spec.authors = ['Vox Pupuli']
8
10
  spec.email = ['voxpupuli@groups.io']
9
11
  spec.summary = 'Puppet Module Synchronizer'
@@ -17,15 +19,15 @@ Gem::Specification.new do |spec|
17
19
  spec.require_paths = ['lib']
18
20
 
19
21
  spec.add_development_dependency 'aruba', '~>2.0'
20
- spec.add_development_dependency 'cucumber'
21
- spec.add_development_dependency 'rake'
22
- spec.add_development_dependency 'rspec'
23
- spec.add_development_dependency 'simplecov'
24
- spec.add_development_dependency 'voxpupuli-rubocop', '~> 2.0'
22
+ spec.add_development_dependency 'cucumber', '~> 9.2'
23
+ spec.add_development_dependency 'rake', '~> 13.2', '>= 13.2.1'
24
+ spec.add_development_dependency 'rspec', '~> 3.13'
25
+ spec.add_development_dependency 'simplecov', '~> 0.22.0'
26
+ spec.add_development_dependency 'voxpupuli-rubocop', '~> 2.8.0'
25
27
 
26
28
  spec.add_runtime_dependency 'git', '~>1.7'
27
- spec.add_runtime_dependency 'gitlab', '~>4.0'
28
- spec.add_runtime_dependency 'octokit', '>=4', '<9'
29
- spec.add_runtime_dependency 'puppet-blacksmith', '>= 3.0', '< 8'
30
- spec.add_runtime_dependency 'thor'
29
+ spec.add_runtime_dependency 'gitlab', '>=4', '<6'
30
+ spec.add_runtime_dependency 'octokit', '>=4', '<10'
31
+ spec.add_runtime_dependency 'puppet-blacksmith', '>= 3.0', '< 9'
32
+ spec.add_runtime_dependency 'thor', '1.3.0'
31
33
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open3'
2
4
 
3
5
  require_relative '../faker'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ModuleSync
2
4
  # Faker is a top-level module to keep global faker config
3
5
  module Faker
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simplecov'
2
4
 
3
5
  require 'modulesync'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'modulesync'
2
4
  require 'modulesync/git_service/factory'
3
5
 
@@ -5,8 +7,7 @@ describe ModuleSync::GitService::Factory do
5
7
  context 'when instantiate a GitHub service without credentials' do
6
8
  it 'raises an error' do
7
9
  expect do
8
- ModuleSync::GitService::Factory.instantiate(type: :github, endpoint: nil,
9
- token: nil)
10
+ described_class.instantiate(type: :github, endpoint: nil, token: nil)
10
11
  end.to raise_error(ModuleSync::GitService::MissingCredentialsError)
11
12
  end
12
13
  end
@@ -14,8 +15,7 @@ describe ModuleSync::GitService::Factory do
14
15
  context 'when instantiate a GitLab service without credentials' do
15
16
  it 'raises an error' do
16
17
  expect do
17
- ModuleSync::GitService::Factory.instantiate(type: :gitlab, endpoint: nil,
18
- token: nil)
18
+ described_class.instantiate(type: :gitlab, endpoint: nil, token: nil)
19
19
  end.to raise_error(ModuleSync::GitService::MissingCredentialsError)
20
20
  end
21
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  require 'modulesync/git_service/github'
@@ -7,7 +9,7 @@ describe ModuleSync::GitService::GitHub do
7
9
  before do
8
10
  @client = double
9
11
  allow(Octokit::Client).to receive(:new).and_return(@client)
10
- @it = ModuleSync::GitService::GitHub.new('test', 'https://api.github.com')
12
+ @it = described_class.new('test', 'https://api.github.com')
11
13
  end
12
14
 
13
15
  let(:args) do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  require 'modulesync/git_service/gitlab'
@@ -7,7 +9,7 @@ describe ModuleSync::GitService::GitLab do
7
9
  before do
8
10
  @client = double
9
11
  allow(Gitlab::Client).to receive(:new).and_return(@client)
10
- @it = ModuleSync::GitService::GitLab.new('test', 'https://gitlab.com/api/v4')
12
+ @it = described_class.new('test', 'https://gitlab.com/api/v4')
11
13
  end
12
14
 
13
15
  let(:args) do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'modulesync'
2
4
  require 'modulesync/git_service'
3
5
 
@@ -30,11 +32,11 @@ describe ModuleSync::GitService do
30
32
  end
31
33
 
32
34
  it 'build git service arguments from configuration entry' do
33
- expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
34
- type: :gitlab,
35
- endpoint: 'https://vcs.example.com/api/v4',
36
- token: 'secret',
37
- })
35
+ expect(described_class.configuration_for(sourcecode: sourcecode)).to eq({
36
+ type: :gitlab,
37
+ endpoint: 'https://vcs.example.com/api/v4',
38
+ token: 'secret',
39
+ })
38
40
  end
39
41
  end
40
42
 
@@ -55,11 +57,11 @@ describe ModuleSync::GitService do
55
57
  .with('GITLAB_TOKEN')
56
58
  .and_return('secret')
57
59
 
58
- expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
59
- type: :gitlab,
60
- endpoint: 'https://vcs.example.com/api/v4',
61
- token: 'secret',
62
- })
60
+ expect(described_class.configuration_for(sourcecode: sourcecode)).to eq({
61
+ type: :gitlab,
62
+ endpoint: 'https://vcs.example.com/api/v4',
63
+ token: 'secret',
64
+ })
63
65
  end
64
66
  end
65
67
 
@@ -69,21 +71,21 @@ describe ModuleSync::GitService do
69
71
  .with('GITLAB_TOKEN')
70
72
  .and_return('secret')
71
73
 
72
- expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
73
- type: :gitlab,
74
- endpoint: 'https://git.example.com/api/v4',
75
- token: 'secret',
76
- })
74
+ expect(described_class.configuration_for(sourcecode: sourcecode)).to eq({
75
+ type: :gitlab,
76
+ endpoint: 'https://git.example.com/api/v4',
77
+ token: 'secret',
78
+ })
77
79
  end
78
80
  end
79
81
 
80
82
  context 'without any environment variable sets' do
81
83
  it 'returns a nil token' do
82
- expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
83
- type: :gitlab,
84
- endpoint: 'https://git.example.com/api/v4',
85
- token: nil,
86
- })
84
+ expect(described_class.configuration_for(sourcecode: sourcecode)).to eq({
85
+ type: :gitlab,
86
+ endpoint: 'https://git.example.com/api/v4',
87
+ token: nil,
88
+ })
87
89
  end
88
90
  end
89
91
  end
@@ -102,21 +104,21 @@ describe ModuleSync::GitService do
102
104
  .with('GITLAB_TOKEN')
103
105
  .and_return('secret')
104
106
 
105
- expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
106
- type: :gitlab,
107
- endpoint: 'https://gitlab.example.com/api/v4',
108
- token: 'secret',
109
- })
107
+ expect(described_class.configuration_for(sourcecode: sourcecode)).to eq({
108
+ type: :gitlab,
109
+ endpoint: 'https://gitlab.example.com/api/v4',
110
+ token: 'secret',
111
+ })
110
112
  end
111
113
  end
112
114
 
113
115
  context 'without a GITLAB_TOKEN environment variable sets' do
114
116
  it 'returns a nil token' do
115
- expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
116
- type: :gitlab,
117
- endpoint: 'https://gitlab.example.com/api/v4',
118
- token: nil,
119
- })
117
+ expect(described_class.configuration_for(sourcecode: sourcecode)).to eq({
118
+ type: :gitlab,
119
+ endpoint: 'https://gitlab.example.com/api/v4',
120
+ token: nil,
121
+ })
120
122
  end
121
123
  end
122
124
  end
@@ -134,11 +136,11 @@ describe ModuleSync::GitService do
134
136
  .with('GITHUB_TOKEN')
135
137
  .and_return('secret')
136
138
 
137
- expect(ModuleSync::GitService.configuration_for(sourcecode: sourcecode)).to eq({
138
- type: :github,
139
- endpoint: 'https://vcs.example.com',
140
- token: 'secret',
141
- })
139
+ expect(described_class.configuration_for(sourcecode: sourcecode)).to eq({
140
+ type: :github,
141
+ endpoint: 'https://vcs.example.com',
142
+ token: 'secret',
143
+ })
142
144
  end
143
145
  end
144
146
 
@@ -152,7 +154,7 @@ describe ModuleSync::GitService do
152
154
  .with('GITLAB_TOKEN')
153
155
  .and_return('secret')
154
156
 
155
- expect { ModuleSync::GitService.configuration_for(sourcecode: sourcecode) }
157
+ expect { described_class.configuration_for(sourcecode: sourcecode) }
156
158
  .to raise_error ModuleSync::Error
157
159
  end
158
160
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe ModuleSync::Settings do
4
6
  subject do
5
- ModuleSync::Settings.new(
7
+ described_class.new(
6
8
  {},
7
9
  {},
8
10
  {},
@@ -13,11 +15,11 @@ describe ModuleSync::Settings do
13
15
  )
14
16
  end
15
17
 
16
- it { is_expected.not_to eq nil }
17
- it { expect(subject.managed?('Rakefile')).to eq false }
18
- it { expect(subject.managed?('Rakefile/foo')).to eq false }
19
- it { expect(subject.managed?('Gemfile')).to eq true }
20
- it { expect(subject.managed?('Gemfile/foo')).to eq true }
18
+ it { is_expected.not_to be_nil }
19
+ it { expect(subject.managed?('Rakefile')).to be false }
20
+ it { expect(subject.managed?('Rakefile/foo')).to be false }
21
+ it { expect(subject.managed?('Gemfile')).to be true }
22
+ it { expect(subject.managed?('Gemfile/foo')).to be true }
21
23
  it { expect(subject.managed_files([])).to eq ['Gemfile'] }
22
24
  it { expect(subject.managed_files(%w[Rakefile Gemfile other_file])).to eq %w[Gemfile other_file] }
23
25
  it { expect(subject.unmanaged_files([])).to eq ['Rakefile'] }
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe ModuleSync::SourceCode do
4
6
  subject do
5
- ModuleSync::SourceCode.new('namespace/name', nil)
7
+ described_class.new('namespace/name', nil)
6
8
  end
7
9
 
8
10
  before do
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe ModuleSync do
4
6
  context '::update' do
5
7
  it 'loads the managed modules from the specified :managed_modules_conf' do
6
- allow(ModuleSync).to receive(:find_template_files).and_return([])
8
+ allow(described_class).to receive(:find_template_files).and_return([])
7
9
  allow(ModuleSync::Util).to receive(:parse_config).with('./config_defaults.yml').and_return({})
8
- expect(ModuleSync).to receive(:managed_modules).with(no_args).and_return([])
10
+ expect(described_class).to receive(:managed_modules).with(no_args).and_return([])
9
11
 
10
12
  options = { managed_modules_conf: 'test_file.yml' }
11
- ModuleSync.update(options)
13
+ described_class.update(options)
12
14
  end
13
15
  end
14
16
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulesync
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-10-31 00:00:00.000000000 Z
10
+ date: 2025-02-26 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: aruba
@@ -28,72 +27,78 @@ dependencies:
28
27
  name: cucumber
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - ">="
30
+ - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '0'
32
+ version: '9.2'
34
33
  type: :development
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
- - - ">="
37
+ - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '0'
39
+ version: '9.2'
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: rake
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '13.2'
45
47
  - - ">="
46
48
  - !ruby/object:Gem::Version
47
- version: '0'
49
+ version: 13.2.1
48
50
  type: :development
49
51
  prerelease: false
50
52
  version_requirements: !ruby/object:Gem::Requirement
51
53
  requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '13.2'
52
57
  - - ">="
53
58
  - !ruby/object:Gem::Version
54
- version: '0'
59
+ version: 13.2.1
55
60
  - !ruby/object:Gem::Dependency
56
61
  name: rspec
57
62
  requirement: !ruby/object:Gem::Requirement
58
63
  requirements:
59
- - - ">="
64
+ - - "~>"
60
65
  - !ruby/object:Gem::Version
61
- version: '0'
66
+ version: '3.13'
62
67
  type: :development
63
68
  prerelease: false
64
69
  version_requirements: !ruby/object:Gem::Requirement
65
70
  requirements:
66
- - - ">="
71
+ - - "~>"
67
72
  - !ruby/object:Gem::Version
68
- version: '0'
73
+ version: '3.13'
69
74
  - !ruby/object:Gem::Dependency
70
75
  name: simplecov
71
76
  requirement: !ruby/object:Gem::Requirement
72
77
  requirements:
73
- - - ">="
78
+ - - "~>"
74
79
  - !ruby/object:Gem::Version
75
- version: '0'
80
+ version: 0.22.0
76
81
  type: :development
77
82
  prerelease: false
78
83
  version_requirements: !ruby/object:Gem::Requirement
79
84
  requirements:
80
- - - ">="
85
+ - - "~>"
81
86
  - !ruby/object:Gem::Version
82
- version: '0'
87
+ version: 0.22.0
83
88
  - !ruby/object:Gem::Dependency
84
89
  name: voxpupuli-rubocop
85
90
  requirement: !ruby/object:Gem::Requirement
86
91
  requirements:
87
92
  - - "~>"
88
93
  - !ruby/object:Gem::Version
89
- version: '2.0'
94
+ version: 2.8.0
90
95
  type: :development
91
96
  prerelease: false
92
97
  version_requirements: !ruby/object:Gem::Requirement
93
98
  requirements:
94
99
  - - "~>"
95
100
  - !ruby/object:Gem::Version
96
- version: '2.0'
101
+ version: 2.8.0
97
102
  - !ruby/object:Gem::Dependency
98
103
  name: git
99
104
  requirement: !ruby/object:Gem::Requirement
@@ -112,16 +117,22 @@ dependencies:
112
117
  name: gitlab
113
118
  requirement: !ruby/object:Gem::Requirement
114
119
  requirements:
115
- - - "~>"
120
+ - - ">="
116
121
  - !ruby/object:Gem::Version
117
- version: '4.0'
122
+ version: '4'
123
+ - - "<"
124
+ - !ruby/object:Gem::Version
125
+ version: '6'
118
126
  type: :runtime
119
127
  prerelease: false
120
128
  version_requirements: !ruby/object:Gem::Requirement
121
129
  requirements:
122
- - - "~>"
130
+ - - ">="
123
131
  - !ruby/object:Gem::Version
124
- version: '4.0'
132
+ version: '4'
133
+ - - "<"
134
+ - !ruby/object:Gem::Version
135
+ version: '6'
125
136
  - !ruby/object:Gem::Dependency
126
137
  name: octokit
127
138
  requirement: !ruby/object:Gem::Requirement
@@ -131,7 +142,7 @@ dependencies:
131
142
  version: '4'
132
143
  - - "<"
133
144
  - !ruby/object:Gem::Version
134
- version: '9'
145
+ version: '10'
135
146
  type: :runtime
136
147
  prerelease: false
137
148
  version_requirements: !ruby/object:Gem::Requirement
@@ -141,7 +152,7 @@ dependencies:
141
152
  version: '4'
142
153
  - - "<"
143
154
  - !ruby/object:Gem::Version
144
- version: '9'
155
+ version: '10'
145
156
  - !ruby/object:Gem::Dependency
146
157
  name: puppet-blacksmith
147
158
  requirement: !ruby/object:Gem::Requirement
@@ -151,7 +162,7 @@ dependencies:
151
162
  version: '3.0'
152
163
  - - "<"
153
164
  - !ruby/object:Gem::Version
154
- version: '8'
165
+ version: '9'
155
166
  type: :runtime
156
167
  prerelease: false
157
168
  version_requirements: !ruby/object:Gem::Requirement
@@ -161,21 +172,21 @@ dependencies:
161
172
  version: '3.0'
162
173
  - - "<"
163
174
  - !ruby/object:Gem::Version
164
- version: '8'
175
+ version: '9'
165
176
  - !ruby/object:Gem::Dependency
166
177
  name: thor
167
178
  requirement: !ruby/object:Gem::Requirement
168
179
  requirements:
169
- - - ">="
180
+ - - '='
170
181
  - !ruby/object:Gem::Version
171
- version: '0'
182
+ version: 1.3.0
172
183
  type: :runtime
173
184
  prerelease: false
174
185
  version_requirements: !ruby/object:Gem::Requirement
175
186
  requirements:
176
- - - ">="
187
+ - - '='
177
188
  - !ruby/object:Gem::Version
178
- version: '0'
189
+ version: 1.3.0
179
190
  description: Utility to synchronize common files across puppet modules in Github.
180
191
  email:
181
192
  - voxpupuli@groups.io
@@ -234,18 +245,17 @@ files:
234
245
  - spec/helpers/faker.rb
235
246
  - spec/helpers/faker/puppet_module_remote_repo.rb
236
247
  - spec/spec_helper.rb
237
- - spec/unit/modulesync/git_service/factory_spec.rb
238
- - spec/unit/modulesync/git_service/github_spec.rb
239
- - spec/unit/modulesync/git_service/gitlab_spec.rb
240
- - spec/unit/modulesync/git_service_spec.rb
241
- - spec/unit/modulesync/settings_spec.rb
242
- - spec/unit/modulesync/source_code_spec.rb
243
- - spec/unit/modulesync_spec.rb
248
+ - spec/unit/module_sync/git_service/factory_spec.rb
249
+ - spec/unit/module_sync/git_service/github_spec.rb
250
+ - spec/unit/module_sync/git_service/gitlab_spec.rb
251
+ - spec/unit/module_sync/git_service_spec.rb
252
+ - spec/unit/module_sync/settings_spec.rb
253
+ - spec/unit/module_sync/source_code_spec.rb
254
+ - spec/unit/module_sync_spec.rb
244
255
  homepage: https://github.com/voxpupuli/modulesync
245
256
  licenses:
246
257
  - Apache-2.0
247
258
  metadata: {}
248
- post_install_message:
249
259
  rdoc_options: []
250
260
  require_paths:
251
261
  - lib
@@ -260,8 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
270
  - !ruby/object:Gem::Version
261
271
  version: '0'
262
272
  requirements: []
263
- rubygems_version: 3.4.10
264
- signing_key:
273
+ rubygems_version: 3.6.2
265
274
  specification_version: 4
266
275
  summary: Puppet Module Synchronizer
267
276
  test_files: []