modulesync 1.0.0 → 2.0.1

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: 16cd854b2ba5a64f73b1051081fbf1e3bdbe39bbec2b7dacf5de3a3f37750625
4
- data.tar.gz: d45c398dd5e7fc20d4bbf257ca0303bda0faa91ea49d3b6804d34fdbb25e1175
3
+ metadata.gz: fc930ee899499173ce75a299885bee85d967c158b6cfc7cc4113a73b6b7c82bf
4
+ data.tar.gz: 86575cd8683f4c89035d0f5018838bd3690d6a625e15480b7683fdd34e966e07
5
5
  SHA512:
6
- metadata.gz: 38ae3613c9b28a0d679445350dcf6d625ad0db7156db8e26df7b4a4703a79713b471ce786d20d879a4bcdf8cd23830ac8277f259435f6fb191eede8a5a49ac9f
7
- data.tar.gz: 62cacbdc9b002371957bc732727774c79d3b5783280469e3a2a34379265b784a8b6c0a6bccf1ce47ceb4bccea27cdb0273933b86381a37d57fd39e011b382d49
6
+ metadata.gz: 6759dc5e250c03c3bf157dfee1a4890dcbd1c986ab735bb01e996cb4e181aa0b901c91f7b5138129915496ed8f514a66e902a0fae44eb466bf125992ef44e03d
7
+ data.tar.gz: a13a5de75f58baae2a9ad16f958553bc158a9a045b88b2982348f921e3d084aca8f0df575395a8390ed8d7d8ba65c204c06911a8288e55a76ae664c02d4f9f74
data/.gitignore CHANGED
@@ -1,5 +1,11 @@
1
- tmp/
2
- modules/
3
1
  *.gem
4
- Gemfile.lock
5
2
  .bundle/
3
+ .ruby-version
4
+ .vscode/
5
+ Gemfile.lock
6
+ bin/bundle
7
+ bin/rspec
8
+ modules/
9
+ tmp/
10
+ vendor/
11
+ .vendor/
@@ -7,6 +7,9 @@ AllCops:
7
7
  - 'tmp/**/*'
8
8
  - 'pkg/**/*'
9
9
  - 'lib/monkey_patches.rb'
10
+ - 'spec/**/*'
11
+ - 'Gemfile'
12
+ - 'Rakefile'
10
13
 
11
14
  Style/HashSyntax:
12
15
  Enabled: false
@@ -19,7 +19,7 @@ Metrics/AbcSize:
19
19
  # Offense count: 1
20
20
  # Configuration parameters: CountComments.
21
21
  Metrics/ClassLength:
22
- Max: 105
22
+ Max: 107
23
23
 
24
24
  # Offense count: 4
25
25
  Metrics/CyclomaticComplexity:
@@ -2,23 +2,27 @@
2
2
  sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
- dist: trusty
5
+ dist: focal
6
6
  script: 'bundle exec rake test'
7
+ bundler_args: --without release
7
8
  rvm:
8
- - 2.0
9
- - 2.1.9
10
- - 2.2.6
11
- - 2.3.3
12
- - 2.4.0
9
+ - 2.5
10
+ - 2.6
11
+ - 2.7
13
12
  notifications:
14
13
  email: false
14
+ irc:
15
+ on_success: always
16
+ on_failure: always
17
+ channels:
18
+ - "chat.freenode.org#voxpupuli-notifications"
15
19
  deploy:
16
20
  provider: rubygems
17
21
  api_key:
18
22
  secure: "Tbf1EbLEobIIox+fftJZADZsfQQ6kl0urcMNetK7NJzFo/negD/WyJIUj3kro/B7buyYADEjTui/JR4o8EPbugfM3ie5vYOd5k3AesSzbdr4BSwGe/cGbGOB7/PZuGfFLkb94/FiCU2mIwibkbh1rHWGlBoPj7ntL0+5ZtdvsM4="
19
23
  gem: modulesync
20
24
  on:
21
- rvm: 2.4.0
25
+ rvm: 2.7
22
26
  tags: true
23
27
  all_branches: true
