modulesync 2.5.0 → 2.7.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 +19 -9
- data/.github/workflows/release.yml +7 -5
- data/.rubocop.yml +3 -47
- data/.rubocop_todo.yml +121 -24
- data/CHANGELOG.md +36 -0
- data/Gemfile +6 -5
- data/Rakefile +8 -4
- data/features/update/pull_request.feature +3 -6
- data/lib/modulesync/cli.rb +107 -107
- data/lib/modulesync/git_service/base.rb +2 -2
- data/lib/modulesync/git_service/github.rb +7 -8
- data/lib/modulesync/git_service/gitlab.rb +11 -12
- data/lib/modulesync/hook.rb +4 -4
- data/lib/modulesync/renderer.rb +1 -1
- data/lib/modulesync/repository.rb +5 -2
- data/lib/modulesync.rb +21 -21
- data/modulesync.gemspec +6 -10
- data/spec/helpers/faker/puppet_module_remote_repo.rb +4 -4
- data/spec/helpers/faker.rb +1 -0
- data/spec/unit/modulesync/git_service/factory_spec.rb +8 -2
- data/spec/unit/modulesync/git_service/github_spec.rb +23 -25
- data/spec/unit/modulesync/git_service/gitlab_spec.rb +26 -29
- data/spec/unit/modulesync/git_service_spec.rb +48 -47
- data/spec/unit/modulesync/settings_spec.rb +1 -1
- data/spec/unit/modulesync/source_code_spec.rb +5 -7
- metadata +27 -82
data/lib/modulesync/cli.rb
CHANGED
@@ -21,12 +21,12 @@ module ModuleSync
|
|
21
21
|
|
22
22
|
class Hook < Thor
|
23
23
|
option :hook_args,
|
24
|
-
:
|
25
|
-
:
|
24
|
+
aliases: '-a',
|
25
|
+
desc: 'Arguments to pass to msync in the git hook'
|
26
26
|
option :branch,
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
27
|
+
aliases: '-b',
|
28
|
+
desc: 'Branch name to pass to msync in the git hook',
|
29
|
+
default: CLI.defaults[:branch]
|
30
30
|
desc 'activate', 'Activate the git hook.'
|
31
31
|
def activate
|
32
32
|
ModuleSync.hook CLI.prepare_options(options, hook: 'activate')
|
@@ -40,106 +40,106 @@ module ModuleSync
|
|
40
40
|
|
41
41
|
class Base < Thor
|
42
42
|
class_option :project_root,
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
43
|
+
aliases: '-c',
|
44
|
+
desc: 'Path used by git to clone modules into.',
|
45
|
+
default: CLI.defaults[:project_root]
|
46
46
|
class_option :git_base,
|
47
|
-
:
|
48
|
-
:
|
47
|
+
desc: 'Specify the base part of a git URL to pull from',
|
48
|
+
default: CLI.defaults[:git_base] || 'git@github.com:'
|
49
49
|
class_option :namespace,
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
50
|
+
aliases: '-n',
|
51
|
+
desc: 'Remote github namespace (user or organization) to clone from and push to.',
|
52
|
+
default: CLI.defaults[:namespace] || 'puppetlabs'
|
53
53
|
class_option :filter,
|
54
|
-
:
|
55
|
-
:
|
54
|
+
aliases: '-f',
|
55
|
+
desc: 'A regular expression to select repositories to update.'
|
56
56
|
class_option :negative_filter,
|
57
|
-
:
|
58
|
-
:
|
57
|
+
aliases: '-x',
|
58
|
+
desc: 'A regular expression to skip repositories.'
|
59
59
|
class_option :verbose,
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
60
|
+
aliases: '-v',
|
61
|
+
desc: 'Verbose mode',
|
62
|
+
type: :boolean,
|
63
|
+
default: false
|
64
64
|
|
65
65
|
desc 'update', 'Update the modules in managed_modules.yml'
|
66
66
|
option :message,
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
67
|
+
aliases: '-m',
|
68
|
+
desc: 'Commit message to apply to updated modules. Required unless running in noop mode.',
|
69
|
+
default: CLI.defaults[:message]
|
70
70
|
option :configs,
|
71
|
-
:
|
72
|
-
:
|
73
|
-
|
71
|
+
aliases: '-c',
|
72
|
+
desc: 'The local directory or remote repository to define the list of managed modules, ' \
|
73
|
+
'the file templates, and the default values for template variables.'
|
74
74
|
option :managed_modules_conf,
|
75
|
-
:
|
75
|
+
desc: 'The file name to define the list of managed modules'
|
76
76
|
option :remote_branch,
|
77
|
-
:
|
78
|
-
:
|
79
|
-
:
|
77
|
+
aliases: '-r',
|
78
|
+
desc: 'Remote branch name to push the changes to. Defaults to the branch name.',
|
79
|
+
default: CLI.defaults[:remote_branch]
|
80
80
|
option :skip_broken,
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
81
|
+
type: :boolean,
|
82
|
+
aliases: '-s',
|
83
|
+
desc: 'Process remaining modules if an error is found',
|
84
|
+
default: false
|
85
85
|
option :amend,
|
86
|
-
:
|
87
|
-
:
|
88
|
-
:
|
86
|
+
type: :boolean,
|
87
|
+
desc: 'Amend previous commit',
|
88
|
+
default: false
|
89
89
|
option :force,
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
90
|
+
type: :boolean,
|
91
|
+
desc: 'Force push amended commit',
|
92
|
+
default: false
|
93
93
|
option :noop,
|
94
|
-
:
|
95
|
-
:
|
96
|
-
:
|
94
|
+
type: :boolean,
|
95
|
+
desc: 'No-op mode',
|
96
|
+
default: false
|
97
97
|
option :pr,
|
98
|
-
:
|
99
|
-
:
|
100
|
-
:
|
98
|
+
type: :boolean,
|
99
|
+
desc: 'Submit pull/merge request',
|
100
|
+
default: false
|
101
101
|
option :pr_title,
|
102
|
-
:
|
103
|
-
:
|
102
|
+
desc: 'Title of pull/merge request',
|
103
|
+
default: CLI.defaults[:pr_title] || 'Update to module template files'
|
104
104
|
option :pr_labels,
|
105
|
-
:
|
106
|
-
:
|
107
|
-
:
|
105
|
+
type: :array,
|
106
|
+
desc: 'Labels to add to the pull/merge request',
|
107
|
+
default: CLI.defaults[:pr_labels] || []
|
108
108
|
option :pr_target_branch,
|
109
|
-
:
|
110
|
-
:
|
109
|
+
desc: 'Target branch for the pull/merge request',
|
110
|
+
default: CLI.defaults[:pr_target_branch]
|
111
111
|
option :offline,
|
112
|
-
:
|
113
|
-
:
|
114
|
-
:
|
112
|
+
type: :boolean,
|
113
|
+
desc: 'Do not run any Git commands. Allows the user to manage Git outside of ModuleSync.',
|
114
|
+
default: false
|
115
115
|
option :bump,
|
116
|
-
:
|
117
|
-
:
|
118
|
-
:
|
116
|
+
type: :boolean,
|
117
|
+
desc: 'Bump module version to the next minor',
|
118
|
+
default: false
|
119
119
|
option :changelog,
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
120
|
+
type: :boolean,
|
121
|
+
desc: 'Update CHANGELOG.md if version was bumped',
|
122
|
+
default: false
|
123
123
|
option :tag,
|
124
|
-
:
|
125
|
-
:
|
126
|
-
:
|
124
|
+
type: :boolean,
|
125
|
+
desc: 'Git tag with the current module version',
|
126
|
+
default: false
|
127
127
|
option :tag_pattern,
|
128
|
-
:
|
128
|
+
desc: 'The pattern to use when tagging releases.'
|
129
129
|
option :pre_commit_script,
|
130
|
-
:
|
131
|
-
:
|
130
|
+
desc: 'A script to be run before committing',
|
131
|
+
default: CLI.defaults[:pre_commit_script]
|
132
132
|
option :fail_on_warnings,
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
|
137
|
-
:
|
133
|
+
type: :boolean,
|
134
|
+
aliases: '-F',
|
135
|
+
desc: 'Produce a failure exit code when there are warnings ' \
|
136
|
+
'(only has effect when --skip_broken is enabled)',
|
137
|
+
default: false
|
138
138
|
option :branch,
|
139
|
-
:
|
140
|
-
:
|
141
|
-
|
142
|
-
:
|
139
|
+
aliases: '-b',
|
140
|
+
desc: 'Branch name to make the changes in. ' \
|
141
|
+
'Defaults to the default branch of the upstream repository, but falls back to "master".',
|
142
|
+
default: CLI.defaults[:branch]
|
143
143
|
def update
|
144
144
|
config = CLI.prepare_options(options)
|
145
145
|
raise Thor::Error, 'No value provided for required option "--message"' unless config[:noop] \
|
@@ -164,19 +164,19 @@ module ModuleSync
|
|
164
164
|
DESC
|
165
165
|
|
166
166
|
option :configs,
|
167
|
-
:
|
168
|
-
:
|
169
|
-
|
167
|
+
aliases: '-c',
|
168
|
+
desc: 'The local directory or remote repository to define the list of managed modules, ' \
|
169
|
+
'the file templates, and the default values for template variables.'
|
170
170
|
option :managed_modules_conf,
|
171
|
-
:
|
171
|
+
desc: 'The file name to define the list of managed modules'
|
172
172
|
option :branch,
|
173
|
-
:
|
174
|
-
:
|
175
|
-
:
|
173
|
+
aliases: '-b',
|
174
|
+
desc: 'Branch name to make the changes in.',
|
175
|
+
default: CLI.defaults[:branch]
|
176
176
|
option :fail_fast,
|
177
|
-
:
|
178
|
-
:
|
179
|
-
:
|
177
|
+
type: :boolean,
|
178
|
+
desc: 'Abort the run after a command execution failure',
|
179
|
+
default: CLI.defaults[:fail_fast].nil? ? true : CLI.defaults[:fail_fast]
|
180
180
|
def execute(*command_args)
|
181
181
|
raise Thor::Error, 'COMMAND is a required argument' if command_args.empty?
|
182
182
|
|
@@ -196,38 +196,38 @@ module ModuleSync
|
|
196
196
|
\x5 * Switch to specified branch
|
197
197
|
DESC
|
198
198
|
option :configs,
|
199
|
-
:
|
200
|
-
:
|
201
|
-
|
199
|
+
aliases: '-c',
|
200
|
+
desc: 'The local directory or remote repository to define the list of managed modules, ' \
|
201
|
+
'the file templates, and the default values for template variables.'
|
202
202
|
option :managed_modules_conf,
|
203
|
-
:
|
203
|
+
desc: 'The file name to define the list of managed modules'
|
204
204
|
option :branch,
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
205
|
+
aliases: '-b',
|
206
|
+
desc: 'Branch name to make the changes in.',
|
207
|
+
default: CLI.defaults[:branch]
|
208
208
|
option :offline,
|
209
|
-
:
|
210
|
-
:
|
211
|
-
:
|
209
|
+
type: :boolean,
|
210
|
+
desc: 'Only proceed local operations',
|
211
|
+
default: false
|
212
212
|
option :source_branch,
|
213
|
-
:
|
213
|
+
desc: 'Branch to reset from (e.g. origin/wip)'
|
214
214
|
def reset
|
215
215
|
ModuleSync.reset CLI.prepare_options(options)
|
216
216
|
end
|
217
217
|
|
218
218
|
desc 'push', 'Push all available commits from branch to remote'
|
219
219
|
option :configs,
|
220
|
-
:
|
221
|
-
:
|
222
|
-
|
220
|
+
aliases: '-c',
|
221
|
+
desc: 'The local directory or remote repository to define the list of managed modules, ' \
|
222
|
+
'the file templates, and the default values for template variables.'
|
223
223
|
option :managed_modules_conf,
|
224
|
-
:
|
224
|
+
desc: 'The file name to define the list of managed modules'
|
225
225
|
option :branch,
|
226
|
-
:
|
227
|
-
:
|
228
|
-
:
|
226
|
+
aliases: '-b',
|
227
|
+
desc: 'Branch name to push',
|
228
|
+
default: CLI.defaults[:branch]
|
229
229
|
option :remote_branch,
|
230
|
-
:
|
230
|
+
desc: 'Remote branch to push to (e.g. maintenance)'
|
231
231
|
def push
|
232
232
|
ModuleSync.push CLI.prepare_options(options)
|
233
233
|
end
|
@@ -2,7 +2,7 @@ module ModuleSync
|
|
2
2
|
module GitService
|
3
3
|
# Generic class for git services
|
4
4
|
class Base
|
5
|
-
def open_pull_request(repo_path:, namespace:, title:, message:, source_branch:, target_branch:, labels:, noop:)
|
5
|
+
def open_pull_request(repo_path:, namespace:, title:, message:, source_branch:, target_branch:, labels:, noop:)
|
6
6
|
unless source_branch != target_branch
|
7
7
|
raise ModuleSync::Error,
|
8
8
|
"Unable to open a pull request with the same source and target branch: '#{source_branch}'"
|
@@ -55,7 +55,7 @@ module ModuleSync
|
|
55
55
|
|
56
56
|
protected
|
57
57
|
|
58
|
-
def _open_pull_request(repo_path:, namespace:, title:, message:, source_branch:, target_branch:, labels:, noop:)
|
58
|
+
def _open_pull_request(repo_path:, namespace:, title:, message:, source_branch:, target_branch:, labels:, noop:)
|
59
59
|
raise NotImplementedError
|
60
60
|
end
|
61
61
|
end
|
@@ -13,25 +13,24 @@ module ModuleSync
|
|
13
13
|
Octokit.configure do |c|
|
14
14
|
c.api_endpoint = endpoint
|
15
15
|
end
|
16
|
-
@api = Octokit::Client.new(:
|
16
|
+
@api = Octokit::Client.new(access_token: token)
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
20
20
|
|
21
|
-
def _open_pull_request(repo_path:, namespace:, title:, message:, source_branch:, target_branch:, labels:, noop:)
|
21
|
+
def _open_pull_request(repo_path:, namespace:, title:, message:, source_branch:, target_branch:, labels:, noop:)
|
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
|
|
31
30
|
pull_requests = @api.pull_requests(repo_path,
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
31
|
+
state: 'open',
|
32
|
+
base: target_branch,
|
33
|
+
head: head)
|
35
34
|
unless pull_requests.empty?
|
36
35
|
# Skip creating the PR if it exists already.
|
37
36
|
$stdout.puts "Skipped! #{pull_requests.length} PRs found for branch '#{source_branch}'"
|
@@ -11,8 +11,8 @@ module ModuleSync
|
|
11
11
|
super()
|
12
12
|
|
13
13
|
@api = Gitlab::Client.new(
|
14
|
-
:
|
15
|
-
:
|
14
|
+
endpoint: endpoint,
|
15
|
+
private_token: token,
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
@@ -26,18 +26,17 @@ module ModuleSync
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
def _open_pull_request(repo_path:, namespace:, title:, message:, source_branch:, target_branch:, labels:, noop:) # rubocop:disable
|
29
|
+
def _open_pull_request(repo_path:, namespace:, title:, message:, source_branch:, target_branch:, labels:, noop:) # rubocop:disable 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
|
|
37
36
|
merge_requests = @api.merge_requests(repo_path,
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
37
|
+
state: 'opened',
|
38
|
+
source_branch: source_branch,
|
39
|
+
target_branch: target_branch)
|
41
40
|
unless merge_requests.empty?
|
42
41
|
# Skip creating the MR if it exists already.
|
43
42
|
$stdout.puts "Skipped! #{merge_requests.length} MRs found for branch '#{source_branch}'"
|
@@ -46,9 +45,9 @@ module ModuleSync
|
|
46
45
|
|
47
46
|
mr = @api.create_merge_request(repo_path,
|
48
47
|
title,
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
48
|
+
source_branch: source_branch,
|
49
|
+
target_branch: target_branch,
|
50
|
+
labels: labels)
|
52
51
|
$stdout.puts \
|
53
52
|
"Submitted MR '#{title}' to '#{repo_path}' " \
|
54
53
|
"- merges '#{source_branch}' into '#{target_branch}'"
|
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
@@ -15,7 +15,7 @@ module ModuleSync
|
|
15
15
|
erb_obj = if RUBY_VERSION >= '2.7'
|
16
16
|
ERB.new(template, trim_mode: '-')
|
17
17
|
else
|
18
|
-
ERB.new(template,
|
18
|
+
ERB.new(template, trim_mode: '-')
|
19
19
|
end
|
20
20
|
erb_obj.filename = template_file
|
21
21
|
erb_obj.def_method(ForgeModuleFile, 'render()', template_file)
|
@@ -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
|
|
@@ -137,8 +140,8 @@ module ModuleSync
|
|
137
140
|
begin
|
138
141
|
opts_commit = {}
|
139
142
|
opts_push = {}
|
140
|
-
opts_commit = { :
|
141
|
-
opts_push = { :
|
143
|
+
opts_commit = { amend: true } if options[:amend]
|
144
|
+
opts_push = { force: true } if options[:force]
|
142
145
|
if options[:pre_commit_script]
|
143
146
|
script = "#{File.dirname(File.dirname(__FILE__))}/../contrib/#{options[:pre_commit_script]}"
|
144
147
|
`#{script} #{@directory}`
|
data/lib/modulesync.rb
CHANGED
@@ -12,17 +12,17 @@ require 'modulesync/util'
|
|
12
12
|
|
13
13
|
require 'monkey_patches'
|
14
14
|
|
15
|
-
module ModuleSync
|
15
|
+
module ModuleSync
|
16
16
|
class Error < StandardError; end
|
17
17
|
|
18
18
|
include Constants
|
19
19
|
|
20
20
|
def self.config_defaults
|
21
21
|
{
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
22
|
+
project_root: 'modules/',
|
23
|
+
managed_modules_conf: 'managed_modules.yml',
|
24
|
+
configs: '.',
|
25
|
+
tag_pattern: '%s',
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
@@ -33,7 +33,7 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
33
33
|
def self.local_file(config_path, file)
|
34
34
|
path = File.join(config_path, MODULE_FILES_DIR, file)
|
35
35
|
if !File.exist?("#{path}.erb") && File.exist?(path)
|
36
|
-
|
36
|
+
warn "Warning: using '#{path}' as template without '.erb' suffix"
|
37
37
|
path
|
38
38
|
else
|
39
39
|
"#{path}.erb"
|
@@ -50,9 +50,9 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
50
50
|
.collect { |p| p.chomp('.erb') }
|
51
51
|
.to_a
|
52
52
|
else
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
warn "#{local_template_dir} does not exist. " \
|
54
|
+
'Check that you are working in your module configs directory or ' \
|
55
|
+
'that you have passed in the correct directory with -c.'
|
56
56
|
exit 1
|
57
57
|
end
|
58
58
|
end
|
@@ -68,8 +68,8 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
68
68
|
|
69
69
|
managed_modules = Util.parse_config(config_file)
|
70
70
|
if managed_modules.empty?
|
71
|
-
|
72
|
-
|
71
|
+
warn "No modules found in #{config_file}. " \
|
72
|
+
'Check that you specified the right :configs directory and :managed_modules_conf file.'
|
73
73
|
exit 1
|
74
74
|
end
|
75
75
|
managed_modules.select! { |m| m =~ Regexp.new(filter) } unless filter.nil?
|
@@ -99,16 +99,16 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
99
99
|
erb = Renderer.build(template_file)
|
100
100
|
# Meta data passed to the template as @metadata[:name]
|
101
101
|
metadata = {
|
102
|
-
:
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
102
|
+
module_name: settings.additional_settings[:puppet_module],
|
103
|
+
namespace: settings.additional_settings[:namespace],
|
104
|
+
workdir: puppet_module.working_directory,
|
105
|
+
target_file: target_file,
|
106
106
|
}
|
107
107
|
template = Renderer.render(erb, configs, metadata)
|
108
108
|
mode = File.stat(template_file).mode
|
109
109
|
Renderer.sync(template, target_file, mode)
|
110
110
|
rescue StandardError
|
111
|
-
|
111
|
+
warn "#{puppet_module.given_name}: Error while rendering file: '#{filename}'"
|
112
112
|
raise
|
113
113
|
end
|
114
114
|
end
|
@@ -128,9 +128,9 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
128
128
|
defaults,
|
129
129
|
module_configs[GLOBAL_DEFAULTS_KEY] || {},
|
130
130
|
module_configs,
|
131
|
-
:
|
132
|
-
:
|
133
|
-
:
|
131
|
+
puppet_module: puppet_module.repository_name,
|
132
|
+
git_base: options[:git_base],
|
133
|
+
namespace: puppet_module.repository_namespace)
|
134
134
|
|
135
135
|
settings.unmanaged_files(module_files).each do |filename|
|
136
136
|
$stdout.puts "Not managing '#{filename}' in '#{puppet_module.given_name}'"
|
@@ -178,7 +178,7 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
178
178
|
manage_module(puppet_module, module_files, defaults)
|
179
179
|
rescue ModuleSync::Error, Git::GitExecuteError => e
|
180
180
|
message = e.message || 'Error during `update`'
|
181
|
-
|
181
|
+
warn "#{puppet_module.given_name}: #{message}"
|
182
182
|
exit 1 unless options[:skip_broken]
|
183
183
|
errors = true
|
184
184
|
$stdout.puts "Skipping '#{puppet_module.given_name}' as update process failed"
|
@@ -222,7 +222,7 @@ module ModuleSync # rubocop:disable Metrics/ModuleLength
|
|
222
222
|
raise Thor::Error, message if @options[:fail_fast]
|
223
223
|
|
224
224
|
errors[puppet_module.given_name] = message
|
225
|
-
|
225
|
+
warn message
|
226
226
|
end
|
227
227
|
|
228
228
|
$stdout.puts ''
|
data/modulesync.gemspec
CHANGED
@@ -3,33 +3,29 @@ $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.7.0'
|
7
7
|
spec.authors = ['Vox Pupuli']
|
8
8
|
spec.email = ['voxpupuli@groups.io']
|
9
9
|
spec.summary = 'Puppet Module Synchronizer'
|
10
10
|
spec.description = 'Utility to synchronize common files across puppet modules in Github.'
|
11
11
|
spec.homepage = 'https://github.com/voxpupuli/modulesync'
|
12
12
|
spec.license = 'Apache-2.0'
|
13
|
-
spec.required_ruby_version = '>= 2.
|
13
|
+
spec.required_ruby_version = '>= 2.7.0'
|
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
17
|
spec.require_paths = ['lib']
|
18
18
|
|
19
|
-
spec.add_development_dependency 'aruba', '
|
20
|
-
spec.add_development_dependency 'bundler'
|
19
|
+
spec.add_development_dependency 'aruba', '~>2.0'
|
21
20
|
spec.add_development_dependency 'cucumber'
|
22
21
|
spec.add_development_dependency 'rake'
|
23
22
|
spec.add_development_dependency 'rspec'
|
24
|
-
spec.add_development_dependency 'rubocop', '~> 1.2'
|
25
|
-
spec.add_development_dependency 'rubocop-performance'
|
26
|
-
spec.add_development_dependency 'rubocop-rake'
|
27
|
-
spec.add_development_dependency 'rubocop-rspec'
|
28
23
|
spec.add_development_dependency 'simplecov'
|
24
|
+
spec.add_development_dependency 'voxpupuli-rubocop', '~> 1.3'
|
29
25
|
|
30
26
|
spec.add_runtime_dependency 'git', '~>1.7'
|
31
27
|
spec.add_runtime_dependency 'gitlab', '~>4.0'
|
32
|
-
spec.add_runtime_dependency 'octokit', '
|
33
|
-
spec.add_runtime_dependency 'puppet-blacksmith', '>= 3.0', '<
|
28
|
+
spec.add_runtime_dependency 'octokit', '>=4', '<7'
|
29
|
+
spec.add_runtime_dependency 'puppet-blacksmith', '>= 3.0', '< 8'
|
34
30
|
spec.add_runtime_dependency 'thor'
|
35
31
|
end
|
@@ -102,21 +102,21 @@ module ModuleSync
|
|
102
102
|
|
103
103
|
def tags
|
104
104
|
FileUtils.chdir(bare_repo_dir) do
|
105
|
-
return run %w
|
105
|
+
return run %w[git tag --list]
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
109
|
def delete_branch(branch)
|
110
110
|
FileUtils.chdir(bare_repo_dir) do
|
111
|
-
run %W
|
111
|
+
run %W[git branch -D #{branch}]
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
115
|
def create_branch(branch, from = nil)
|
116
116
|
from ||= default_branch
|
117
117
|
FileUtils.chdir(tmp_repo_dir) do
|
118
|
-
run %W
|
119
|
-
run %W
|
118
|
+
run %W[git branch -c #{from} #{branch}]
|
119
|
+
run %W[git push --set-upstream origin #{branch}]
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|