modulesync 2.3.1 → 2.4.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: 592e73854b4792850a6696971ca1a28a441bd04c195f548933cc1ec01ba6b433
4
- data.tar.gz: 8eb8d8b165bc87a633fe90feea07e713bdcf4b6ccaf3fd6ba8cce5d57053c7b7
3
+ metadata.gz: 8aebcf942cd3e1d9ccef2339d17bd07e208ee279305ba0bb6e7ad0b615ff69af
4
+ data.tar.gz: d4a2d213c0ed6b96a3d7f616e3e5b4a26145e1d741246daea3e9b903df0ba380
5
5
  SHA512:
6
- metadata.gz: 9329c73bc685a734e5e1fe8387c4ad202a9468f502aed86cdbf32362d9e0079eb5385b2a1c3d0a155912f049945702a9e8eca6d465a79b5aa458dde735784a96
7
- data.tar.gz: 506630e05453bcb84783d326bbb81d69f4bfe653d1b80f6d5416814c9d3d1b6f2802e0c560e5c8f80a4377f82d1e0403bda1933ad658c3915590d125af1d51f0
6
+ metadata.gz: cd56a2ab522debc6a002dceb8b84f5296d970bbbc8e57f242e913f0f7e9ba6dbdc8ca16005937d2d45d79df4991baaec4122c288cbed0be39ae28502f90752a3
7
+ data.tar.gz: 4301a8ace72c549965bec4438cf152c15bf7c4b4c9cda6a8ad14d3da8d2ff774fed8354ce9a13cdf94630cc18955d43bfdb520da3173501dc8e7aecdcfd36b9c
data/.rubocop.yml CHANGED
@@ -1,5 +1,10 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rake
6
+ - rubocop-rspec
7
+
3
8
  AllCops:
4
9
  TargetRubyVersion: 2.5
5
10
  NewCops: enable
@@ -27,6 +32,9 @@ Style/TrailingCommaInArrayLiteral:
27
32
  Style/TrailingCommaInHashLiteral:
28
33
  EnforcedStyleForMultiline: comma
29
34
 
35
+ Layout/LineContinuationLeadingSpace:
36
+ Enabled: false
37
+
30
38
  # sane line length
31
39
  Layout/LineLength:
