modulesync 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/README.md +111 -18
- data/contrib/openstack-commit-msg-hook.sh +8 -0
- data/lib/modulesync/cli.rb +28 -4
- data/lib/modulesync/git.rb +113 -16
- data/lib/modulesync.rb +7 -4
- data/modulesync.gemspec +2 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcd0fbe76e6f665fb7122e17a5d6945f7be84bbe
|
4
|
+
data.tar.gz: 5f4e45bc2b44d51fb2b215d022e2269712f47a24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 150e69be961f2c98a69dd1e7f0469a67337991d01ca66279c61ecdfb63f41fd049682b1f4bafe16dbe5d808a4a3786cb7626ede3b82528c2276d686c9bf5f362
|
7
|
+
data.tar.gz: 326c5d4551c5398f22e635149b9cec5bf09f61047e198cb761910a13ba947cc4dffdd997ca12b14a0b53bd8704f25a4634f07fe6d18d8f33dcd0bcd9b30be5a3
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
##2015-03-12 - 0.3.0
|
2
|
+
|
3
|
+
### Summary
|
4
|
+
|
5
|
+
This release contains a breaking change to some parameters exposed in
|
6
|
+
modulesync.yml. In particular, it abandons the user of git_user and
|
7
|
+
git_provider in favor of the parameter git_base to specify the base part of a
|
8
|
+
git URL to pull from. It also adds support for gerrit by adding a remote_branch
|
9
|
+
parameter for modulesync.yml that can differ from the local branch, plus a
|
10
|
+
number of new flags for updating modules.
|
11
|
+
|
12
|
+
#### Backwards-incompatible changes
|
13
|
+
|
14
|
+
- Remove git_user and git_provider_address as parameters in favor of using
|
15
|
+
git_base as a whole
|
16
|
+
|
17
|
+
#### Features
|
18
|
+
|
19
|
+
- Expose the puppet module name in the ERB templates
|
20
|
+
- Add support for gerrit by:
|
21
|
+
- Adding a --amend flag
|
22
|
+
- Adding a remote_branch parameter for modulesync.yml config file that can
|
23
|
+
differ from the local branch
|
24
|
+
- Adding a script to handle the pre-commit hook for adding a commit id
|
25
|
+
- Using git_base to specify an arbitrary git URL instead of an SCP-style one
|
26
|
+
- Add a --force flag (usually needed with the --amend flag if not using gerrit)
|
27
|
+
- Add --bump, --tag, --tag-pattern, and --changelog flags
|
28
|
+
|
29
|
+
#### Bugfixes
|
30
|
+
|
31
|
+
- Stop requiring .gitignore to exist
|
32
|
+
- Fix non-master branch functionality
|
33
|
+
- Add workarounds for older git versions
|
34
|
+
|
1
35
|
##2014-11-16 - 0.2.0
|
2
36
|
|
3
37
|
### Summary
|
data/README.md
CHANGED
@@ -68,7 +68,7 @@ This allows us to, for example, have a set of "required" gems that are added
|
|
68
68
|
to all Gemfiles, and a set of "optional" gems that a single module might add.
|
69
69
|
|
70
70
|
The list of modules to manage is in managed\_modules.yml in the configuration
|
71
|
-
directory. This lists just the
|
71
|
+
directory. This lists just the names of the modules to be managed.
|
72
72
|
|
73
73
|
ModuleSync can be called from the command line with parameters to change the
|
74
74
|
branch you're working on or the remote to clone from and push to. You can also
|
@@ -101,20 +101,18 @@ github organization and pushes to the master branch.
|
|
101
101
|
|
102
102
|
Make changes to a file in the moduleroot. For sanity's sake you should commit
|
103
103
|
and push these changes, but in this mode the update will be rendered from the
|
104
|
-
state of the files locally.
|
105
|
-
configuration directory (not moduleroot), or use -c <relative path> to point
|
106
|
-
it to the location of the configuration directory.
|
104
|
+
state of the files locally.
|
107
105
|
|
108
106
|
#### Dry-run
|
109
107
|
|
110
108
|
Do a dry-run to see what files will be changed, added and removed. This clones
|
111
|
-
the modules to `modules/<namespace>-<modulename>` in the current working
|
112
|
-
the modules are already cloned, does an effective `git fetch
|
113
|
-
checkout master; git reset --hard origin/master` on the modules.
|
114
|
-
modulesync if the current working directory contains a modules/
|
115
|
-
changes you want to keep. The dry-run makes local changes there,
|
116
|
-
commit or push changes. It is still destructive in that it
|
117
|
-
changes.
|
109
|
+
the modules to `modules/<namespace>-<modulename>` in the current working
|
110
|
+
directory, or if the modules are already cloned, does an effective `git fetch
|
111
|
+
origin; git checkout master; git reset --hard origin/master` on the modules.
|
112
|
+
Don't run modulesync if the current working directory contains a modules/
|
113
|
+
directory with changes you want to keep. The dry-run makes local changes there,
|
114
|
+
but does not commit or push changes. It is still destructive in that it
|
115
|
+
overwrites local changes.
|
118
116
|
|
119
117
|
```
|
120
118
|
msync update --noop
|
@@ -130,6 +128,19 @@ found.
|
|
130
128
|
msync update -m "Commit message"
|
131
129
|
```
|
132
130
|
|
131
|
+
Amend the commit if changes are needed.
|
132
|
+
|
133
|
+
```
|
134
|
+
msync update --amend
|
135
|
+
```
|
136
|
+
|
137
|
+
For most workflows you will need to force-push an amended commit. Not required
|
138
|
+
for gerrit.
|
139
|
+
|
140
|
+
```
|
141
|
+
msync update --amend --force
|
142
|
+
```
|
143
|
+
|
133
144
|
#### Automating Updates
|
134
145
|
|
135
146
|
You can install a pre-push git hook to automatically clone, update, and push
|
@@ -155,18 +166,17 @@ you can use this on your own organization's modules. This functionality also
|
|
155
166
|
applies if you want to work on a fork of the puppetlabs modules or work on a
|
156
167
|
non-master branch of any organization's modules. ModuleSync does not support
|
157
168
|
cloning from one remote and pushing to another, you are expected to fork
|
158
|
-
manually. It does not
|
169
|
+
manually. It does not support automating pull requests.
|
159
170
|
|
160
171
|
#### Dry-run
|
161
172
|
|
162
173
|
If you dry-run before doing the live update, you need to specify what namespace
|
163
174
|
to clone from because the live update will not re-clone if the modules are
|
164
|
-
already cloned. The namespace should be your fork, not the upstream module
|
165
|
-
|
166
|
-
itself.
|
175
|
+
already cloned. The namespace should be your fork, not the upstream module (if
|
176
|
+
working on a fork).
|
167
177
|
|
168
178
|
```
|
169
|
-
msync update -n
|
179
|
+
msync update -n puppetlabs --noop
|
170
180
|
```
|
171
181
|
|
172
182
|
#### Damage mode
|
@@ -177,7 +187,7 @@ namespace if the modules are not pre-cloned. You need to specify a branch to
|
|
177
187
|
push to if you are not pushing to master.
|
178
188
|
|
179
189
|
```
|
180
|
-
msync update -n
|
190
|
+
msync update -n puppetlabs -b sync_branch -m "Commit message"
|
181
191
|
```
|
182
192
|
|
183
193
|
#### Configuring ModuleSync defaults
|
@@ -201,6 +211,43 @@ msync update --noop
|
|
201
211
|
msync update -m "Commit message"
|
202
212
|
```
|
203
213
|
|
214
|
+
Available parameters for modulesync.yml
|
215
|
+
|
216
|
+
* git_base : The default URL to git clone from (Default: 'git@github.com:')
|
217
|
+
* namespace : Namespace of the projects to manage (Default: 'puppetlabs')
|
218
|
+
* branch : Branch to push to (Default: 'master')
|
219
|
+
* remote_branch : Remote branch to push to (Default: Same value as branch)
|
220
|
+
* pre_commit_script : A script to be run before commiting (ie. contrib/myfooscript.sh)
|
221
|
+
|
222
|
+
##### Example
|
223
|
+
|
224
|
+
###### Github
|
225
|
+
|
226
|
+
```
|
227
|
+
---
|
228
|
+
namespace: MySuperOrganization
|
229
|
+
branch: modulesyncbranch
|
230
|
+
```
|
231
|
+
|
232
|
+
###### Gitlab
|
233
|
+
|
234
|
+
```
|
235
|
+
---
|
236
|
+
git_base: 'user@gitlab.example.com:'
|
237
|
+
namespace: MySuperOrganization
|
238
|
+
branch: modulesyncbranch
|
239
|
+
|
240
|
+
###### Gerrit
|
241
|
+
|
242
|
+
```
|
243
|
+
---
|
244
|
+
namespace: stackforge
|
245
|
+
git_base: ssh://jdoe@review.openstack.org:29418/
|
246
|
+
branch: msync_foo
|
247
|
+
remote_branch: refs/publish/master/msync_foo
|
248
|
+
pre_commit_script: openstack-commit-msg-hook.sh
|
249
|
+
```
|
250
|
+
|
204
251
|
#### Filtering Repositories
|
205
252
|
|
206
253
|
If you only want to sync some of the repositories in your managed_modules.yml, use the -f flag to filter by a regex:
|
@@ -217,9 +264,55 @@ different remote. The hook will also look in modulesync.yml for default
|
|
217
264
|
arguments.
|
218
265
|
|
219
266
|
```
|
220
|
-
msync hook activate -n
|
267
|
+
msync hook activate -n puppetlabs -b sync_branch
|
268
|
+
```
|
269
|
+
|
270
|
+
#### Updating metadata.json
|
271
|
+
|
272
|
+
Modulesync can optionally bump the minor version in `metadata.json` for each
|
273
|
+
modified modules if you add the `--bump` flag to the command line:
|
274
|
+
|
275
|
+
```
|
276
|
+
msync update -m "Commit message" --bump
|
277
|
+
```
|
278
|
+
|
279
|
+
#### Tagging repositories
|
280
|
+
|
281
|
+
If you wish to tag the modified repositories with the newly bumped version,
|
282
|
+
you can do so by using the `--tag` flag:
|
283
|
+
|
284
|
+
```
|
285
|
+
msync update -m "Commit message" --bump --tag
|
286
|
+
```
|
287
|
+
|
288
|
+
#### Setting the tag pattern
|
289
|
+
|
290
|
+
You can also set the format of the tag to be used (`printf`-formatted)
|
291
|
+
by setting the `tag_pattern` option:
|
292
|
+
|
293
|
+
```
|
294
|
+
msync update -m "Commit message" --bump --tag --tag_pattern 'v%s'
|
221
295
|
```
|
222
296
|
|
297
|
+
The default for the tag pattern is `%s`.
|
298
|
+
|
299
|
+
#### Updating the CHANGELOG
|
300
|
+
|
301
|
+
When bumping the version in `metadata.json`, modulesync can let you
|
302
|
+
updating `CHANGELOG.md` in each modified repository.
|
303
|
+
|
304
|
+
This is one by using the `--changelog` flag:
|
305
|
+
|
306
|
+
```
|
307
|
+
msync update -m "Commit message" --bump --changelog
|
308
|
+
```
|
309
|
+
|
310
|
+
This flag will cause the `CHANGELOG.md` file to be updated with the
|
311
|
+
current date, bumped (minor) version, and commit message.
|
312
|
+
|
313
|
+
If `CHANGELOG.md` is absent in the repository, nothing will happen.
|
314
|
+
|
315
|
+
|
223
316
|
The Templates
|
224
317
|
-------------
|
225
318
|
|
data/lib/modulesync/cli.rb
CHANGED
@@ -10,10 +10,10 @@ module ModuleSync
|
|
10
10
|
{
|
11
11
|
:namespace => 'puppetlabs',
|
12
12
|
:branch => 'master',
|
13
|
-
:
|
14
|
-
:git_provider_address => 'github.com',
|
13
|
+
:git_base => 'git@github.com:',
|
15
14
|
:managed_modules_conf => 'managed_modules.yml',
|
16
15
|
:configs => '.',
|
16
|
+
:tag_pattern => '%s',
|
17
17
|
}
|
18
18
|
end
|
19
19
|
|
@@ -35,7 +35,7 @@ module ModuleSync
|
|
35
35
|
@options.merge!(Hash.transform_keys_to_symbols(Util.parse_config(MODULESYNC_CONF_FILE)))
|
36
36
|
@options[:command] = args[0] if commands_available.include?(args[0])
|
37
37
|
opt_parser = OptionParser.new do |opts|
|
38
|
-
opts.banner = "Usage: msync update [-m <commit message>] [-c <directory> ] [--noop] [-n <namespace>] [-b <branch>] [-f <filter>] | hook activate|deactivate [-c <directory> ] [-n <namespace>] [-b <branch>]"
|
38
|
+
opts.banner = "Usage: msync update [-m <commit message>] [-c <directory> ] [--noop] [--bump] [--changelog] [--tag] [--tag-pattern <tag_pattern>] [-n <namespace>] [-b <branch>] [-f <filter>] | hook activate|deactivate [-c <directory> ] [-n <namespace>] [-b <branch>]"
|
39
39
|
opts.on('-m', '--message <msg>',
|
40
40
|
'Commit message to apply to updated modules') do |msg|
|
41
41
|
@options[:message] = msg
|
@@ -56,15 +56,39 @@ module ModuleSync
|
|
56
56
|
'A regular expression to filter repositories to update.') do |filter|
|
57
57
|
@options[:filter] = filter
|
58
58
|
end
|
59
|
+
opts.on('--amend',
|
60
|
+
'Amend previous commit') do |msg|
|
61
|
+
@options[:amend] = true
|
62
|
+
end
|
63
|
+
opts.on('--force',
|
64
|
+
'Force push amended commit') do |msg|
|
65
|
+
@options[:force] = true
|
66
|
+
end
|
59
67
|
opts.on('--noop',
|
60
68
|
'No-op mode') do |msg|
|
61
69
|
@options[:noop] = true
|
62
70
|
end
|
71
|
+
opts.on('--bump',
|
72
|
+
'Bump module version to the next minor') do |msg|
|
73
|
+
@options[:bump] = true
|
74
|
+
end
|
75
|
+
opts.on('--changelog',
|
76
|
+
'Update CHANGELOG.md if version was bumped') do |msg|
|
77
|
+
@options[:changelog] = true
|
78
|
+
end
|
79
|
+
opts.on('--tag',
|
80
|
+
'Git tag with the current module version') do |msg|
|
81
|
+
@options[:tag] = true
|
82
|
+
end
|
83
|
+
opts.on('--tag-pattern',
|
84
|
+
'The pattern to use when tagging releases.') do |pattern|
|
85
|
+
@options[:tag_pattern] = pattern
|
86
|
+
end
|
63
87
|
@options[:help] = opts.help
|
64
88
|
end.parse!
|
65
89
|
|
66
90
|
@options.fetch(:message) do
|
67
|
-
if @options[:command] == 'update' && ! @options[:noop]
|
91
|
+
if @options[:command] == 'update' && ! @options[:noop] && ! @options[:amend]
|
68
92
|
fail("A commit message is required unless using noop.")
|
69
93
|
end
|
70
94
|
end
|
data/lib/modulesync/git.rb
CHANGED
@@ -1,10 +1,36 @@
|
|
1
1
|
require 'git'
|
2
|
+
require 'puppet_blacksmith'
|
2
3
|
|
3
4
|
module ModuleSync
|
4
5
|
module Git
|
5
6
|
include Constants
|
6
7
|
|
7
|
-
def self.
|
8
|
+
def self.remote_branch_exists?(repo, branch)
|
9
|
+
repo.branches.remote.collect { |b| b.name }.include?(branch)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.local_branch_exists?(repo, branch)
|
13
|
+
repo.branches.local.collect { |b| b.name }.include?(branch)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.switch_branch(repo, branch)
|
17
|
+
unless repo.branch.name == branch
|
18
|
+
if local_branch_exists?(repo, branch)
|
19
|
+
puts "Switching to branch #{branch}"
|
20
|
+
repo.checkout(branch)
|
21
|
+
elsif remote_branch_exists?(repo, branch)
|
22
|
+
puts "Creating local branch #{branch} from origin/#{branch}"
|
23
|
+
repo.checkout("origin/#{branch}")
|
24
|
+
repo.branch(branch).checkout
|
25
|
+
else
|
26
|
+
repo.checkout('origin/master')
|
27
|
+
puts "Creating new branch #{branch}"
|
28
|
+
repo.branch(branch).checkout
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.pull(git_base, name, branch, opts)
|
8
34
|
if ! Dir.exists?(PROJ_ROOT)
|
9
35
|
Dir.mkdir(PROJ_ROOT)
|
10
36
|
end
|
@@ -12,25 +38,73 @@ module ModuleSync
|
|
12
38
|
# Repo needs to be cloned in the cwd
|
13
39
|
if ! Dir.exists?("#{PROJ_ROOT}/#{name}") || ! Dir.exists?("#{PROJ_ROOT}/#{name}/.git")
|
14
40
|
puts "Cloning repository fresh"
|
15
|
-
remote = "#{
|
41
|
+
remote = opts[:remote] || "#{git_base}/#{name}.git"
|
16
42
|
local = "#{PROJ_ROOT}/#{name}"
|
17
43
|
puts "Cloning from #{remote}"
|
18
44
|
repo = ::Git.clone(remote, local)
|
19
|
-
|
45
|
+
switch_branch(repo, branch)
|
20
46
|
# Repo already cloned, check out master and override local changes
|
21
47
|
else
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
48
|
+
# Some versions of git can't properly handle managing a repo from outside the repo directory
|
49
|
+
Dir.chdir("#{PROJ_ROOT}/#{name}") do
|
50
|
+
puts "Overriding any local changes to repositories in #{PROJ_ROOT}"
|
51
|
+
repo = ::Git.open('.')
|
52
|
+
repo.fetch
|
53
|
+
repo.reset_hard
|
54
|
+
switch_branch(repo, branch)
|
55
|
+
if remote_branch_exists?(repo, branch)
|
56
|
+
repo.pull('origin', branch)
|
57
|
+
end
|
58
|
+
end
|
27
59
|
end
|
28
60
|
end
|
29
61
|
|
62
|
+
def self.update_changelog(repo, version, message, module_root)
|
63
|
+
changelog = "#{module_root}/CHANGELOG.md"
|
64
|
+
if File.exists?(changelog)
|
65
|
+
puts "Updating #{changelog} for version #{version}"
|
66
|
+
changes = File.readlines(changelog)
|
67
|
+
File.open(changelog, 'w') do |f|
|
68
|
+
date = Time.now.strftime("%Y-%m-%d")
|
69
|
+
f.puts "## #{date} - Release #{version}\n\n"
|
70
|
+
f.puts "#{message}\n\n"
|
71
|
+
# Add old lines again
|
72
|
+
f.puts changes
|
73
|
+
end
|
74
|
+
repo.add('CHANGELOG.md')
|
75
|
+
else
|
76
|
+
puts "No CHANGELOG.md file found, not updating."
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def self.bump(repo, m, message, module_root, changelog=false)
|
81
|
+
new = m.bump!
|
82
|
+
puts "Bumped to version #{new}"
|
83
|
+
repo.add('metadata.json')
|
84
|
+
self.update_changelog(repo, new, message, module_root) if changelog
|
85
|
+
repo.commit("Release version #{new}")
|
86
|
+
repo.push
|
87
|
+
new
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.tag(repo, version, tag_pattern)
|
91
|
+
tag = tag_pattern % version
|
92
|
+
puts "Tagging with #{tag}"
|
93
|
+
repo.add_tag(tag)
|
94
|
+
repo.push('origin', tag)
|
95
|
+
end
|
96
|
+
|
30
97
|
# Git add/rm, git commit, git push
|
31
|
-
def self.update(name, files,
|
32
|
-
|
33
|
-
|
98
|
+
def self.update(name, files, options)
|
99
|
+
module_root = "#{PROJ_ROOT}/#{name}"
|
100
|
+
message = options[:message]
|
101
|
+
if options[:remote_branch]
|
102
|
+
branch = "#{options[:branch]}:#{options[:remote_branch]}"
|
103
|
+
else
|
104
|
+
branch = options[:branch]
|
105
|
+
end
|
106
|
+
repo = ::Git.open(module_root)
|
107
|
+
repo.branch(options[:branch]).checkout
|
34
108
|
files.each do |file|
|
35
109
|
if repo.status.deleted.include?(file)
|
36
110
|
repo.remove(file)
|
@@ -39,8 +113,26 @@ module ModuleSync
|
|
39
113
|
end
|
40
114
|
end
|
41
115
|
begin
|
42
|
-
|
43
|
-
|
116
|
+
opts_commit = {}
|
117
|
+
opts_push = {}
|
118
|
+
if options[:amend]
|
119
|
+
opts_commit = {:amend => true}
|
120
|
+
end
|
121
|
+
if options[:force]
|
122
|
+
opts_push = {:force => true}
|
123
|
+
end
|
124
|
+
if options[:pre_commit_script]
|
125
|
+
script = "#{File.dirname(File.dirname(__FILE__))}/../contrib/#{options[:pre_commit_script]}"
|
126
|
+
%x[#{script} #{module_root}]
|
127
|
+
end
|
128
|
+
repo.commit(message, opts_commit)
|
129
|
+
repo.push('origin', branch, opts_push)
|
130
|
+
# Only bump/tag if pushing didn't fail (i.e. there were changes)
|
131
|
+
m = Blacksmith::Modulefile.new("#{module_root}/metadata.json")
|
132
|
+
if options[:bump]
|
133
|
+
new = self.bump(repo, m, message, module_root, options[:changelog])
|
134
|
+
self.tag(repo, new, options[:tag_pattern]) if options[:tag]
|
135
|
+
end
|
44
136
|
rescue ::Git::GitExecuteError => git_error
|
45
137
|
if git_error.message.include? "nothing to commit, working directory clean"
|
46
138
|
puts "There were no files to update in #{name}. Not committing."
|
@@ -55,15 +147,20 @@ module ModuleSync
|
|
55
147
|
# untracked under some circumstances
|
56
148
|
# https://github.com/schacon/ruby-git/issues/130
|
57
149
|
def self.untracked_unignored_files(repo)
|
58
|
-
|
150
|
+
ignore_path = "#{repo.dir.path}/.gitignore"
|
151
|
+
if File.exists?(ignore_path)
|
152
|
+
ignored = File.open(ignore_path).read.split
|
153
|
+
else
|
154
|
+
ignored = []
|
155
|
+
end
|
59
156
|
repo.status.untracked.keep_if{|f,_| !ignored.any?{|i| File.fnmatch(i, f)}}
|
60
157
|
end
|
61
158
|
|
62
|
-
def self.update_noop(name,
|
159
|
+
def self.update_noop(name, options)
|
63
160
|
puts "Using no-op. Files in #{name} may be changed but will not be committed."
|
64
161
|
|
65
162
|
repo = ::Git.open("#{PROJ_ROOT}/#{name}")
|
66
|
-
repo.branch(branch).checkout
|
163
|
+
repo.branch(options[:branch]).checkout
|
67
164
|
|
68
165
|
puts "Files changed: "
|
69
166
|
repo.diff('HEAD', '--').each do |diff|
|
data/lib/modulesync.rb
CHANGED
@@ -53,14 +53,17 @@ module ModuleSync
|
|
53
53
|
|
54
54
|
managed_modules = self.managed_modules("#{options[:configs]}/managed_modules.yml", options[:filter])
|
55
55
|
|
56
|
-
managed_modules
|
56
|
+
# managed_modules is either an array or a hash
|
57
|
+
managed_modules.each do |puppet_module, opts|
|
57
58
|
puts "Syncing #{puppet_module}"
|
58
|
-
|
59
|
+
git_base = "#{options[:git_base]}#{options[:namespace]}"
|
60
|
+
Git.pull(git_base, puppet_module, options[:branch], opts || {})
|
59
61
|
module_configs = Util.parse_config("#{PROJ_ROOT}/#{puppet_module}/#{MODULE_CONF_FILE}")
|
60
62
|
files_to_manage = module_files | defaults.keys | module_configs.keys
|
61
63
|
files_to_delete = []
|
62
64
|
files_to_manage.each do |file|
|
63
65
|
file_configs = (defaults[file] || {}).merge(module_configs[file] || {})
|
66
|
+
file_configs[:puppet_module] = puppet_module
|
64
67
|
if file_configs['unmanaged']
|
65
68
|
puts "Not managing #{file} in #{puppet_module}"
|
66
69
|
files_to_delete << file
|
@@ -74,9 +77,9 @@ module ModuleSync
|
|
74
77
|
end
|
75
78
|
files_to_manage -= files_to_delete
|
76
79
|
if options[:noop]
|
77
|
-
Git.update_noop(puppet_module, options
|
80
|
+
Git.update_noop(puppet_module, options)
|
78
81
|
else
|
79
|
-
Git.update(puppet_module, files_to_manage, options
|
82
|
+
Git.update(puppet_module, files_to_manage, options)
|
80
83
|
end
|
81
84
|
end
|
82
85
|
elsif options[:command] == 'hook'
|
data/modulesync.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'modulesync'
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.3.0'
|
8
8
|
spec.authors = ['Colleen Murphy']
|
9
9
|
spec.email = ['colleen@puppetlabs.com']
|
10
10
|
spec.summary = %q{Puppet Module Synchronizer}
|
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.6"
|
21
21
|
|
22
22
|
spec.add_runtime_dependency 'git', '~>1.2'
|
23
|
+
spec.add_runtime_dependency 'puppet-blacksmith', '~>3.0'
|
23
24
|
end
|
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: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colleen Murphy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: puppet-blacksmith
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
41
55
|
description: Utility to synchronize common files across puppet modules in Github.
|
42
56
|
email:
|
43
57
|
- colleen@puppetlabs.com
|
@@ -52,6 +66,7 @@ files:
|
|
52
66
|
- LICENSE
|
53
67
|
- README.md
|
54
68
|
- bin/msync
|
69
|
+
- contrib/openstack-commit-msg-hook.sh
|
55
70
|
- lib/modulesync.rb
|
56
71
|
- lib/modulesync/cli.rb
|
57
72
|
- lib/modulesync/constants.rb
|
@@ -80,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
95
|
version: '0'
|
81
96
|
requirements: []
|
82
97
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.0.14
|
84
99
|
signing_key:
|
85
100
|
specification_version: 4
|
86
101
|
summary: Puppet Module Synchronizer
|
87
102
|
test_files: []
|
88
|
-
has_rdoc:
|