modulesync 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -0
- data/CHANGELOG.md +20 -0
- data/features/update.feature +2 -0
- data/lib/modulesync/git_service/base.rb +1 -1
- data/lib/modulesync/hook.rb +1 -1
- data/lib/modulesync/renderer.rb +7 -2
- data/lib/modulesync/repository.rb +1 -1
- data/lib/modulesync.rb +3 -5
- data/modulesync.gemspec +2 -2
- metadata +17 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aebcf942cd3e1d9ccef2339d17bd07e208ee279305ba0bb6e7ad0b615ff69af
|
4
|
+
data.tar.gz: d4a2d213c0ed6b96a3d7f616e3e5b4a26145e1d741246daea3e9b903df0ba380
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -12,6 +17,9 @@ AllCops:
|
|
12
17
|
- 'Gemfile'
|
13
18
|
- 'Rakefile'
|
14
19
|
|
20
|
+
Style/FetchEnvVar:
|
21
|
+
Enabled: false
|
22
|
+
|
15
23
|
Style/HashSyntax:
|
16
24
|
Enabled: false
|
17
25
|
|
@@ -24,6 +32,9 @@ Style/TrailingCommaInArrayLiteral:
|
|
24
32
|
Style/TrailingCommaInHashLiteral:
|
25
33
|
EnforcedStyleForMultiline: comma
|
26
34
|
|
35
|
+
Layout/LineContinuationLeadingSpace:
|
36
|
+
Enabled: false
|
37
|
+
|
27
38
|
# sane line length
|
28
39
|
Layout/LineLength:
|
29
40
|
Max: 120
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,26 @@
|
|
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
|
+
|
17
|
+
## [2.3.1](https://github.com/voxpupuli/modulesync/tree/2.3.1) (2022-05-05)
|
18
|
+
|
19
|
+
[Full Changelog](https://github.com/voxpupuli/modulesync/compare/2.3.0...2.3.1)
|
20
|
+
|
21
|
+
**Fixed bugs:**
|
22
|
+
|
23
|
+
- Handle Ruby 3.1 ERB trim\_mode deprecation [\#252](https://github.com/voxpupuli/modulesync/pull/252) ([ekohl](https://github.com/ekohl))
|
24
|
+
|
5
25
|
## [2.3.0](https://github.com/voxpupuli/modulesync/tree/2.3.0) (2022-03-07)
|
6
26
|
|
7
27
|
[Full Changelog](https://github.com/voxpupuli/modulesync/compare/2.2.0...2.3.0)
|
data/features/update.feature
CHANGED
@@ -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?('/'
|
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)
|
data/lib/modulesync/hook.rb
CHANGED
data/lib/modulesync/renderer.rb
CHANGED
@@ -17,14 +17,19 @@ module ModuleSync
|
|
17
17
|
else
|
18
18
|
"#{target_name}.erb"
|
19
19
|
end
|
20
|
-
|
20
|
+
template = File.read(template_file)
|
21
|
+
erb_obj = if RUBY_VERSION >= '2.7'
|
22
|
+
ERB.new(template, trim_mode: '-')
|
23
|
+
else
|
24
|
+
ERB.new(template, nil, '-')
|
25
|
+
end
|
21
26
|
erb_obj.filename = template_file
|
22
27
|
erb_obj.def_method(ForgeModuleFile, 'render()', template_file)
|
23
28
|
erb_obj
|
24
29
|
end
|
25
30
|
|
26
31
|
def self.remove(file)
|
27
|
-
|
32
|
+
FileUtils.rm_f(file)
|
28
33
|
end
|
29
34
|
|
30
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
|
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 =>
|
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.
|
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.
|
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.
|
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-
|
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: []
|