32
40
  Max: 120
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.4.0](https://github.com/voxpupuli/modulesync/tree/2.4.0) (2022-09-27)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/modulesync/compare/2.3.1...2.4.0)
8
+
9
+ **Implemented enhancements:**
10
+
11
+ - Expose namespace in metadata [\#254](https://github.com/voxpupuli/modulesync/pull/254) ([ekohl](https://github.com/ekohl))
12
+
13
+ **Merged pull requests:**
14
+
15
+ - Fix Rubocop and add additional rubocop plugins [\#255](https://github.com/voxpupuli/modulesync/pull/255) ([ekohl](https://github.com/ekohl))
16
+
5
17
  ## [2.3.1](https://github.com/voxpupuli/modulesync/tree/2.3.1) (2022-05-05)
6
18
 
7
19
  [Full Changelog](https://github.com/voxpupuli/modulesync/compare/2.3.0...2.3.1)
@@ -717,6 +717,7 @@ Feature: update
717
717
  And a file named "moduleroot/test.erb" with:
718
718
  """
719
719
  module: <%= @metadata[:module_name] %>
720
+ namespace: <%= @metadata[:namespace] %>
720
721
  target: <%= @metadata[:target_file] %>
721
722
  workdir: <%= @metadata[:workdir] %>
722
723
  """
@@ -724,6 +725,7 @@ Feature: update
724
725
  Then the file named "modules/fakenamespace/puppet-test/test" should contain:
725
726
  """
726
727
  module: puppet-test
728
+ namespace: fakenamespace
727
729
  target: modules/fakenamespace/puppet-test/test
728
730
  workdir: modules/fakenamespace/puppet-test
729
731
  """
@@ -41,7 +41,7 @@ module ModuleSync
41
41
  # - file:///path/to/repo.git/
42
42
  # - any invalid URL
43
43
  def self.extract_hostname(url)
44
- return nil if url.start_with?('/') || url.start_with?('file://') # local path (e.g. file:///path/to/repo)
44
+ return nil if url.start_with?('/', 'file://') # local path (e.g. file:///path/to/repo)
45
45
 
46
46
  unless url.start_with?(%r{[a-z]+://}) # SSH notation does not contain protocol (e.g. user@server:path/to/repo/)
47
47
  pattern = /^(?<user>.*@)?(?<hostname>[\w|.]*):(?<repo>.*)$/ # SSH path (e.g. user@server:repo)
@@ -32,7 +32,7 @@ module ModuleSync
32
32
  end
33
33
 
34
34
  def deactivate
35
- File.delete(hook_file) if File.exist?(hook_file)
35
+ FileUtils.rm_f(hook_file)
36
36
  end
37
37
  end
38
38
  end
@@ -29,7 +29,7 @@ module ModuleSync
29
29
  end
30
30
 
31
31
  def self.remove(file)
32
- File.delete(file) if File.exist?(file)
32
+ FileUtils.rm_f(file)
33
33
  end
34
34
 
35
35
  def self.render(_template, configs = {}, metadata = {})
@@ -31,7 +31,7 @@ module ModuleSync
31
31
  end
32
32
 
33
33
  def default_branch
34
- symbolic_ref = repo.branches.find { |b| b.full =~ %r{remotes/origin/HEAD} }
34
+ symbolic_ref = repo.branches.find { |b| b.full.include?('remotes/origin/HEAD') }
35
35
  return unless symbolic_ref
36
36
 
37
37
  %r{remotes/origin/HEAD\s+->\s+origin/(?<branch>.+?)$}.match(symbolic_ref.full)[:branch]
data/lib/modulesync.rb CHANGED
@@ -83,7 +83,6 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
83
83
  end
84
84
 
85
85
  def self.manage_file(puppet_module, filename, settings, options)
86
- module_name = settings.additional_settings[:puppet_module]
87
86
  configs = settings.build_file_configs(filename)
88
87
  target_file = puppet_module.path(filename)
89
88
  if configs['delete']
@@ -94,7 +93,8 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
94
93
  erb = Renderer.build(templatename)
95
94
  # Meta data passed to the template as @metadata[:name]
96
95
  metadata = {
97
- :module_name => module_name,
96
+ :module_name => settings.additional_settings[:puppet_module],
97
+ :namespace => settings.additional_settings[:namespace],
98
98
  :workdir => puppet_module.working_directory,
99
99
  :target_file => target_file,
100
100
  }
@@ -214,9 +214,7 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
214
214
  message = "Command execution failed ('#{@options[:command_args].join ' '}': #{$CHILD_STATUS})"
215
215
  raise Thor::Error, message if @options[:fail_fast]
216
216
 
217
- errors.merge!(
218
- puppet_module.given_name => message,
219
- )
217
+ errors[puppet_module.given_name] = message
220
218
  $stderr.puts message
221
219
  end
222
220
 
data/modulesync.gemspec CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'modulesync'
6
- spec.version = '2.3.1'
6
+ spec.version = '2.4.0'
7
7
  spec.authors = ['Vox Pupuli']
8
8
  spec.email = ['voxpupuli@groups.io']
9
9
  spec.summary = 'Puppet Module Synchronizer'
@@ -14,7 +14,6 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.files = `git ls-files -z`.split("\x0")
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
17
  spec.require_paths = ['lib']
19
18
 
20
19
  spec.add_development_dependency 'aruba', '>= 0.14', '< 2'
@@ -23,6 +22,7 @@ Gem::Specification.new do |spec|
23
22
  spec.add_development_dependency 'rake'
24
23
  spec.add_development_dependency 'rspec'
25
24
  spec.add_development_dependency 'rubocop', '~> 1.2'
25
+ spec.add_development_dependency 'rubocop-performance'
26
26
  spec.add_development_dependency 'rubocop-rake'
27
27
  spec.add_development_dependency 'rubocop-rspec'
28
28
  spec.add_development_dependency 'simplecov'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulesync
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-05 00:00:00.000000000 Z
11
+ date: 2022-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba
@@ -100,6 +100,20 @@ dependencies:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '1.2'
103
+ - !ruby/object:Gem::Dependency
104
+ name: rubocop-performance
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
103
117
  - !ruby/object:Gem::Dependency
104
118
  name: rubocop-rake
105
119
  requirement: !ruby/object:Gem::Requirement
@@ -305,26 +319,4 @@ rubygems_version: 3.3.7
305
319
  signing_key:
306
320
  specification_version: 4
307
321
  summary: Puppet Module Synchronizer
308
- test_files:
309
- - features/cli.feature
310
- - features/execute.feature
311
- - features/hook.feature
312
- - features/push.feature
313
- - features/reset.feature
314
- - features/step_definitions/git_steps.rb
315
- - features/support/env.rb
316
- - features/update.feature
317
- - features/update/bad_context.feature
318
- - features/update/bump_version.feature
319
- - features/update/dot_sync.feature
320
- - features/update/pull_request.feature
321
- - spec/helpers/faker.rb
322
- - spec/helpers/faker/puppet_module_remote_repo.rb
323
- - spec/spec_helper.rb
324
- - spec/unit/modulesync/git_service/factory_spec.rb
325
- - spec/unit/modulesync/git_service/github_spec.rb
326
- - spec/unit/modulesync/git_service/gitlab_spec.rb
327
- - spec/unit/modulesync/git_service_spec.rb
328
- - spec/unit/modulesync/settings_spec.rb
329
- - spec/unit/modulesync/source_code_spec.rb
330
- - spec/unit/modulesync_spec.rb
322
+ test_files: []