ra10ke 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42a64a748cf4b63602804c2aac20987e23d8a7ad2a01ca3365d3ed998324f058
4
- data.tar.gz: daa94b8601294ed8c480f431d396eda60c2a14d2c7aa608e4941189033c01b24
3
+ metadata.gz: 831394d4b5c7c271c4677d789f2a5b39972813d06161c34eaa7346db9c79f968
4
+ data.tar.gz: 733635d7e5343acb84fe44722ff2f5e6676df727051c036383c5f23e53b5a9f5
5
5
  SHA512:
6
- metadata.gz: b1b0a572ecb7928f0e38254f6ed91f4e501f2755497a53ced15a164ada79dfa2b335afe7f4565c27ae63050a17d57c8df45dd39dd5fbac0271361f00c8063c5a
7
- data.tar.gz: 251245599d77dbbd4b01c3946693083782fe8b1f0937236fc207ca3c69616b967743cafa0bb8e4151407199fd8d4e0be0479da8e7f83009bb22f0fe9192785e1
6
+ metadata.gz: bb1d2e33ac0dbabc35e2bf3f6c53a8fe21f1dac27a9a89f19d0cff0e418d3803bce05e6d7f6f470572d840edbf8e6d00cdb8bffc30cf46e7fc53a714facbaebc
7
+ data.tar.gz: 83134e8848e15148d27bf34818062e0421c366965e099b3ebe9d0b954db5cd38256b3e64ceabcccb056cb0472340b9faaf8c5518675987c545134c5ade01c848
@@ -1,11 +1,17 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
-
6
1
  version: 2
7
2
  updates:
8
- - package-ecosystem: "bundler" # See documentation for possible values
9
- directory: "/" # Location of package manifests
3
+ # raise PRs for gem updates
4
+ - package-ecosystem: bundler
5
+ directory: "/"
6
+ schedule:
7
+ interval: daily
8
+ time: "13:00"
9
+ open-pull-requests-limit: 10
10
+
11
+ # Maintain dependencies for GitHub Actions
12
+ - package-ecosystem: github-actions
13
+ directory: "/"
10
14
  schedule:
11
- interval: "daily"
15
+ interval: daily
16
+ time: "13:00"
17
+ open-pull-requests-limit: 10
@@ -10,7 +10,7 @@ jobs:
10
10
  runs-on: ubuntu-latest
11
11
  if: github.repository_owner == 'voxpupuli'
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  - name: Install Ruby 3.0
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
@@ -1,12 +1,26 @@
1
1
  name: Test
2
2
 
3
3
  on:
4
- - pull_request
4
+ pull_request: {}
5
+ push:
6
+ branches:
7
+ - master
5
8
 
6
9
  env:
7
10
  BUNDLE_WITHOUT: release
8
11
 
9
12
  jobs:
13
+ rubocop:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ - name: Install Ruby ${{ matrix.ruby }}
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: "3.2"
21
+ bundler-cache: true
22
+ - name: Run Rubocop
23
+ run: bundle exec rake rubocop
10
24
  test:
11
25
  runs-on: ubuntu-latest
12
26
  strategy:
@@ -17,16 +31,27 @@ jobs:
17
31
  - ruby: "3.0"
18
32
  - ruby: "3.1"
19
33
  coverage: "yes"
34
+ - ruby: "3.2"
20
35
  env:
21
36
  COVERAGE: ${{ matrix.coverage }}
37
+ name: Ruby ${{ matrix.ruby }}
22
38
  steps:
23
- - uses: actions/checkout@v2
39
+ - uses: actions/checkout@v3
24
40
  - name: Install Ruby ${{ matrix.ruby }}
25
41
  uses: ruby/setup-ruby@v1
26
42
  with:
27
43
  ruby-version: ${{ matrix.ruby }}
28
44
  bundler-cache: true
29
45
  - name: Run tests
