modulesync 0.9.0 → 1.3.0

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: aba3647204bfcc8853cafeddbf1e4f1083ceaade7fb1806bd06b36e37d6d593e
4
- data.tar.gz: ce4305980ed768ffd80580c4618c7d921e0c7c6e17b57edc3dae0c10eacbeef6
3
+ metadata.gz: 7fb5357d0ecf1e4f620be302b55c9f1e88779c446021097172866c87a1e57d8f
4
+ data.tar.gz: be3975ae4dbe2a4e6a32cc5851bc0e9ce8ac8dd0b9560175380f492e43dabe27
5
5
  SHA512:
6
- metadata.gz: 0cfda65f2a020913fa4cd928e22daac9e5c141f7881afaed928b28af846fe86466fff64314e89b04b9d3cb32bf8e4387ec0410e7142215ac5e0412b15c845d62
7
- data.tar.gz: 083fdbb949ce978be0958f3ac2baa8390d38d7221c846b934b5b2e3e49cc60992d662b0afd8322d4efeb3bbec9643faf73b7cba95ba3f91d388953365837494a
6
+ metadata.gz: 15051bcc97f904d9d886e67abf9e6ea99818410ec3f330f7d67ed9cc86451f322b79861801218f46b534a0f3241f3aa15dc16928360c471c0742e0b8f3c120f7
7
+ data.tar.gz: d527c5e7eeeccfabdbd5eb328759b826873aea33f12419179a89f84a1499af784788de9ca420eab8cbc5d2d83fdf1a9a8f6bbde1c536b25aca9c35b21c77c40b
data/.gitignore CHANGED
@@ -1,5 +1,10 @@
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/
@@ -7,6 +7,7 @@ AllCops:
7
7
  - 'tmp/**/*'
8
8
  - 'pkg/**/*'
9
9
  - 'lib/monkey_patches.rb'
10
+ - 'spec/**/*'
10
11
 
11
12
  Style/HashSyntax:
12
13
  Enabled: false
@@ -18,3 +19,7 @@ Style/TrailingCommaInLiteral:
18
19
  # would require external library
19
20
  Layout/IndentHeredoc:
20
21
  Enabled: false
22
+
23
+ # sane line length
24
+ Metrics/LineLength:
25
+ Max: 120
@@ -19,17 +19,12 @@ 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:
26
26
  Max: 13
27
27
 
28
- # Offense count: 29
29
- # Configuration parameters: AllowURI, URISchemes.
30
- Metrics/LineLength:
31
- Max: 319
32
-
33
28
  # Offense count: 8
34
29
  # Configuration parameters: CountComments.
35
30
  Metrics/MethodLength:
@@ -6,10 +6,13 @@ dist: trusty
6
6
  script: 'bundle exec rake test'
7
7
  rvm:
8
8
  - 2.0
9
- - 2.1.9
10
- - 2.2.6
11
- - 2.3.3
12
- - 2.4.0
9
+ - 2.1
10
+ - 2.2
11
+ - 2.3
12
+ - 2.4
13
+ - 2.5
14
+ - 2.6
15
+ - 2.7
13
16
  notifications:
14
17
  email: false
15
18
  deploy:
@@ -18,7 +21,7 @@ deploy:
18
21
  secure: "Tbf1EbLEobIIox+fftJZADZsfQQ6kl0urcMNetK7NJzFo/negD/WyJIUj3kro/B7buyYADEjTui/JR4o8EPbugfM3ie5vYOd5k3AesSzbdr4BSwGe/cGbGOB7/PZuGfFLkb94/FiCU2mIwibkbh1rHWGlBoPj7ntL0+5ZtdvsM4="
19
22
  gem: modulesync
20
23
  on:
21
- rvm: 2.4.0
24
+ rvm: 2.7
22
25
  tags: true
23
26
  all_branches: true
24
27
  repo: voxpupuli/modulesync
@@ -1,6 +1,43 @@
1
1
  # Changelog
2
2
 
