modulesync 2.4.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +17 -0
- data/.github/workflows/ci.yml +17 -5
- data/.github/workflows/release.yml +6 -4
- data/.rubocop.yml +4 -3
- data/.rubocop_todo.yml +2 -10
- data/CHANGELOG.md +31 -0
- data/Rakefile +12 -1
- data/features/update/pull_request.feature +3 -6
- data/lib/modulesync/git_service/github.rb +2 -3
- data/lib/modulesync/git_service/gitlab.rb +2 -3
- data/lib/modulesync/hook.rb +4 -4
- data/lib/modulesync/renderer.rb +3 -8
- data/lib/modulesync/repository.rb +3 -0
- data/lib/modulesync.rb +11 -4
- data/modulesync.gemspec +3 -3
- metadata +10 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16c0c39c9e9c25f2f153464a9b0eaaa32d84d2d0586620e479676d4900503ae9
|
4
|
+
data.tar.gz: 328deb34bae7f84f47969b289b121a0f241dbde49756d881963f21dac0842595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42ca23a6203c31ceab58cb653070763e309606255107fec64239ce4808744073975dee48d8a397a3eb5cdc458882e29c126413aae6fc36eafd64024cb4441243
|
7
|
+
data.tar.gz: 33543edf6757f1988c5fca4a382a3b939a53647764bf0fc4291f6076c188749f72f5036438cc93b91999b7268c65400b34059b050ba0b6857eb89e9758de11ad
|
@@ -0,0 +1,17 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
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: "/"
|
14
|
+
schedule:
|
15
|
+
interval: daily
|
16
|
+
time: "13:00"
|
17
|
+
open-pull-requests-limit: 10
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
---
|
2
|
-
name: CI
|
2
|
+
name: ⚒️ CI
|
3
|
+
|
3
4
|
on:
|
4
|
-
|
5
|
-
|
5
|
+
pull_request: {}
|
6
|
+
push:
|
7
|
+
branches:
|
8
|
+
- master
|
6
9
|
|
7
10
|
env:
|
8
11
|
BUNDLE_WITHOUT: release
|
@@ -11,7 +14,7 @@ jobs:
|
|
11
14
|
rubocop:
|
12
15
|
runs-on: ubuntu-latest
|
13
16
|
steps:
|
14
|
-
- uses: actions/checkout@
|
17
|
+
- uses: actions/checkout@v3
|
15
18
|
- name: Setup ruby
|
16
19
|
uses: ruby/setup-ruby@v1
|
17
20
|
with:
|
@@ -32,10 +35,11 @@ jobs:
|
|
32
35
|
- ruby: "3.0"
|
33
36
|
- ruby: "3.1"
|
34
37
|
codecov: "yes"
|
38
|
+
- ruby: "3.2"
|
35
39
|
env:
|
36
40
|
CODECOV: ${{ matrix.codecov }}
|
37
41
|
steps:
|
38
|
-
- uses: actions/checkout@
|
42
|
+
- uses: actions/checkout@v3
|
39
43
|
- name: Install Ruby ${{ matrix.ruby }}
|
40
44
|
uses: ruby/setup-ruby@v1
|
41
45
|
with:
|
@@ -47,3 +51,11 @@ jobs:
|
|
47
51
|
run: bundle exec cucumber
|
48
52
|
- name: Build gem
|
49
53
|
run: gem build *.gemspec
|
54
|
+
tests:
|
55
|
+
needs:
|
56
|
+
- rubocop
|
57
|
+
- test
|
58
|
+
runs-on: ubuntu-latest
|
59
|
+
name: Test suite
|
60
|
+
steps:
|
61
|
+
- run: echo Test suite completed
|
@@ -8,13 +8,15 @@ on:
|
|
8
8
|
jobs:
|
9
9
|
release:
|
10
10
|
runs-on: ubuntu-latest
|
11
|
-
if: github.
|
11
|
+
if: github.repository_owner == 'voxpupuli'
|
12
12
|
steps:
|
13
|
-
- uses: actions/checkout@
|
14
|
-
- name: Install Ruby 3.
|
13
|
+
- uses: actions/checkout@v3
|
14
|
+
- name: Install Ruby 3.2
|
15
15
|
uses: ruby/setup-ruby@v1
|
16
16
|
with:
|
17
|
-
ruby-version: '3.
|
17
|
+
ruby-version: '3.2'
|
18
|
+
env:
|
19
|
+
BUNDLE_WITHOUT: release
|
18
20
|
- name: Build gem
|
19
21
|
run: gem build *.gemspec
|
20
22
|
- name: Publish gem to rubygems.org
|
data/.rubocop.yml
CHANGED
@@ -32,9 +32,6 @@ Style/TrailingCommaInArrayLiteral:
|
|
32
32
|
Style/TrailingCommaInHashLiteral:
|
33
33
|
EnforcedStyleForMultiline: comma
|
34
34
|
|
35
|
-
Layout/LineContinuationLeadingSpace:
|
36
|
-
Enabled: false
|
37
|
-
|
38
35
|
# sane line length
|
39
36
|
Layout/LineLength:
|
40
37
|
Max: 120
|
@@ -47,3 +44,7 @@ Style/FrozenStringLiteralComment:
|
|
47
44
|
# We explicitly prefer $stderr.puts over #warn
|
48
45
|
Style/StderrPuts:
|
49
46
|
Enabled: false
|
47
|
+
|
48
|
+
Gemspec/RequireMFA:
|
49
|
+
Exclude:
|
50
|
+
- 'modulesync.gemspec'
|
data/.rubocop_todo.yml
CHANGED
@@ -1,20 +1,12 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2023-04-14 18:50:10 UTC using RuboCop version 1.28.2.
|
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:
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: Include.
|
12
|
-
# Include: **/*.gemspec
|
13
|
-
Gemspec/RequireMFA:
|
14
|
-
Exclude:
|
15
|
-
- 'modulesync.gemspec'
|
16
|
-
|
17
|
-
# Offense count: 9
|
9
|
+
# Offense count: 10
|
18
10
|
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
19
11
|
Metrics/AbcSize:
|
20
12
|
Max: 60
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,37 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [2.6.0](https://github.com/voxpupuli/modulesync/tree/2.6.0) (2023-04-14)
|
6
|
+
|
7
|
+
[Full Changelog](https://github.com/voxpupuli/modulesync/compare/2.5.0...2.6.0)
|
8
|
+
|
9
|
+
**Implemented enhancements:**
|
10
|
+
|
11
|
+
- Add Ruby 3.2 support [\#266](https://github.com/voxpupuli/modulesync/pull/266) ([bastelfreak](https://github.com/bastelfreak))
|
12
|
+
- Update to latest RuboCop 1.28.2 [\#265](https://github.com/voxpupuli/modulesync/pull/265) ([bastelfreak](https://github.com/bastelfreak))
|
13
|
+
|
14
|
+
**Fixed bugs:**
|
15
|
+
|
16
|
+
- Fix compatibility with latest `ruby-git` [\#260](https://github.com/voxpupuli/modulesync/pull/260) ([alexjfisher](https://github.com/alexjfisher))
|
17
|
+
|
18
|
+
**Closed issues:**
|
19
|
+
|
20
|
+
- msync update --noop is broken with git 1.17.x [\#259](https://github.com/voxpupuli/modulesync/issues/259)
|
21
|
+
|
22
|
+
**Merged pull requests:**
|
23
|
+
|
24
|
+
- Add CI best practices [\#264](https://github.com/voxpupuli/modulesync/pull/264) ([bastelfreak](https://github.com/bastelfreak))
|
25
|
+
- Bump actions/checkout from 2 to 3 [\#262](https://github.com/voxpupuli/modulesync/pull/262) ([dependabot[bot]](https://github.com/apps/dependabot))
|
26
|
+
- dependabot: check for github actions and gems [\#261](https://github.com/voxpupuli/modulesync/pull/261) ([bastelfreak](https://github.com/bastelfreak))
|
27
|
+
|
28
|
+
## [2.5.0](https://github.com/voxpupuli/modulesync/tree/2.5.0) (2022-10-14)
|
29
|
+
|
30
|
+
[Full Changelog](https://github.com/voxpupuli/modulesync/compare/2.4.0...2.5.0)
|
31
|
+
|
32
|
+
**Implemented enhancements:**
|
33
|
+
|
34
|
+
- Copy file permissions from template to target [\#257](https://github.com/voxpupuli/modulesync/pull/257) ([ekohl](https://github.com/ekohl))
|
35
|
+
|
5
36
|
## [2.4.0](https://github.com/voxpupuli/modulesync/tree/2.4.0) (2022-09-27)
|
6
37
|
|
7
38
|
[Full Changelog](https://github.com/voxpupuli/modulesync/compare/2.3.1...2.4.0)
|
data/Rakefile
CHANGED
@@ -9,7 +9,18 @@ rescue LoadError
|
|
9
9
|
puts 'rspec not installed - skipping unit test task setup'
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
begin
|
13
|
+
require 'rubocop/rake_task'
|
14
|
+
rescue LoadError
|
15
|
+
# RuboCop is an optional group
|
16
|
+
else
|
17
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
18
|
+
# These make the rubocop experience maybe slightly less terrible
|
19
|
+
task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']
|
20
|
+
# Use Rubocop's Github Actions formatter if possible
|
21
|
+
task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
|
22
|
+
end
|
23
|
+
end
|
13
24
|
|
14
25
|
CLEAN.include('pkg/', 'tmp/')
|
15
26
|
|
@@ -32,9 +32,8 @@ Feature: Create a pull-request/merge-request after update
|
|
32
32
|
"""
|
33
33
|
---
|
34
34
|
puppet-test:
|
35
|
-
gitlab:
|
35
|
+
gitlab:
|
36
36
|
base_url: 'https://gitlab.example.com'
|
37
|
-
}
|
38
37
|
"""
|
39
38
|
And I set the environment variables to:
|
40
39
|
| variable | value |
|
@@ -60,9 +59,8 @@ Feature: Create a pull-request/merge-request after update
|
|
60
59
|
"""
|
61
60
|
---
|
62
61
|
puppet-test:
|
63
|
-
gitlab:
|
62
|
+
gitlab:
|
64
63
|
base_url: 'https://gitlab.example.com'
|
65
|
-
}
|
66
64
|
"""
|
67
65
|
And I set the environment variables to:
|
68
66
|
| variable | value |
|
@@ -77,9 +75,8 @@ Feature: Create a pull-request/merge-request after update
|
|
77
75
|
"""
|
78
76
|
---
|
79
77
|
puppet-test:
|
80
|
-
gitlab:
|
78
|
+
gitlab:
|
81
79
|
base_url: https://gitlab.example.com
|
82
|
-
}
|
83
80
|
"""
|
84
81
|
And a file named "config_defaults.yml" with:
|
85
82
|
"""
|
@@ -22,9 +22,8 @@ module ModuleSync
|
|
22
22
|
head = "#{namespace}:#{source_branch}"
|
23
23
|
|
24
24
|
if noop
|
25
|
-
$stdout.puts \
|
26
|
-
|
27
|
-
"- merges '#{source_branch}' into '#{target_branch}'"
|
25
|
+
$stdout.puts "Using no-op. Would submit PR '#{title}' to '#{repo_path}' " \
|
26
|
+
"- merges '#{source_branch}' into '#{target_branch}'"
|
28
27
|
return
|
29
28
|
end
|
30
29
|
|
@@ -28,9 +28,8 @@ module ModuleSync
|
|
28
28
|
|
29
29
|
def _open_pull_request(repo_path:, namespace:, title:, message:, source_branch:, target_branch:, labels:, noop:) # rubocop:disable Metrics/ParameterLists, Lint/UnusedMethodArgument
|
30
30
|
if noop
|
31
|
-
$stdout.puts \
|
32
|
-
|
33
|
-
"- merges #{source_branch} into #{target_branch}"
|
31
|
+
$stdout.puts "Using no-op. Would submit MR '#{title}' to '#{repo_path}' " \
|
32
|
+
"- merges #{source_branch} into #{target_branch}"
|
34
33
|
return
|
35
34
|
end
|
36
35
|
|
data/lib/modulesync/hook.rb
CHANGED
@@ -15,10 +15,10 @@ module ModuleSync
|
|
15
15
|
<<~CONTENT
|
16
16
|
#!/usr/bin/env bash
|
17
17
|
|
18
|
-
current_branch
|
19
|
-
git_dir
|
20
|
-
message
|
21
|
-
msync -m "
|
18
|
+
current_branch=`git symbolic-ref HEAD | sed -e 's,.*/(.*),\1,'`
|
19
|
+
git_dir=`git rev-parse --show-toplevel`
|
20
|
+
message=`git log -1 --format=%B`
|
21
|
+
msync -m "$message" #{arguments}
|
22
22
|
CONTENT
|
23
23
|
end
|
24
24
|
|
data/lib/modulesync/renderer.rb
CHANGED
@@ -10,13 +10,7 @@ module ModuleSync
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def self.build(
|
14
|
-
template_file = if !File.exist?("#{target_name}.erb") && File.exist?(target_name)
|
15
|
-
$stderr.puts "Warning: using '#{target_name}' as template without '.erb' suffix"
|
16
|
-
target_name
|
17
|
-
else
|
18
|
-
"#{target_name}.erb"
|
19
|
-
end
|
13
|
+
def self.build(template_file)
|
20
14
|
template = File.read(template_file)
|
21
15
|
erb_obj = if RUBY_VERSION >= '2.7'
|
22
16
|
ERB.new(template, trim_mode: '-')
|
@@ -36,9 +30,10 @@ module ModuleSync
|
|
36
30
|
ForgeModuleFile.new(configs, metadata).render
|
37
31
|
end
|
38
32
|
|
39
|
-
def self.sync(template, target_name)
|
33
|
+
def self.sync(template, target_name, mode = nil)
|
40
34
|
FileUtils.mkdir_p(File.dirname(target_name))
|
41
35
|
File.write(target_name, template)
|
36
|
+
File.chmod(mode, target_name) unless mode.nil?
|
42
37
|
end
|
43
38
|
end
|
44
39
|
end
|
@@ -31,6 +31,9 @@ module ModuleSync
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def default_branch
|
34
|
+
# `Git.default_branch` requires ruby-git >= 1.17.0
|
35
|
+
return Git.default_branch(repo.dir) if Git.respond_to? :default_branch
|
36
|
+
|
34
37
|
symbolic_ref = repo.branches.find { |b| b.full.include?('remotes/origin/HEAD') }
|
35
38
|
return unless symbolic_ref
|
36
39
|
|
data/lib/modulesync.rb
CHANGED
@@ -31,7 +31,13 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.local_file(config_path, file)
|
34
|
-
File.join(config_path, MODULE_FILES_DIR, file)
|
34
|
+
path = File.join(config_path, MODULE_FILES_DIR, file)
|
35
|
+
if !File.exist?("#{path}.erb") && File.exist?(path)
|
36
|
+
$stderr.puts "Warning: using '#{path}' as template without '.erb' suffix"
|
37
|
+
path
|
38
|
+
else
|
39
|
+
"#{path}.erb"
|
40
|
+
end
|
35
41
|
end
|
36
42
|
|
37
43
|
# List all template files.
|
@@ -88,9 +94,9 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
88
94
|
if configs['delete']
|
89
95
|
Renderer.remove(target_file)
|
90
96
|
else
|
91
|
-
|
97
|
+
template_file = local_file(options[:configs], filename)
|
92
98
|
begin
|
93
|
-
erb = Renderer.build(
|
99
|
+
erb = Renderer.build(template_file)
|
94
100
|
# Meta data passed to the template as @metadata[:name]
|
95
101
|
metadata = {
|
96
102
|
:module_name => settings.additional_settings[:puppet_module],
|
@@ -99,7 +105,8 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
99
105
|
:target_file => target_file,
|
100
106
|
}
|
101
107
|
template = Renderer.render(erb, configs, metadata)
|
102
|
-
|
108
|
+
mode = File.stat(template_file).mode
|
109
|
+
Renderer.sync(template, target_file, mode)
|
103
110
|
rescue StandardError
|
104
111
|
$stderr.puts "#{puppet_module.given_name}: Error while rendering file: '#{filename}'"
|
105
112
|
raise
|
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.6.0'
|
7
7
|
spec.authors = ['Vox Pupuli']
|
8
8
|
spec.email = ['voxpupuli@groups.io']
|
9
9
|
spec.summary = 'Puppet Module Synchronizer'
|
@@ -16,12 +16,12 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
|
-
spec.add_development_dependency 'aruba', '
|
19
|
+
spec.add_development_dependency 'aruba', '~>2.0'
|
20
20
|
spec.add_development_dependency 'bundler'
|
21
21
|
spec.add_development_dependency 'cucumber'
|
22
22
|
spec.add_development_dependency 'rake'
|
23
23
|
spec.add_development_dependency 'rspec'
|
24
|
-
spec.add_development_dependency 'rubocop', '~> 1.2'
|
24
|
+
spec.add_development_dependency 'rubocop', '~> 1.28.2'
|
25
25
|
spec.add_development_dependency 'rubocop-performance'
|
26
26
|
spec.add_development_dependency 'rubocop-rake'
|
27
27
|
spec.add_development_dependency 'rubocop-rspec'
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modulesync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.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:
|
11
|
+
date: 2023-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.14'
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: '2'
|
19
|
+
version: '2.0'
|
23
20
|
type: :development
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.14'
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: '2'
|
26
|
+
version: '2.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: bundler
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,14 +86,14 @@ dependencies:
|
|
92
86
|
requirements:
|
93
87
|
- - "~>"
|
94
88
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
89
|
+
version: 1.28.2
|
96
90
|
type: :development
|
97
91
|
prerelease: false
|
98
92
|
version_requirements: !ruby/object:Gem::Requirement
|
99
93
|
requirements:
|
100
94
|
- - "~>"
|
101
95
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
96
|
+
version: 1.28.2
|
103
97
|
- !ruby/object:Gem::Dependency
|
104
98
|
name: rubocop-performance
|
105
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,6 +235,7 @@ extensions: []
|
|
241
235
|
extra_rdoc_files: []
|
242
236
|
files:
|
243
237
|
- ".config/cucumber.yml"
|
238
|
+
- ".github/dependabot.yml"
|
244
239
|
- ".github/workflows/ci.yml"
|
245
240
|
- ".github/workflows/release.yml"
|
246
241
|
- ".gitignore"
|
@@ -315,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
310
|
- !ruby/object:Gem::Version
|
316
311
|
version: '0'
|
317
312
|
requirements: []
|
318
|
-
rubygems_version: 3.
|
313
|
+
rubygems_version: 3.4.10
|
319
314
|
signing_key:
|
320
315
|
specification_version: 4
|
321
316
|
summary: Puppet Module Synchronizer
|