30
- run: bundle exec rake
31
- - name: Build gem
32
- run: gem build *.gemspec
46
+ run: bundle exec rake spec
47
+ - name: Verify gem builds
48
+ run: gem build --strict --verbose *.gemspec
49
+
50
+ tests:
51
+ needs:
52
+ - rubocop
53
+ - test
54
+ runs-on: ubuntu-latest
55
+ name: Test suite
56
+ steps:
57
+ - run: echo Test suite completed
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ ---
2
+ inherit_from: .rubocop_todo.yml
3
+
4
+ inherit_gem:
5
+ voxpupuli-rubocop: rubocop.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,262 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2023-08-23 12:05:42 UTC using RuboCop version 1.54.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: AllowedParentClasses.
11
+ Lint/MissingSuper:
12
+ Exclude:
13
+ - 'lib/ra10ke.rb'
14
+
15
+ # Offense count: 1
16
+ Lint/NoReturnInBeginEndBlocks:
17
+ Exclude:
18
+ - 'lib/ra10ke/puppetfile_parser.rb'
19
+
20
+ # Offense count: 1
21
+ # Configuration parameters: AllowComments, AllowNil.
22
+ Lint/SuppressedException:
23
+ Exclude:
24
+ - 'Rakefile'
25
+
26
+ # Offense count: 5
27
+ # This cop supports unsafe autocorrection (--autocorrect-all).
28
+ Lint/UselessAssignment:
29
+ Exclude:
30
+ - 'lib/ra10ke/dependencies.rb'
31
+ - 'lib/ra10ke/solve.rb'
32
+
33
+ # Offense count: 1
34
+ Naming/AccessorMethodName:
35
+ Exclude:
36
+ - 'lib/ra10ke.rb'
37
+
38
+ # Offense count: 1
39
+ # Configuration parameters: ForbiddenDelimiters.
40
+ # ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
41
+ Naming/HeredocDelimiterNaming:
42
+ Exclude:
43
+ - 'lib/ra10ke/dependencies.rb'
44
+
45
+ # Offense count: 1
46
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
47
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
48
+ Naming/MethodParameterName:
49
+ Exclude:
50
+ - 'lib/ra10ke/solve.rb'
51
+
52
+ # Offense count: 2
53
+ # This cop supports unsafe autocorrection (--autocorrect-all).
54
+ Performance/Count:
55
+ Exclude:
56
+ - 'lib/ra10ke/validate.rb'
57
+ - 'spec/ra10ke/validate_spec.rb'
58
+
59
+ # Offense count: 2
60
+ # This cop supports unsafe autocorrection (--autocorrect-all).
61
+ Performance/MapCompact:
62
+ Exclude:
63
+ - 'lib/ra10ke/dependencies.rb'
64
+ - 'lib/ra10ke/puppetfile_parser.rb'
65
+
66
+ # Offense count: 4
67
+ RSpec/AnyInstance:
68
+ Exclude:
69
+ - 'spec/ra10ke/validate_spec.rb'
70
+ - 'spec/ra10ke_spec.rb'
71
+
72
+ # Offense count: 3
73
+ # This cop supports unsafe autocorrection (--autocorrect-all).
74
+ RSpec/BeEq:
75
+ Exclude:
76
+ - 'spec/ra10ke/deprecation_spec.rb'
77
+
78
+ # Offense count: 6
79
+ # Configuration parameters: Prefixes, AllowedPatterns.
80
+ # Prefixes: when, with, without
81
+ RSpec/ContextWording:
82
+ Exclude:
83
+ - 'spec/ra10ke/dependencies_spec.rb'
84
+
85
+ # Offense count: 5
86
+ # Configuration parameters: CountAsOne.
87
+ RSpec/ExampleLength:
88
+ Max: 31
89
+
90
+ # Offense count: 10
91
+ RSpec/ExpectInHook:
92
+ Exclude:
93
+ - 'spec/ra10ke/validate_spec.rb'
94
+
95
+ # Offense count: 15
96
+ # Configuration parameters: .
97
+ # SupportedStyles: have_received, receive
98
+ RSpec/MessageSpies:
99
+ EnforcedStyle: receive
100
+
101
+ # Offense count: 7
102
+ RSpec/MultipleExpectations:
103
+ Max: 3
104
+
105
+ # Offense count: 1
106
+ # Configuration parameters: AllowedPatterns.
107
+ # AllowedPatterns: ^expect_, ^assert_
108
+ RSpec/NoExpectationExample:
109
+ Exclude:
110
+ - 'spec/ra10ke/dependencies_spec.rb'
111
+
112
+ # Offense count: 12
113
+ RSpec/StubbedMock:
114
+ Exclude:
115
+ - 'spec/ra10ke/deprecation_spec.rb'
116
+ - 'spec/ra10ke/validate_spec.rb'
117
+
118
+ # Offense count: 7
119
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
120
+ RSpec/VerifiedDoubles:
121
+ Exclude:
122
+ - 'spec/ra10ke/deprecation_spec.rb'
123
+ - 'spec/ra10ke/validate_spec.rb'
124
+
125
+ # Offense count: 1
126
+ RSpec/VoidExpect:
127
+ Exclude:
128
+ - 'spec/ra10ke/git_repo_spec.rb'
129
+
130
+ # Offense count: 6
131
+ # This cop supports unsafe autocorrection (--autocorrect-all).
132
+ # Configuration parameters: EnforcedStyle.
133
+ # SupportedStyles: nested, compact
134
+ Style/ClassAndModuleChildren:
135
+ Exclude:
136
+ - 'lib/ra10ke/dependencies.rb'
137
+ - 'lib/ra10ke/deprecation.rb'
138
+ - 'lib/ra10ke/duplicates.rb'
139
+ - 'lib/ra10ke/install.rb'
140
+ - 'lib/ra10ke/solve.rb'
141
+ - 'lib/ra10ke/syntax.rb'
142
+
143
+ # Offense count: 1
144
+ # This cop supports unsafe autocorrection (--autocorrect-all).
145
+ # Configuration parameters: AllowedReceivers.
146
+ Style/CollectionCompact:
147
+ Exclude:
148
+ - 'lib/ra10ke/dependencies.rb'
149
+
150
+ # Offense count: 15
151
+ # Configuration parameters: AllowedConstants.
152
+ Style/Documentation:
153
+ Exclude:
154
+ - 'spec/**/*'
155
+ - 'test/**/*'
156
+ - 'lib/ra10ke.rb'
157
+ - 'lib/ra10ke/dependencies.rb'
158
+ - 'lib/ra10ke/deprecation.rb'
159
+ - 'lib/ra10ke/duplicates.rb'
160
+ - 'lib/ra10ke/git_repo.rb'
161
+ - 'lib/ra10ke/install.rb'
162
+ - 'lib/ra10ke/monkey_patches.rb'
163
+ - 'lib/ra10ke/puppetfile_parser.rb'
164
+ - 'lib/ra10ke/solve.rb'
165
+ - 'lib/ra10ke/syntax.rb'
166
+ - 'lib/ra10ke/validate.rb'
167
+
168
+ # Offense count: 5
169
+ # This cop supports safe autocorrection (--autocorrect).
170
+ # Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
171
+ # SupportedStyles: annotated, template, unannotated
172
+ Style/FormatStringToken:
173
+ EnforcedStyle: unannotated
174
+
175
+ # Offense count: 11
176
+ # This cop supports unsafe autocorrection (--autocorrect-all).
177
+ # Configuration parameters: EnforcedStyle.
178
+ # SupportedStyles: always, always_true, never
179
+ Style/FrozenStringLiteralComment:
180
+ Exclude:
181
+ - 'Gemfile'
182
+ - 'Rakefile'
183
+ - 'lib/ra10ke.rb'
184
+ - 'lib/ra10ke/dependencies.rb'
185
+ - 'lib/ra10ke/install.rb'
186
+ - 'lib/ra10ke/puppetfile_parser.rb'
187
+ - 'lib/ra10ke/solve.rb'
188
+ - 'lib/ra10ke/syntax.rb'
189
+ - 'lib/ra10ke/version.rb'
190
+ - 'ra10ke.gemspec'
191
+ - 'spec/ra10ke/puppetfile_parser_spec.rb'
192
+
193
+ # Offense count: 1
194
+ # This cop supports unsafe autocorrection (--autocorrect-all).
195
+ # Configuration parameters: InverseMethods, InverseBlocks.
196
+ Style/InverseMethods:
197
+ Exclude:
198
+ - 'lib/ra10ke/dependencies.rb'
199
+
200
+ # Offense count: 1
201
+ Style/MultilineBlockChain:
202
+ Exclude:
203
+ - 'lib/ra10ke/dependencies.rb'
204
+
205
+ # Offense count: 1
206
+ # This cop supports unsafe autocorrection (--autocorrect-all).
207
+ # Configuration parameters: EnforcedStyle.
208
+ # SupportedStyles: literals, strict
209
+ Style/MutableConstant:
210
+ Exclude:
211
+ - 'lib/ra10ke/version.rb'
212
+
213
+ # Offense count: 1
214
+ # This cop supports unsafe autocorrection (--autocorrect-all).
215
+ # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
216
+ # SupportedStyles: predicate, comparison
217
+ Style/NumericPredicate:
218
+ Exclude:
219
+ - 'spec/**/*'
220
+ - 'lib/ra10ke/validate.rb'
221
+
222
+ # Offense count: 1
223
+ # This cop supports unsafe autocorrection (--autocorrect-all).
224
+ Style/RedundantInterpolation:
225
+ Exclude:
226
+ - 'lib/ra10ke/duplicates.rb'
227
+
228
+ # Offense count: 1
229
+ # This cop supports unsafe autocorrection (--autocorrect-all).
230
+ Style/RedundantSort:
231
+ Exclude:
232
+ - 'lib/ra10ke/dependencies.rb'
233
+
234
+ # Offense count: 1
235
+ # This cop supports unsafe autocorrection (--autocorrect-all).
236
+ # Configuration parameters: RequireEnglish, EnforcedStyle.
237
+ # SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
238
+ Style/SpecialGlobalVars:
239
+ Exclude:
240
+ - 'ra10ke.gemspec'
241
+
242
+ # Offense count: 1
243
+ # This cop supports unsafe autocorrection (--autocorrect-all).
244
+ # Configuration parameters: Mode.
245
+ Style/StringConcatenation:
246
+ Exclude:
247
+ - 'lib/ra10ke/solve.rb'
248
+
249
+ # Offense count: 2
250
+ # This cop supports unsafe autocorrection (--autocorrect-all).
251
+ # Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
252
+ # AllowedMethods: define_method
253
+ Style/SymbolProc:
254
+ Exclude:
255
+ - 'lib/ra10ke/dependencies.rb'
256
+
257
+ # Offense count: 6
258
+ # This cop supports safe autocorrection (--autocorrect).
259
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
260
+ # URISchemes: http, https
261
+ Layout/LineLength:
262
+ Max: 137
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
+ ## [v3.0.0](https://github.com/voxpupuli/ra10ke/tree/v3.0.0) (2023-08-23)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/ra10ke/compare/v2.0.0...v3.0.0)
8
+
9
+ **Breaking changes:**
10
+
11
+ - Add exit codes to dependency check [\#86](https://github.com/voxpupuli/ra10ke/pull/86) ([sebastianrakel](https://github.com/sebastianrakel))
12
+ - Drop Ruby 2.6 support & Implement voxpupuli-rubocop [\#85](https://github.com/voxpupuli/ra10ke/pull/85) ([bastelfreak](https://github.com/bastelfreak))
13
+
14
+ **Implemented enhancements:**
15
+
16
+ - Add Ruby 3.2 support / apply Vox Pupuli CI best practices [\#89](https://github.com/voxpupuli/ra10ke/pull/89) ([bastelfreak](https://github.com/bastelfreak))
17
+
18
+ **Fixed bugs:**
19
+
20
+ - module with https + token is failing [\#84](https://github.com/voxpupuli/ra10ke/issues/84)
21
+
22
+ **Merged pull requests:**
23
+
24
+ - dependencies: Add strict version boundaries [\#91](https://github.com/voxpupuli/ra10ke/pull/91) ([bastelfreak](https://github.com/bastelfreak))
25
+ - Bump actions/checkout from 2 to 3 [\#90](https://github.com/voxpupuli/ra10ke/pull/90) ([dependabot[bot]](https://github.com/apps/dependabot))
26
+ - dependabot: check for github actions and gems [\#88](https://github.com/voxpupuli/ra10ke/pull/88) ([bastelfreak](https://github.com/bastelfreak))
27
+ - Fix fixture for deprecation test [\#87](https://github.com/voxpupuli/ra10ke/pull/87) ([sebastianrakel](https://github.com/sebastianrakel))
28
+
5
29
  ## [v2.0.0](https://github.com/voxpupuli/ra10ke/tree/v2.0.0) (2022-05-18)
6
30
 
7
31
  [Full Changelog](https://github.com/voxpupuli/ra10ke/compare/v1.2.0...v2.0.0)
data/Gemfile CHANGED
@@ -4,10 +4,10 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :release do
7
- gem 'github_changelog_generator', :require => false
7
+ gem 'github_changelog_generator', require: false
8
8
  end
9
9
 
10
- group :coverage, optional: ENV['COVERAGE']!='yes' do
11
- gem 'simplecov-console', :require => false
12
- gem 'codecov', :require => false
10
+ group :coverage, optional: ENV['COVERAGE'] != 'yes' do
11
+ gem 'codecov', require: false
12
+ gem 'simplecov-console', require: false
13
13
  end
data/Rakefile CHANGED
@@ -6,24 +6,30 @@ require 'fileutils'
6
6
  require 'rspec/core'
7
7
  require 'rspec/core/rake_task'
8
8
 
9
- CLEAN.include("pkg/", "tmp/")
10
- CLOBBER.include("Gemfile.lock")
9
+ CLEAN.include('pkg/', 'tmp/')
10
+ CLOBBER.include('Gemfile.lock')
11
11
 
12
- task :default => [:spec]
12
+ task default: [:spec]
13
13
 
14
14
  RSpec::Core::RakeTask.new(:spec) do |spec|
15
- spec.pattern = FileList['spec/**/*_spec.rb']
15
+ spec.pattern = FileList['spec/**/*_spec.rb']
16
16
  end
17
17
 
18
18
  begin
19
19
  require 'github_changelog_generator/task'
20
20
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
21
21
  version = Ra10ke::VERSION
22
- config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/
22
+ config.future_release = "v#{version}" if /^\d+\.\d+.\d+$/.match?(version)
23
23
  config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
24
- config.exclude_labels = %w{duplicate question invalid wontfix wont-fix skip-changelog}
24
+ config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog]
25
25
  config.user = 'voxpupuli'
26
26
  config.project = 'ra10ke'
27
27
  end
28
28
  rescue LoadError
29
29
  end
30
+
31
+ begin
32
+ require 'voxpupuli/rubocop/rake'
33
+ rescue LoadError
34
+ # the voxpupuli-rubocop gem is optional
35
+ end
@@ -5,8 +5,10 @@ require 'table_print'
5
5
  require 'git'
6
6
 
7
7
  module Ra10ke::Dependencies
8
- class Verification
8
+ GOOD_EMOJI = ENV['GOOD_EMOJI'] || '👍'
9
+ BAD_EMOJI = ENV['BAD_EMOJI'] || '😨'
9
10
 
11
+ class Verification
10
12
  def self.version_formats
11
13
  @version_formats ||= {}
12
14
  end
@@ -20,12 +22,10 @@ module Ra10ke::Dependencies
20
22
 
21
23
  Ra10ke::Dependencies::Verification.register_version_format(:semver) do |tags|
22
24
  latest_tag = tags.map do |tag|
23
- begin
24
- Semverse::Version.new tag[/\Av?(.*)\Z/, 1]
25
- rescue Semverse::InvalidVersionFormat
26
- # ignore tags that do not comply to semver
27
- nil
28
- end
25
+ Semverse::Version.new tag[/\Av?(.*)\Z/, 1]
26
+ rescue Semverse::InvalidVersionFormat
27
+ # ignore tags that do not comply to semver
28
+ nil
29
29
  end.select { |tag| !tag.nil? }.sort.last.to_s.downcase
30
30
  latest_ref = tags.detect { |tag| tag[/\Av?(.*)\Z/, 1] == latest_tag }
31
31
  end
@@ -33,8 +33,8 @@ module Ra10ke::Dependencies
33
33
 
34
34
  def initialize(pfile)
35
35
  @puppetfile = pfile
36
- # semver is the default version format.
37
-
36
+ # semver is the default version format.
37
+
38
38
  puppetfile.load!
39
39
  end
40
40
 
@@ -49,22 +49,22 @@ module Ra10ke::Dependencies
49
49
  def ignored_modules
50
50
  # ignore file allows for "don't tell me about this"
51
51
  @ignored_modules ||= begin
52
- File.readlines('.r10kignore').each {|l| l.chomp!} if File.exist?('.r10kignore')
52
+ File.readlines('.r10kignore').each { |l| l.chomp! } if File.exist?('.r10kignore')
53
53
  end || []
54
54
  end
55
-
56
- # @summary creates an array of module hashes with version info
57
- # @param {Object} supplied_puppetfile - the parsed puppetfile object
55
+
56
+ # @summary creates an array of module hashes with version info
57
+ # @param {Object} supplied_puppetfile - the parsed puppetfile object
58
58
  # @returns {Array} array of version info for each module
59
59
  # @note does not include ignored modules or modules up2date
60
60
  def processed_modules(supplied_puppetfile = puppetfile)
61
61
  threads = []
62
62
  threads = supplied_puppetfile.modules.map do |puppet_module|
63
- Thread.new do
64
- begin
63
+ Thread.new do
65
64
  next if ignored_modules.include? puppet_module.title
66
- if puppet_module.class == ::R10K::Module::Forge
67
- module_name = puppet_module.title.gsub('/', '-')
65
+
66
+ if puppet_module.instance_of?(::R10K::Module::Forge)
67
+ module_name = puppet_module.title.tr('/', '-')
68
68
  forge_version = ::PuppetForge::Module.find(module_name).current_release.version
69
69
  installed_version = puppet_module.expected_version
70
70
  {
@@ -72,10 +72,10 @@ module Ra10ke::Dependencies
72
72
  installed: installed_version,
73
73
  latest: forge_version,
74
74
  type: 'forge',
75
- message: installed_version != forge_version ? :outdated : :current
75
+ message: (installed_version == forge_version) ? :current : :outdated,
76
76
  }
77
-
78
- elsif puppet_module.class == R10K::Module::Git
77
+
78
+ elsif puppet_module.instance_of?(R10K::Module::Git)
79
79
  # use helper; avoid `desired_ref`
80
80
  # we do not want to deal with `:control_branch`
81
81
  ref = puppet_module.version
@@ -96,10 +96,10 @@ module Ra10ke::Dependencies
96
96
  # register own version formats with
97
97
  # Ra10ke::Dependencies.register_version_format(:name, &block)
98
98
  latest_ref = get_latest_ref(remote_refs)
99
- elsif ref.match(/^[a-z0-9]{40}$/)
100
- ref = ref.slice(0,8)
99
+ elsif /^[a-z0-9]{40}$/.match?(ref)
100
+ ref = ref.slice(0, 8)
101
101
  # for sha just assume head should be tracked
102
- latest_ref = remote_refs['head'][:sha].slice(0,8)
102
+ latest_ref = remote_refs['head'][:sha].slice(0, 8)
103
103
  else
104
104
  raise "Unable to determine ref type for #{puppet_module.title}"
105
105
  end
@@ -108,26 +108,25 @@ module Ra10ke::Dependencies
108
108
  installed: ref,
109
109
  latest: latest_ref,
110
110
  type: 'git',
111
- message: ref != latest_ref ? :outdated : :current
111
+ message: (ref == latest_ref) ? :current : :outdated,
112
112
  }
113
113
 
114
114
  end
115
115
  rescue R10K::Util::Subprocess::SubprocessError => e
116
- {
117
- name: puppet_module.title,
118
- installed: nil,
119
- latest: nil,
120
- type: :error,
121
- message: e.message
122
- }
123
- end
116
+ {
117
+ name: puppet_module.title,
118
+ installed: nil,
119
+ latest: nil,
120
+ type: :error,
121
+ message: e.message,
122
+ }
124
123
  end
125
124
  end
126
125
  threads.map { |th| th.join.value }.compact
127
126
  end
128
127
 
129
- def outdated(supplied_puppetfile = puppetfile)
130
- processed_modules.find_all do | mod |
128
+ def outdated(_supplied_puppetfile = puppetfile)
129
+ processed_modules.find_all do |mod|
131
130
  mod[:message] == :outdated
132
131
  end
133
132
  end
@@ -139,7 +138,7 @@ module Ra10ke::Dependencies
139
138
  end
140
139
 
141
140
  def define_task_print_git_conversion(*_args)
142
- desc "Convert and print forge modules to git format"
141
+ desc 'Convert and print forge modules to git format'
143
142
  task :print_git_conversion do
144
143
  require 'ra10ke/git_repo'
145
144
  require 'r10k/puppetfile'
@@ -152,26 +151,26 @@ module Ra10ke::Dependencies
152
151
 
153
152
  # ignore file allows for "don't tell me about this"
154
153
  ignore_modules = []
155
- if File.exist?('.r10kignore')
156
- ignore_modules = File.readlines('.r10kignore').each {|l| l.chomp!}
154
+ ignore_modules = File.readlines('.r10kignore').each { |l| l.chomp! } if File.exist?('.r10kignore')
155
+ forge_mods = puppetfile.modules.find_all do |mod|
156
+ mod.instance_of?(R10K::Module::Forge) && mod.v3_module.homepage_url?
157
157
  end
158
- forge_mods = puppetfile.modules.find_all { |mod| mod.instance_of?(R10K::Module::Forge) && mod.v3_module.homepage_url? }
159
-
158
+
160
159
  threads = forge_mods.map do |mod|
161
- Thread.new do
162
- source_url = mod.v3_module.attributes.dig(:current_release, :metadata, :source) || mod.v3_module.homepage_url
160
+ Thread.new do
161
+ source_url = mod.v3_module.attributes.dig(:current_release, :metadata, :source) || mod.v3_module.homepage_url
163
162
  # git:// does not work with ls-remote command, convert to https
164
163
  source_url = source_url.gsub('git://', 'https://')
165
- source_url = source_url.gsub(/\Agit\@(.*)\:(.*)/) do
166
- "https://#{$1}/#{$2}"
164
+ source_url = source_url.gsub(/\Agit@(.*):(.*)/) do
165
+ "https://#{::Regexp.last_match(1)}/#{::Regexp.last_match(2)}"
167
166
  end
168
167
  repo = ::Ra10ke::GitRepo.new(source_url)
169
- ref = repo.get_ref_like(mod.expected_version)
168
+ ref = repo.get_ref_like(mod.expected_version)
170
169
  ref_name = ref ? ref[:name] : "bad url or tag #{mod.expected_version} is missing"
171
170
  <<~EOF
172
- mod '#{mod.name}',
173
- :git => '#{source_url}',
174
- :ref => '#{ref_name}'
171
+ mod '#{mod.name}',
172
+ :git => '#{source_url}',
173
+ :ref => '#{ref_name}'
175
174
 
176
175
  EOF
177
176
  end
@@ -182,13 +181,19 @@ module Ra10ke::Dependencies
182
181
  end
183
182
 
184
183
  def define_task_dependencies(*_args)
185
- desc "Print outdated forge modules"
184
+ desc 'Print outdated forge modules'
186
185
  task :dependencies do
187
186
  PuppetForge.user_agent = "ra10ke/#{Ra10ke::VERSION}"
188
187
  puppetfile = get_puppetfile
189
- PuppetForge.host = puppetfile.forge if puppetfile.forge =~ /^http/
188
+ PuppetForge.host = puppetfile.forge if /^http/.match?(puppetfile.forge)
190
189
  dependencies = Ra10ke::Dependencies::Verification.new(puppetfile)
191
190
  dependencies.print_table(dependencies.outdated)
191
+
192
+ if dependencies.outdated.any?
193
+ abort(BAD_EMOJI + ' Not all modules in the Puppetfile are up2date. '.red + BAD_EMOJI)
194
+ else
195
+ puts(GOOD_EMOJI + ' All modules in the Puppetfile are up2date. '.green + GOOD_EMOJI)
196
+ end
192
197
  end
193
198
  end
194
199
  end
@@ -5,7 +5,7 @@ require 'ra10ke/puppetfile_parser'
5
5
 
6
6
  module Ra10ke::Duplicates
7
7
  def define_task_duplicates(*_args)
8
- desc "Check Puppetfile for duplicates"
8
+ desc 'Check Puppetfile for duplicates'
9
9
  task :duplicates do
10
10
  duplicates = Ra10ke::Duplicates::Verification.new(get_puppetfile.puppetfile_path).duplicates
11
11
  exit_code = 0