3
- ## 2018-02-15
3
+ ## 2020-07-03 - 1.3.0
4
+
5
+ * Expose --managed_modules_conf [#184](https://github.com/voxpupuli/modulesync/pull/184)
6
+ * Allow absolute path for config files [#183](https://github.com/voxpupuli/modulesync/pull/183)
7
+ * Add pr_target_branch option [#182](https://github.com/voxpupuli/modulesync/pull/182)
8
+ * Allow to specify namespace in module_options [#181](https://github.com/voxpupuli/modulesync/pull/181)
9
+ * Allow to override PR parameters per module [#178](https://github.com/voxpupuli/modulesync/pull/178)
10
+ * Include the gitlab library (if we interact with gitlab), not github [#179](https://github.com/voxpupuli/modulesync/pull/179)
11
+
12
+ ## 2020-07-03 - 1.2.0
13
+
14
+ * Add support for GitLab merge requests (MRs) [#175](https://github.com/voxpupuli/modulesync/pull/175)
15
+
16
+ ## 2020-05-01 - 1.1.0
17
+
18
+ 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.
19
+
20
+ * Add metadata to ERB template scope - [#168](https://github.com/voxpupuli/modulesync/pull/168)
21
+ * Skip issuing a PR if one already exists for -b option - [#171](https://github.com/voxpupuli/modulesync/pull/171)
22
+ * Correct the type on the pr-labels option to prevent a deprecation warning - [#173](https://github.com/voxpupuli/modulesync/pull/173)
23
+
24
+ ## 2019-09-19 - 1.0.0
25
+
26
+ This is the first stable release! 🎉
27
+
28
+ * Use namespace in directory structure when cloning repositories - [#152](https://github.com/voxpupuli/modulesync/pull/152)
29
+ * Fix minor typo in help output - [#165](https://github.com/voxpupuli/modulesync/pull/165)
30
+ * Small improvements and fixes - [#166](https://github.com/voxpupuli/modulesync/pull/166)
31
+ * Fix overwriting of :global values - [#169](https://github.com/voxpupuli/modulesync/pull/169)
32
+
33
+ ## 2018-12-27 - 0.10.0
34
+
35
+ This is another awesome release!
36
+
37
+ * Add support to submit PRs to GitHub when changes are pushed - [#147](https://github.com/voxpupuli/modulesync/pull/147)
38
+ * Fix "flat files" still mentioned in README - [#151](https://github.com/voxpupuli/modulesync/pull/151)
39
+
40
+ ## 2018-02-15 - 0.9.0
4
41
 
5
42
  ## Summary
6
43
 
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ 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.9'
data/README.md CHANGED
@@ -176,6 +176,51 @@ touching the modules, you can deactivate the hook.
176
176
  msync hook deactivate
177
177
  ```
178
178
 
179
+ #### Submitting PRs/MRs to GitHub or GitLab
180
+
181
+ You can have modulesync submit Pull Requests on GitHub or Merge Requests on
182
+ GitLab automatically with the `--pr` CLI option.
183
+
184
+ ```
185
+ msync update --pr
186
+ ```
187
+
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.
192
+
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
+
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)
223
+
179
224
  ### Using Forks and Non-master branches
180
225
 
181
226
  The default functionality is to run ModuleSync on the puppetlabs modules, but
@@ -215,7 +260,7 @@ probably seems excessive. You can create a file called modulesync.yml in the
215
260
  configuration directory that provides these arguments automatically. This file
216
261
  has a form such as:
217
262
 
218
- ```
263
+ ```yaml
219
264
  ---
220
265
  namespace: mygithubusername
221
266
  branch: modulesyncbranch
@@ -230,26 +275,35 @@ msync update -m "Commit message"
230
275
 
231
276
  Available parameters for modulesync.yml
232
277
 
233
- * git_base : The default URL to git clone from (Default: 'git@github.com:')
234
- * namespace : Namespace of the projects to manage (Default: 'puppetlabs')
235
- * branch : Branch to push to (Default: 'master')
236
- * remote_branch : Remote branch to push to (Default: Same value as branch)
237
- * message : Commit message to apply to updated modules.
238
- * pre_commit_script : A script to be run before commiting (e.g. 'contrib/myfooscript.sh')
278
+ * `git_base` : The default URL to git clone from (Default: 'git@github.com:')
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`.
282
+ * `branch` : Branch to push to (Default: 'master')
283
+ * `remote_branch` : Remote branch to push to (Default: Same value as branch)
284
+ * `message` : Commit message to apply to updated modules.
285
+ * `pre_commit_script` : A script to be run before commiting (e.g. 'contrib/myfooscript.sh')
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.
239
288
 
240
289
  ##### Example
241
290
 
242
- ###### Github
291
+ ###### GitHub
243
292
 
244
- ```
293
+ ```yaml
245
294
  ---
246
295
  namespace: MySuperOrganization
247
296
  branch: modulesyncbranch
297
+ pr_title: "Updates to module template files via modulesync"
298
+ pr_labels:
299
+ - TOOLING
300
+ - MAINTENANCE
301
+ - MODULESYNC
248
302
  ```
249
303
 
250
- ###### Gitlab
304
+ ###### GitLab
251
305
 
252
- ```
306
+ ```yaml
253
307
  ---
254
308
  git_base: 'user@gitlab.example.com:'
255
309
  namespace: MySuperOrganization
@@ -258,7 +312,7 @@ branch: modulesyncbranch
258
312
 
259
313
  ###### Gerrit
260
314
 
261
- ```
315
+ ```yaml
262
316
  ---
263
317
  namespace: stackforge
264
318
  git_base: ssh://jdoe@review.openstack.org:29418/
@@ -350,16 +404,33 @@ current date, bumped (minor) version, and commit message.
350
404
  If `CHANGELOG.md` is absent in the repository, nothing will happen.
351
405
 
352
406
 
353
- #### Defining templates
407
+ #### Working with templates
354
408
 
355
- As commented, files within moduleroot directory can be flat files or ERB templates. These files have direct access to @configs hash, which gets values from config_defaults.yml file and from the module being processed:
409
+ As mentioned, files in the moduleroot directory must be ERB templates (they must have an .erb extension, or they will be ignored). These files have direct access to @configs hash, which gets values from config_defaults.yml file and from the module being processed:
356
410
 
357
- ```
411
+ ```erb
358
412
  <%= @configs[:git_base] %>
359
413
  <%= @configs[:namespace] %>
360
414
  <%= @configs[:puppet_module] %>
361
415
  ```
362
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
+
363
434
  The Templates
364
435
  -------------
365
436
 
data/Rakefile CHANGED
@@ -19,3 +19,4 @@ Cucumber::Rake::Task.new do |t|
19
19
  end
20
20
 
21
21
  task :test => %i[clean spec cucumber rubocop]
22
+ task :default => %i[test]
@@ -23,7 +23,7 @@ Given 'a remote module repository' do
23
23
  CONFIG
24
24
  end
25
25
 
26
- Given /a remote module repository with "(.+?)" as the default branch/ do |branch| # rubocop:disable Lint/AmbiguousRegexpLiteral
26
+ Given Regexp.new(/a remote module repository with "(.+?)" as the default branch/) do |branch|
27
27
  steps %(
28
28
  Given a directory named "sources"
29
29
  And I run `git clone --mirror https://github.com/maestrodev/puppet-test sources/puppet-test`
@@ -31,7 +31,7 @@ Feature: update
31
31
  Files added:
32
32
  test
33
33
  """
34
- Given I run `cat modules/puppet-test/test`
34
+ Given I run `cat modules/maestrodev/puppet-test/test`
35
35
  Then the output should contain "aruba"
36
36
 
37
37
  Scenario: Using skip_broken option and adding a new file to repo without write access
@@ -113,14 +113,14 @@ Feature: update
113
113
  Then the exit status should be 0
114
114
  And the output should match:
115
115
  """
116
- Warning: using './moduleroot//test' as template without '.erb' suffix
116
+ Warning: using './moduleroot/test' as template without '.erb' suffix
117
117
  """
118
118
  And the output should match:
119
119
  """
120
120
  Files added:
121
121
  test
122
122
  """
123
- Given I run `cat modules/puppet-test/test`
123
+ Given I run `cat modules/maestrodev/puppet-test/test`
124
124
  Then the output should contain "aruba"
125
125
 
126
126
  Scenario: Adding a new file using global values
@@ -153,7 +153,7 @@ Feature: update
153
153
  Files added:
154
154
  test
155
155
  """
156
- Given I run `cat modules/puppet-test/test`
156
+ Given I run `cat modules/maestrodev/puppet-test/test`
157
157
  Then the output should contain "aruba"
158
158
 
159
159
  Scenario: Adding a new file overriding global values
@@ -189,7 +189,7 @@ Feature: update
189
189
  Files added:
190
190
  test
191
191
  """
192
- Given I run `cat modules/puppet-test/test`
192
+ Given I run `cat modules/maestrodev/puppet-test/test`
193
193
  Then the output should contain "aruba"
194
194
 
195
195
  Scenario: Adding a new file ignoring global values
@@ -225,7 +225,7 @@ Feature: update
225
225
  Files added:
226
226
  test
227
227
  """
228
- Given I run `cat modules/puppet-test/test`
228
+ Given I run `cat modules/maestrodev/puppet-test/test`
229
229
  Then the output should contain "aruba"
230
230
 
231
231
  Scenario: Adding a file that ERB can't parse
@@ -342,7 +342,7 @@ Feature: update
342
342
  Files changed:
343
343
  +diff --git a/Gemfile b/Gemfile
344
344
  """
345
- Given I run `cat modules/puppet-test/Gemfile`
345
+ Given I run `cat modules/maestrodev/puppet-test/Gemfile`
346
346
  Then the output should contain:
347
347
  """
348
348
  source 'https://somehost.com'
@@ -405,7 +405,7 @@ Feature: update
405
405
  Not managing Gemfile in puppet-test
406
406
  """
407
407
  And the exit status should be 0
408
- Given I run `cat modules/puppet-test/Gemfile`
408
+ Given I run `cat modules/maestrodev/puppet-test/Gemfile`
409
409
  Then the output should contain:
410
410
  """
411
411
  source 'https://rubygems.org'
@@ -488,8 +488,8 @@ Feature: update
488
488
  """
489
489
  some spec_helper fud
490
490
  """
491
- And a directory named "modules/puppetlabs-apache/spec"
492
- And a file named "modules/puppetlabs-apache/spec/spec_helper.rb" with:
491
+ And a directory named "modules/puppetlabs/puppetlabs-apache/spec"
492
+ And a file named "modules/puppetlabs/puppetlabs-apache/spec/spec_helper.rb" with:
493
493
  """
494
494
  This is a fake spec_helper!
495
495
  """
@@ -499,7 +499,7 @@ Feature: update
499
499
  Not managing spec/spec_helper.rb in puppetlabs-apache
500
500
  """
501
501
  And the exit status should be 0
502
- Given I run `cat modules/puppetlabs-apache/spec/spec_helper.rb`
502
+ Given I run `cat modules/puppetlabs/puppetlabs-apache/spec/spec_helper.rb`
503
503
  Then the output should contain:
504
504
  """
505
505
  This is a fake spec_helper!
@@ -538,7 +538,7 @@ Feature: update
538
538
  Files added:
539
539
  spec/spec_helper.rb
540
540
  """
541
- Given I run `cat modules/puppet-test/spec/spec_helper.rb`
541
+ Given I run `cat modules/maestrodev/puppet-test/spec/spec_helper.rb`
542
542
  Then the output should contain:
543
543
  """
544
544
  require 'puppetlabs_spec_helper/module_helper'
@@ -577,7 +577,7 @@ Feature: update
577
577
  Given a file named "managed_modules.yml" with:
578
578
  """
579
579
  ---
580
- - puppet-test
580
+ - maestrodev/puppet-test
581
581
  """
582
582
  And a file named "modulesync.yml" with:
583
583
  """
@@ -597,8 +597,8 @@ Feature: update
597
597
  require '<%= required %>'
598
598
  <% end %>
599
599
  """
600
- Given I run `git init modules/puppet-test`
601
- Given a file named "modules/puppet-test/.git/config" with:
600
+ Given I run `git init modules/maestrodev/puppet-test`
601
+ Given a file named "modules/maestrodev/puppet-test/.git/config" with:
602
602
  """
603
603
  [core]
604
604
  repositoryformatversion = 0
@@ -667,7 +667,7 @@ Feature: update
667
667
  Files added:
668
668
  test
669
669
  """
670
- Given I run `cat modules/puppet-test/test`
670
+ Given I run `cat modules/maestrodev/puppet-test/test`
671
671
  Then the output should contain "aruba"
672
672
 
673
673
  Scenario: When specifying configurations in managed_modules.yml and using a filter
@@ -702,9 +702,9 @@ Feature: update
702
702
  Files added:
703
703
  test
704
704
  """
705
- Given I run `cat modules/puppet-test/test`
705
+ Given I run `cat modules/maestrodev/puppet-test/test`
706
706
  Then the output should contain "aruba"
707
- And a directory named "modules/puppet-blacksmith" should not exist
707
+ And a directory named "modules/maestrodev/puppet-blacksmith" should not exist
708
708
 
709
709
  Scenario: When specifying configurations in managed_modules.yml and using a negative filter
710
710
  Given a file named "managed_modules.yml" with:
@@ -738,15 +738,15 @@ Feature: update
738
738
  Files added:
739
739
  test
740
740
  """
741
- Given I run `cat modules/puppet-test/test`
741
+ Given I run `cat modules/maestrodev/puppet-test/test`
742
742
  Then the output should contain "aruba"
743
- And a directory named "modules/puppet-blacksmith" should not exist
743
+ And a directory named "modules/maestrodev/puppet-blacksmith" should not exist
744
744
 
745
745
  Scenario: Updating a module with a .sync.yml file
746
746
  Given a file named "managed_modules.yml" with:
747
747
  """
748
748
  ---
749
- - puppet-test
749
+ - maestrodev/puppet-test
750
750
  """
751
751
  And a file named "modulesync.yml" with:
752
752
  """
@@ -756,6 +756,9 @@ Feature: update
756
756
  And a file named "config_defaults.yml" with:
757
757
  """
758
758
  ---
759
+ :global:
760
+ global-default: some-default
761
+ global-to-overwrite: to-be-overwritten
759
762
  spec/spec_helper.rb:
760
763
  require:
761
764
  - puppetlabs_spec_helper/module_helper
@@ -766,8 +769,14 @@ Feature: update
766
769
  require '<%= required %>'
767
770
  <% end %>
768
771
  """
769
- Given I run `git init modules/puppet-test`
770
- Given a file named "modules/puppet-test/.git/config" with:
772
+ And a file named "moduleroot/global-test.md.erb" with:
773
+ """
774
+ <%= @configs['global-default'] %>
775
+ <%= @configs['global-to-overwrite'] %>
776
+ <%= @configs['module-default'] %>
777
+ """
778
+ Given I run `git init modules/maestrodev/puppet-test`
779
+ Given a file named "modules/maestrodev/puppet-test/.git/config" with:
771
780
  """
772
781
  [core]
773
782
  repositoryformatversion = 0
@@ -780,9 +789,12 @@ Feature: update
780
789
  url = https://github.com/maestrodev/puppet-test.git
781
790
  fetch = +refs/heads/*:refs/remotes/origin/*
782
791
  """
783
- Given a file named "modules/puppet-test/.sync.yml" with:
792
+ Given a file named "modules/maestrodev/puppet-test/.sync.yml" with:
784
793
  """
785
794
  ---
795
+ :global:
796
+ global-to-overwrite: it-is-overwritten
797
+ module-default: some-value
786
798
  spec/spec_helper.rb:
787
799
  unmanaged: true
788
800
  """
@@ -792,6 +804,13 @@ Feature: update
792
804
  """
793
805
  Not managing spec/spec_helper.rb in puppet-test
794
806
  """
807
+ Given I run `cat modules/maestrodev/puppet-test/global-test.md`
808
+ Then the output should match:
809
+ """
810
+ some-default
811
+ it-is-overwritten
812
+ some-value
813
+ """
795
814
 
796
815
  Scenario: Module with custom namespace
797
816
  Given a file named "managed_modules.yml" with:
@@ -824,9 +843,9 @@ Feature: update
824
843
  Files added:
825
844
  test
826
845
  """
827
- Given I run `cat modules/puppet-test/.git/config`
846
+ Given I run `cat modules/maestrodev/puppet-test/.git/config`
828
847
  Then the output should contain "url = https://github.com/maestrodev/puppet-test.git"
829
- Given I run `cat modules/puppet-lib-file_concat/.git/config`
848
+ Given I run `cat modules/electrical/puppet-lib-file_concat/.git/config`
830
849
  Then the output should contain "url = https://github.com/electrical/puppet-lib-file_concat.git"
831
850
 
832
851
  Scenario: Modifying an existing file with values exposed by the module
@@ -858,7 +877,7 @@ Feature: update
858
877
  Files changed:
859
878
  +diff --git a/README.md b/README.md
860
879
  """
861
- Given I run `cat modules/puppet-test/README.md`
880
+ Given I run `cat modules/maestrodev/puppet-test/README.md`
862
881
  Then the output should contain:
863
882
  """
864
883
  echo 'https://github.com/maestrodev'
@@ -903,3 +922,36 @@ Feature: update
903
922
  When I run `msync update -m "Update Gemfile"`
904
923
  Then the exit status should be 0
905
924
  Then the output should contain "Using repository's default branch: develop"
925
+
926
+ Scenario: Adding a new file from a template using meta data
927
+ And a file named "config_defaults.yml" with:
928
+ """
929
+ ---
930
+ """
931
+ Given a file named "managed_modules.yml" with:
932
+ """
933
+ ---
934
+ - puppet-test
935
+ """
936
+ And a file named "modulesync.yml" with:
937
+ """
938
+ ---
939
+ namespace: maestrodev
940
+ git_base: https://github.com/
941
+ """
942
+ And a directory named "moduleroot"
943
+ And a file named "moduleroot/test.erb" with:
944
+ """
945
+ module: <%= @metadata[:module_name] %>
946
+ target: <%= @metadata[:target_file] %>
947
+ workdir: <%= @metadata[:workdir] %>
948
+ """
949
+ When I run `msync update --noop`
950
+ Then the exit status should be 0
951
+ Given I run `cat modules/maestrodev/puppet-test/test`
952
+ Then the output should contain:
953
+ """
954
+ module: puppet-test
955
+ target: modules/maestrodev/puppet-test/test
956
+ workdir: modules/maestrodev/puppet-test
957
+ """