24
28
  repo: voxpupuli/modulesync
@@ -1,5 +1,59 @@
1
1
  # Changelog
2
2
 
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [2.0.1](https://github.com/voxpupuli/modulesync/tree/2.0.1) (2020-10-06)
6
+
7
+ [Full Changelog](https://github.com/voxpupuli/modulesync/compare/2.0.0...2.0.1)
8
+
9
+ **Fixed bugs:**
10
+
11
+ - Use remote\_branch for PRs when specified [\#194](https://github.com/voxpupuli/modulesync/pull/194) ([raphink](https://github.com/raphink))
12
+
13
+ **Merged pull requests:**
14
+
15
+ - Allow newer puppet-blacksmith versions [\#197](https://github.com/voxpupuli/modulesync/pull/197) ([bastelfreak](https://github.com/bastelfreak))
16
+
17
+ ## [2.0.0](https://github.com/voxpupuli/modulesync/tree/2.0.0) (2020-08-18)
18
+
19
+ [Full Changelog](https://github.com/voxpupuli/modulesync/compare/1.3.0...2.0.0)
20
+
21
+ **Breaking changes:**
22
+
23
+ - Drop support for Ruby 2.4 and older [\#191](https://github.com/voxpupuli/modulesync/pull/191) ([bastelfreak](https://github.com/bastelfreak))
24
+
25
+ **Implemented enhancements:**
26
+
27
+ - Symbolize keys in managed\_modules except for module names [\#185](https://github.com/voxpupuli/modulesync/pull/185) ([raphink](https://github.com/raphink))
28
+
29
+ **Fixed bugs:**
30
+
31
+ - GitLab MR: undefined method `\[\]' for nil:NilClass \(NoMethodError\) [\#187](https://github.com/voxpupuli/modulesync/issues/187)
32
+ - msync fails with nilClass error [\#172](https://github.com/voxpupuli/modulesync/issues/172)
33
+ - Fix NoMethodError for --pr option \(caused by `module_options = nil`\) / introduce --noop [\#188](https://github.com/voxpupuli/modulesync/pull/188) ([bittner](https://github.com/bittner))
34
+ - Allow empty module options in self.pr\(\) [\#186](https://github.com/voxpupuli/modulesync/pull/186) ([raphink](https://github.com/raphink))
35
+
36
+ ## [1.3.0](https://github.com/voxpupuli/modulesync/tree/1.3.0) (2020-07-03)
37
+
38
+ * Expose --managed_modules_conf [#184](https://github.com/voxpupuli/modulesync/pull/184)
39
+ * Allow absolute path for config files [#183](https://github.com/voxpupuli/modulesync/pull/183)
40
+ * Add pr_target_branch option [#182](https://github.com/voxpupuli/modulesync/pull/182)
41
+ * Allow to specify namespace in module_options [#181](https://github.com/voxpupuli/modulesync/pull/181)
42
+ * Allow to override PR parameters per module [#178](https://github.com/voxpupuli/modulesync/pull/178)
43
+ * Include the gitlab library (if we interact with gitlab), not github [#179](https://github.com/voxpupuli/modulesync/pull/179)
44
+
45
+ ## 2020-07-03 - 1.2.0
46
+
47
+ * Add support for GitLab merge requests (MRs) [#175](https://github.com/voxpupuli/modulesync/pull/175)
48
+
49
+ ## 2020-05-01 - 1.1.0
50
+
51
+ This release provides metadata in the ERB template scope which makes it easy to read files from inside the module. A possible application is reading metadata.json and generating CI configs based on that.
52
+
53
+ * Add metadata to ERB template scope - [#168](https://github.com/voxpupuli/modulesync/pull/168)
54
+ * Skip issuing a PR if one already exists for -b option - [#171](https://github.com/voxpupuli/modulesync/pull/171)
55
+ * Correct the type on the pr-labels option to prevent a deprecation warning - [#173](https://github.com/voxpupuli/modulesync/pull/173)
56
+
3
57
  ## 2019-09-19 - 1.0.0
4
58
 
5
59
  This is the first stable release! 🎉
@@ -206,3 +260,6 @@ Also fixes the README to document the very important -m flag.
206
260
 
207
261
  This release adds support for other SSH-based git servers, which means
208
262
  gitlab is now supported.
263
+
264
+
265
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Gemfile CHANGED
@@ -3,4 +3,8 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'cucumber', '< 3.0' if RUBY_VERSION < '2.1'
6
- gem 'octokit', '~> 4.0'
6
+ gem 'octokit', '~> 4.9'
7
+
8
+ group :release do
9
+ gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes'
10
+ end
@@ -0,0 +1,227 @@
1
+ ## [1.3.0](https://github.com/voxpupuli/modulesync/tree/1.3.0) (2020-07-03)
2
+
3
+ * Expose --managed_modules_conf [#184](https://github.com/voxpupuli/modulesync/pull/184)
4
+ * Allow absolute path for config files [#183](https://github.com/voxpupuli/modulesync/pull/183)
5
+ * Add pr_target_branch option [#182](https://github.com/voxpupuli/modulesync/pull/182)
6
+ * Allow to specify namespace in module_options [#181](https://github.com/voxpupuli/modulesync/pull/181)
7
+ * Allow to override PR parameters per module [#178](https://github.com/voxpupuli/modulesync/pull/178)
8
+ * Include the gitlab library (if we interact with gitlab), not github [#179](https://github.com/voxpupuli/modulesync/pull/179)
9
+
10
+ ## 2020-07-03 - 1.2.0
11
+
12
+ * Add support for GitLab merge requests (MRs) [#175](https://github.com/voxpupuli/modulesync/pull/175)
13
+
14
+ ## 2020-05-01 - 1.1.0
15
+
16
+ This release provides metadata in the ERB template scope which makes it easy to read files from inside the module. A possible application is reading metadata.json and generating CI configs based on that.
17
+
18
+ * Add metadata to ERB template scope - [#168](https://github.com/voxpupuli/modulesync/pull/168)
19
+ * Skip issuing a PR if one already exists for -b option - [#171](https://github.com/voxpupuli/modulesync/pull/171)
20
+ * Correct the type on the pr-labels option to prevent a deprecation warning - [#173](https://github.com/voxpupuli/modulesync/pull/173)
21
+
22
+ ## 2019-09-19 - 1.0.0
23
+
24
+ This is the first stable release! 🎉
25
+
26
+ * Use namespace in directory structure when cloning repositories - [#152](https://github.com/voxpupuli/modulesync/pull/152)
27
+ * Fix minor typo in help output - [#165](https://github.com/voxpupuli/modulesync/pull/165)
28
+ * Small improvements and fixes - [#166](https://github.com/voxpupuli/modulesync/pull/166)
29
+ * Fix overwriting of :global values - [#169](https://github.com/voxpupuli/modulesync/pull/169)
30
+
31
+ ## 2018-12-27 - 0.10.0
32
+
33
+ This is another awesome release!
34
+
35
+ * Add support to submit PRs to GitHub when changes are pushed - [#147](https://github.com/voxpupuli/modulesync/pull/147)
36
+ * Fix "flat files" still mentioned in README - [#151](https://github.com/voxpupuli/modulesync/pull/151)
37
+
38
+ ## 2018-02-15 - 0.9.0
39
+
40
+ ## Summary
41
+
42
+ This is an awesome release - Now honors the repo default branch[#142](https://github.com/voxpupuli/modulesync/pull/142)
43
+
44
+ ### Bugfixes
45
+
46
+ * Monkey patch ls_files until ruby-git/ruby-git#320 is resolved
47
+ * Reraise exception rather than exit so we can rescue a derived StandardError when using skip_broken option
48
+
49
+ ### Enhancements
50
+
51
+ * Add new option to produce a failure exit code on warnings
52
+ * Remove hard coding of managed_modules.yml which means that options passed to ModuleSync.update can override the filename
53
+
54
+ ## 2017-11-03 - 0.8.2
55
+
56
+ ### Summary
57
+
58
+ This release fixes:
59
+ * Bug that caused .gitignore file handle to be left open - [#131](https://github.com/voxpupuli/modulesync/pull/131).
60
+ * Fixed switch_branch to use current_branch instead of master - [#130](https://github.com/voxpupuli/modulesync/pull/130).
61
+ * Fixed bug where failed runs wouldn't return correct exit code - [#125](https://github.com/voxpupuli/modulesync/pull/125).
62
+ * Fix typo in README link to Voxpupuli modulesync_config [#123](https://github.com/voxpupuli/modulesync/pull/123).
63
+
64
+ ## 2017-05-08 - 0.8.1
65
+
66
+ ### Summary
67
+
68
+ This release fixes a nasty bug with CLI vs configuration file option handling: Before [#117](https://github.com/voxpupuli/modulesync/pull/117) it was not possible to override options set in `modulesync.yml` on the command line, which could cause confusion in many cases. Now the configuration file is only used to populate the default values of the options specified in the README, and setting them on the command line will properly use those new values.
69
+
70
+ ## 2017-05-05 - 0.8.0
71
+
72
+ ### Summary
73
+
74
+ This release now prefers `.erb` suffixes on template files. To convert your moduleroot directory, run this command in your configs repo:
75
+
76
+ find moduleroot/ -type f -exec git mv {} {}.erb \;
77
+
78
+ Note that any `.erb`-suffixed configuration keys in `config_defaults.yml`, and `.sync.yml` need to be removed by hand. (This was unreleased functionality, will not affect most users.)
79
+
80
+ #### Refactoring
81
+
82
+ - Prefer `.erb` suffixes on template files, issue deprecation warning for templates without the extension
83
+ - Require Ruby 2.0 or higher
84
+
85
+ #### Bugfixes
86
+
87
+ - Fix dependency on `git` gem for diff functionality
88
+ - Fix error from `git` gem when diff contained line ending changes
89
+
90
+ ## 2017-02-13 - 0.7.2
91
+
92
+ Fixes an issue releasing 0.7.1, no functional changes.
93
+
94
+ ## 2017-02-13 - 0.7.1
95
+
96
+ Fixes an issue releasing 0.7.0, no functional changes.
97
+
98
+ ## 2017-02-13 - 0.7.0
99
+
100
+ ### Summary
101
+
102
+ This is the first release from Vox Pupuli, which has taken over maintenance of
103
+ modulesync.
104
+
105
+ #### Features
106
+ - New `msync update` arguments:
107
+ - `--git-base` to override `git_base`, e.g. for read-only git clones
108
+ - `-s` to skip the current module and continue on error
109
+ - `-x` for a negative filter (blacklist) of modules not to update
110
+ - Add `-a` argument to `msync hook` to pass additional arguments
111
+ - Add `:git_base` and `:namespace` data to `@configs` hash
112
+ - Allow `managed_modules.yml` to list modules with a different namespace
113
+ - Entire directories can be listed with `unmanaged: true`
114
+
115
+ #### Refactoring
116
+ - Replace CLI optionparser with thor
117
+
118
+ #### Bugfixes
119
+ - Fix git 1.8.0 compatibility, detecting when no files are changed
120
+ - Fix `delete: true` feature, now deletes files correctly
121
+ - Fix handling of `:global` config entries, not interpreted as a path
122
+ - Fix push without force to remote branch when no files have changed (#102)
123
+ - Output template name when ERB rendering fails
124
+ - Remove extraneous whitespace in `--noop` output
125
+
126
+ ## 2015-08-13 - 0.6.1
127
+
128
+ ### Summary
129
+
130
+ This is a bugfix release to fix an issue caused by the --project-root flag.
131
+
132
+ #### Bugfixes
133
+
134
+ - Fix bug in git pull function (#55)
135
+
136
+ ##2015-08-11 - 0.6.0
137
+
138
+ ### Summary
139
+
140
+ This release adds two new flags to help modulesync better integrate with CI tools.
141
+
142
+ #### Features
143
+
144
+ - Add --project-root flag
145
+ - Create --offline flag to disable git functionality
146
+
147
+ #### Bugfixes
148
+
149
+ - Fix :remote option for repo
150
+
151
+ #### Maintenance
152
+
153
+ - Added tests
154
+
155
+ ## 2015-06-30 - 0.5.0
156
+
157
+ ### Summary
158
+
159
+ This release adds the ability to sync a non-bare local git repo.
160
+
161
+ #### Features
162
+
163
+ - Allow one to sync non-bare local git repository
164
+
165
+ ## 2015-06-24 - 0.4.0
166
+
167
+ ### Summary
168
+
169
+ This release adds a --remote-branch flag and adds a global key for template
170
+ config.
171
+
172
+ #### Features
173
+
174
+ - Expose --remote-branch
175
+ - Add a global config key
176
+
177
+ #### Bugfixes
178
+
179
+ - Fix markdown syntax in README
180
+
181
+ ## 2015-03-12 - 0.3.0
182
+
183
+ ### Summary
184
+
185
+ This release contains a breaking change to some parameters exposed in
186
+ modulesync.yml. In particular, it abandons the user of git_user and
187
+ git_provider in favor of the parameter git_base to specify the base part of a
188
+ git URL to pull from. It also adds support for gerrit by adding a remote_branch
189
+ parameter for modulesync.yml that can differ from the local branch, plus a
190
+ number of new flags for updating modules.
191
+
192
+ #### Backwards-incompatible changes
193
+
194
+ - Remove git_user and git_provider_address as parameters in favor of using
195
+ git_base as a whole
196
+
197
+ #### Features
198
+
199
+ - Expose the puppet module name in the ERB templates
200
+ - Add support for gerrit by:
201
+ - Adding a --amend flag
202
+ - Adding a remote_branch parameter for modulesync.yml config file that can
203
+ differ from the local branch
204
+ - Adding a script to handle the pre-commit hook for adding a commit id
205
+ - Using git_base to specify an arbitrary git URL instead of an SCP-style one
206
+ - Add a --force flag (usually needed with the --amend flag if not using gerrit)
207
+ - Add --bump, --tag, --tag-pattern, and --changelog flags
208
+
209
+ #### Bugfixes
210
+
211
+ - Stop requiring .gitignore to exist
212
+ - Fix non-master branch functionality
213
+ - Add workarounds for older git versions
214
+
215
+ ## 2014-11-16 - 0.2.0
216
+
217
+ ### Summary
218
+
219
+ This release adds the --filter flag to filter what modules to sync.
220
+ Also fixes the README to document the very important -m flag.
221
+
222
+ ## 2014-9-29 - 0.1.0
223
+
224
+ ### Summary
225
+
226
+ This release adds support for other SSH-based git servers, which means
227
+ gitlab is now supported.
data/README.md CHANGED
@@ -176,27 +176,50 @@ touching the modules, you can deactivate the hook.
176
176
  msync hook deactivate
177
177
  ```
178
178
 
179
- #### Submitting PRs to GitHub
179
+ #### Submitting PRs/MRs to GitHub or GitLab
180
180
 
181
- You can have modulesync submit Pull Requests on GitHub automatically with the
182
- `--pr` CLI option.
181
+ You can have modulesync submit Pull Requests on GitHub or Merge Requests on
182
+ GitLab automatically with the `--pr` CLI option.
183
183
 
184
184
  ```
185
185
  msync update --pr
186
186
  ```
187
187
 
188
- You must set `GITHUB_TOKEN` in your environment for this to work. Other options
189
- include:
188
+ In order for GitHub PRs or GitLab MRs to work, you must either provide
189
+ the `GITHUB_TOKEN` or `GITLAB_TOKEN` environment variables,
190
+ or set them per repository in `managed_modules.yml`, using the `github` or
191
+ `gitlab` keys respectively.
190
192
 
191
- * Set the PR title with `--pr-title` or in `modulesync.yml` with the `pr_title`
192
- attribute.
193
- * Assign labels to the PR with `--pr-labels` or in `modulesync.yml` with the
194
- `pr_labels` attribute. **NOTE:** `pr_labels` should be a list. When using
195
- the `--pr-labels` CLI option, you should use a comma separated list.
193
+ For GitHub Enterprise and self-hosted GitLab instances you also need to set the
194
+ `GITHUB_BASE_URL` or `GITLAB_BASE_URL` environment variables, or use the
195
+ `base_url` parameter in `managed_modules.yml`:
196
196
 
197
- You can optionally set the `GITHUB_BASE_URL` environment variable to use GitHub
198
- Enterprise. This is passed to Octokit's [`api_endpoint`](https://github.com/octokit/octokit.rb#interacting-with-the-githubcom-apis-in-github-enterprise)
199
- configuration option.
197
+ ```yaml
198
+ ---
199
+ repo1:
200
+ github:
201
+ token: 'EXAMPLE_TOKEN'
202
+ base_url: 'https://api.github.com/'
203
+
204
+ repo2:
205
+ gitlab:
206
+ token: 'EXAMPLE_TOKEN'
207
+ base_url: 'https://git.example.com/api/v4'
208
+ ```
209
+
210
+ Then:
211
+
212
+ * Set the PR/MR title with `--pr-title` or in `modulesync.yml` with the
213
+ `pr_title` attribute.
214
+ * Assign labels to the PR/MR with `--pr-labels` or in `modulesync.yml` with
215
+ the `pr_labels` attribute. **NOTE:** `pr_labels` should be a list. When
216
+ using the `--pr-labels` CLI option, you should use a comma separated list.
217
+ * Set the target branch with `--pr_target_branch` or in `modulesync.yml` with
218
+ the `pr_target_branch` attribute.
219
+
220
+ More details for GitHub:
221
+
222
+ * Octokit [`api_endpoint`](https://github.com/octokit/octokit.rb#interacting-with-the-githubcom-apis-in-github-enterprise)
200
223
 
201
224
  ### Using Forks and Non-master branches
202
225
 
@@ -253,13 +276,15 @@ msync update -m "Commit message"
253
276
  Available parameters for modulesync.yml
254
277
 
255
278
  * `git_base` : The default URL to git clone from (Default: 'git@github.com:')
256
- * `namespace` : Namespace of the projects to manage (Default: 'puppetlabs')
279
+ * `namespace` : Namespace of the projects to manage (Default: 'puppetlabs').
280
+ This value can be overridden in the module name (e.g. 'namespace/mod') or by
281
+ using the `namespace` key for the module in `managed_modules.yml`.
257
282
  * `branch` : Branch to push to (Default: 'master')
258
283
  * `remote_branch` : Remote branch to push to (Default: Same value as branch)
259
284
  * `message` : Commit message to apply to updated modules.
260
285
  * `pre_commit_script` : A script to be run before commiting (e.g. 'contrib/myfooscript.sh')
261
- * `pr_title` : The title to use when submitting PRs to GitHub.
262
- * `pr_labels` : A list of labels to assign PRs created on GitHub.
286
+ * `pr_title` : The title to use when submitting PRs/MRs to GitHub or GitLab.
287
+ * `pr_labels` : A list of labels to assign PRs/MRs created on GitHub or GitLab.
263
288
 
264
289
  ##### Example
265
290
 
@@ -389,6 +414,23 @@ As mentioned, files in the moduleroot directory must be ERB templates (they must
389
414
  <%= @configs[:puppet_module] %>
390
415
  ```
391
416
 
417
+ Alternatively some meta data is passed to the template. This will allow you to add custom Ruby extensions inside the
418
+ template, reading other files from the module, to make the template system more adaptive.
419
+
420
+ ```erb
421
+ module: <%= @metadata[:module_name] %>
422
+ target: <%= @metadata[:target_file] %>
423
+ workdir: <%= @metadata[:workdir] %>
424
+ ```
425
+
426
+ Will result in something like:
427
+
428
+ ```
429
+ module: puppet-test
430
+ target: modules/github-org/puppet-test/test
431
+ workdir: modules/github-org/puppet-test
432
+ ```
433
+
392
434
  The Templates
393
435
  -------------
394
436