modulesync 0.8.2 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9799ba2b483f6370a71e6787b21862cf6aeab0246f1b7896be48175c37564db3
4
- data.tar.gz: fccd8279e58613ac070d05175bce1a9b0f4afc292ffac78c347f343518434bc3
3
+ metadata.gz: 2442835e7b5da17cc633790e9e4a2a3fe38c0a1b4d3fbd75ee8f60b6948ddc75
4
+ data.tar.gz: 0f0c8f284f95824e469759582db8188b37c8c8d7247f463dc9877e973887fcac
5
5
  SHA512:
6
- metadata.gz: f4f4e927a0d4df8a95859c23319cb395f3418ecd0fa4dadc5c9a68209dcc767bc821b71dd2206fa4b6c482a65464940803a2958849cd1a991276342490356351
7
- data.tar.gz: c5cee9698af0bea865f69f5bed772db3a881e339e7a6626c6be70968c02568de8a5899c3dcebc3cfc3620f66fe51a65fa1b6887f2d929ac56bdf66a5dab59a82
6
+ metadata.gz: 521392847ed7f191f9ef9bb6a0c26d80fb7c557b882f092bec29834311af6c10a2e0bd5db2d1be162996fbfbcccfd5f9ac1063268b6480aa95c867802e9b48b3
7
+ data.tar.gz: b3ddc00ba28e2d5043cb0e24d3448c35ca84f3d42a4263de4efa8513f7c38d02ca2324289a2b15d2a5c84435a3329de76acccfae8da2da6f1df31d60553cdc77
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
@@ -25,11 +25,6 @@ Metrics/ClassLength:
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:
@@ -3,16 +3,16 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  dist: trusty
6
- before_install:
7
- - gem update --system
8
- - gem install bundler
9
6
  script: 'bundle exec rake test'
10
7
  rvm:
11
8
  - 2.0
12
- - 2.1.9
13
- - 2.2.6
14
- - 2.3.3
15
- - 2.4.0
9
+ - 2.1
10
+ - 2.2
11
+ - 2.3
12
+ - 2.4
13
+ - 2.5
14
+ - 2.6
15
+ - 2.7
16
16
  notifications:
17
17
  email: false
18
18
  deploy:
@@ -21,7 +21,7 @@ deploy:
21
21
  secure: "Tbf1EbLEobIIox+fftJZADZsfQQ6kl0urcMNetK7NJzFo/negD/WyJIUj3kro/B7buyYADEjTui/JR4o8EPbugfM3ie5vYOd5k3AesSzbdr4BSwGe/cGbGOB7/PZuGfFLkb94/FiCU2mIwibkbh1rHWGlBoPj7ntL0+5ZtdvsM4="
22
22
  gem: modulesync
23
23
  on:
24
- rvm: 2.4.0
24
+ rvm: 2.7
25
25
  tags: true
26
26
  all_branches: true
27
27
  repo: voxpupuli/modulesync
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 2020-07-03 - 1.2.0
4
+
5
+ Add support for GitLab merge requests (MRs) [#175](https://github.com/voxpupuli/modulesync/pull/175)
6
+
7
+ ## 2020-05-01 - 1.1.0
8
+
9
+ 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.
10
+
11
+ * Add metadata to ERB template scope - [#168](https://github.com/voxpupuli/modulesync/pull/168)
12
+ * Skip issuing a PR if one already exists for -b option - [#171](https://github.com/voxpupuli/modulesync/pull/171)
13
+ * Correct the type on the pr-labels option to prevent a deprecation warning - [#173](https://github.com/voxpupuli/modulesync/pull/173)
14
+
15
+ ## 2019-09-19 - 1.0.0
16
+
17
+ This is the first stable release! 🎉
18
+
19
+ * Use namespace in directory structure when cloning repositories - [#152](https://github.com/voxpupuli/modulesync/pull/152)
20
+ * Fix minor typo in help output - [#165](https://github.com/voxpupuli/modulesync/pull/165)
21
+ * Small improvements and fixes - [#166](https://github.com/voxpupuli/modulesync/pull/166)
22
+ * Fix overwriting of :global values - [#169](https://github.com/voxpupuli/modulesync/pull/169)
23
+
24
+ ## 2018-12-27 - 0.10.0
25
+
26
+ This is another awesome release!
27
+
28
+ * Add support to submit PRs to GitHub when changes are pushed - [#147](https://github.com/voxpupuli/modulesync/pull/147)
29
+ * Fix "flat files" still mentioned in README - [#151](https://github.com/voxpupuli/modulesync/pull/151)
30
+
31
+ ## 2018-02-15 - 0.9.0
32
+
33
+ ## Summary
34
+
35
+ This is an awesome release - Now honors the repo default branch[#142](https://github.com/voxpupuli/modulesync/pull/142)
36
+
37
+ ### Bugfixes
38
+
39
+ * Monkey patch ls_files until ruby-git/ruby-git#320 is resolved
40
+ * Reraise exception rather than exit so we can rescue a derived StandardError when using skip_broken option
41
+
42
+ ### Enhancements
43
+
44
+ * Add new option to produce a failure exit code on warnings
45
+ * Remove hard coding of managed_modules.yml which means that options passed to ModuleSync.update can override the filename
46
+
3
47
  ## 2017-11-03 - 0.8.2
4
48
 
5
49
  ### Summary
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
1
  source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'cucumber', '< 3.0' if RUBY_VERSION < '2.1'
6
+ gem 'octokit', '~> 4.9'
data/README.md CHANGED
@@ -176,6 +176,30 @@ 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
+ You must set the `GITHUB_TOKEN` or `GITLAB_TOKEN` environment variable
189
+ for GitHub PRs or GitLab MRs to work. Additional options:
190
+
191
+ * Set the PR/MR title with `--pr-title` or in `modulesync.yml` with the
192
+ `pr_title` attribute.
193
+ * Assign labels to the PR/MR with `--pr-labels` or in `modulesync.yml` with
194
+ the `pr_labels` attribute. **NOTE:** `pr_labels` should be a list. When
195
+ using the `--pr-labels` CLI option, you should use a comma separated list.
196
+
197
+ For GitHub Enterprise and self-hosted GitLab instances you need to set the
198
+ `GITHUB_BASE_URL` or `GITLAB_BASE_URL` environment variable in addition.
199
+ More details for GitHub:
200
+
201
+ * Octokit [`api_endpoint`](https://github.com/octokit/octokit.rb#interacting-with-the-githubcom-apis-in-github-enterprise)
202
+
179
203
  ### Using Forks and Non-master branches
180
204
 
181
205
  The default functionality is to run ModuleSync on the puppetlabs modules, but
@@ -215,7 +239,7 @@ probably seems excessive. You can create a file called modulesync.yml in the
215
239
  configuration directory that provides these arguments automatically. This file
216
240
  has a form such as:
217
241
 
218
- ```
242
+ ```yaml
219
243
  ---
220
244
  namespace: mygithubusername
221
245
  branch: modulesyncbranch
@@ -230,26 +254,33 @@ msync update -m "Commit message"
230
254
 
231
255
  Available parameters for modulesync.yml
232
256
 
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')
257
+ * `git_base` : The default URL to git clone from (Default: 'git@github.com:')
258
+ * `namespace` : Namespace of the projects to manage (Default: 'puppetlabs')
259
+ * `branch` : Branch to push to (Default: 'master')
260
+ * `remote_branch` : Remote branch to push to (Default: Same value as branch)
261
+ * `message` : Commit message to apply to updated modules.
262
+ * `pre_commit_script` : A script to be run before commiting (e.g. 'contrib/myfooscript.sh')
263
+ * `pr_title` : The title to use when submitting PRs/MRs to GitHub or GitLab.
264
+ * `pr_labels` : A list of labels to assign PRs/MRs created on GitHub or GitLab.
239
265
 
240
266
  ##### Example
241
267
 
242
- ###### Github
268
+ ###### GitHub
243
269
 
244
- ```
270
+ ```yaml
245
271
  ---
246
272
  namespace: MySuperOrganization
247
273
  branch: modulesyncbranch
274
+ pr_title: "Updates to module template files via modulesync"
275
+ pr_labels:
276
+ - TOOLING
277
+ - MAINTENANCE
278
+ - MODULESYNC
248
279
  ```
249
280
 
250
- ###### Gitlab
281
+ ###### GitLab
251
282
 
252
- ```
283
+ ```yaml
253
284
  ---
254
285
  git_base: 'user@gitlab.example.com:'
255
286
  namespace: MySuperOrganization
@@ -258,7 +289,7 @@ branch: modulesyncbranch
258
289
 
259
290
  ###### Gerrit
260
291
 
261
- ```
292
+ ```yaml
262
293
  ---
263
294
  namespace: stackforge
264
295
  git_base: ssh://jdoe@review.openstack.org:29418/
@@ -350,16 +381,33 @@ current date, bumped (minor) version, and commit message.
350
381
  If `CHANGELOG.md` is absent in the repository, nothing will happen.
351
382
 
352
383
 
353
- #### Defining templates
384
+ #### Working with templates
354
385
 
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:
386
+ 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
387
 
357
- ```
388
+ ```erb
358
389
  <%= @configs[:git_base] %>
359
390
  <%= @configs[:namespace] %>
360
391
  <%= @configs[:puppet_module] %>
361
392
  ```
362
393
 
394
+ Alternatively some meta data is passed to the template. This will allow you to add custom Ruby extensions inside the
395
+ template, reading other files from the module, to make the template system more adaptive.
396
+
397
+ ```erb
398
+ module: <%= @metadata[:module_name] %>
399
+ target: <%= @metadata[:target_file] %>
400
+ workdir: <%= @metadata[:workdir] %>
401
+ ```
402
+
403
+ Will result in something like:
404
+
405
+ ```
406
+ module: puppet-test
407
+ target: modules/github-org/puppet-test/test
408
+ workdir: modules/github-org/puppet-test
409
+ ```
410
+
363
411
  The Templates
364
412
  -------------
365
413
 
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]
@@ -22,3 +22,26 @@ Given 'a remote module repository' do
22
22
  git_base: file://#{expand_path('.')}/
23
23
  CONFIG
24
24
  end
25
+
26
+ Given Regexp.new(/a remote module repository with "(.+?)" as the default branch/) do |branch|
27
+ steps %(
28
+ Given a directory named "sources"
29
+ And I run `git clone --mirror https://github.com/maestrodev/puppet-test sources/puppet-test`
30
+ And a file named "managed_modules.yml" with:
31
+ """
32
+ ---
33
+ - puppet-test
34
+ """
35
+ )
36
+ write_file('modulesync.yml', <<-CONFIG)
37
+ ---
38
+ namespace: sources
39
+ git_base: file://#{expand_path('.')}/
40
+ CONFIG
41
+ cd('sources/puppet-test') do
42
+ steps %(
43
+ And I run `git branch -M master #{branch}`
44
+ And I run `git symbolic-ref HEAD refs/heads/#{branch}`
45
+ )
46
+ end
47
+ end
@@ -31,9 +31,35 @@ 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
+ Scenario: Using skip_broken option and adding a new file to repo without write access
38
+ Given a file named "managed_modules.yml" with:
39
+ """
40
+ ---
41
+ - puppet-test
42
+ """
43
+ And a file named "modulesync.yml" with:
44
+ """
45
+ ---
46
+ namespace: maestrodev
47
+ git_base: 'git@github.com:'
48
+ """
49
+ And a file named "config_defaults.yml" with:
50
+ """
51
+ ---
52
+ test:
53
+ name: aruba
54
+ """
55
+ And a directory named "moduleroot"
56
+ And a file named "moduleroot/test.erb" with:
57
+ """
58
+ <%= @configs['name'] %>
59
+ """
60
+ When I run `msync update -s -m "Add test"`
61
+ Then the exit status should be 0
62
+
37
63
  Scenario: Adding a new file to repo without write access
38
64
  Given a file named "managed_modules.yml" with:
39
65
  """
@@ -44,7 +70,7 @@ Feature: update
44
70
  """
45
71
  ---
46
72
  namespace: maestrodev
47
- git_base: git@github.com:
73
+ git_base: 'git@github.com:'
48
74
  """
49
75
  And a file named "config_defaults.yml" with:
50
76
  """
@@ -87,14 +113,14 @@ Feature: update
87
113
  Then the exit status should be 0
88
114
  And the output should match:
89
115
  """
90
- Warning: using './moduleroot//test' as template without '.erb' suffix
116
+ Warning: using './moduleroot/test' as template without '.erb' suffix
91
117
  """
92
118
  And the output should match:
93
119
  """
94
120
  Files added:
95
121
  test
96
122
  """
97
- Given I run `cat modules/puppet-test/test`
123
+ Given I run `cat modules/maestrodev/puppet-test/test`
98
124
  Then the output should contain "aruba"
99
125
 
100
126
  Scenario: Adding a new file using global values
@@ -127,7 +153,7 @@ Feature: update
127
153
  Files added:
128
154
  test
129
155
  """
130
- Given I run `cat modules/puppet-test/test`
156
+ Given I run `cat modules/maestrodev/puppet-test/test`
131
157
  Then the output should contain "aruba"
132
158
 
133
159
  Scenario: Adding a new file overriding global values
@@ -163,7 +189,7 @@ Feature: update
163
189
  Files added:
164
190
  test
165
191
  """
166
- Given I run `cat modules/puppet-test/test`
192
+ Given I run `cat modules/maestrodev/puppet-test/test`
167
193
  Then the output should contain "aruba"
168
194
 
169
195
  Scenario: Adding a new file ignoring global values
@@ -199,7 +225,7 @@ Feature: update
199
225
  Files added:
200
226
  test
201
227
  """
202
- Given I run `cat modules/puppet-test/test`
228
+ Given I run `cat modules/maestrodev/puppet-test/test`
203
229
  Then the output should contain "aruba"
204
230
 
205
231
  Scenario: Adding a file that ERB can't parse
@@ -258,6 +284,34 @@ Feature: update
258
284
  When I run `msync update --noop -s`
259
285
  Then the exit status should be 0
260
286
 
287
+ Scenario: Using skip_broken and fail_on_warnings options with invalid files
288
+ Given a file named "managed_modules.yml" with:
289
+ """
290
+ ---
291
+ - puppet-test
292
+ """
293
+ And a file named "modulesync.yml" with:
294
+ """
295
+ ---
296
+ namespace: maestrodev
297
+ git_base: https://github.com/
298
+ """
299
+ And a file named "config_defaults.yml" with:
300
+ """
301
+ ---
302
+ test:
303
+ name: aruba
304
+ """
305
+ And a directory named "moduleroot"
306
+ And a file named "moduleroot/test.erb" with:
307
+ """
308
+ <% @configs.each do |c| -%>
309
+ <%= c['name'] %>
310
+ <% end %>
311
+ """
312
+ When I run `msync update --noop --skip_broken --fail_on_warnings`
313
+ Then the exit status should be 1
314
+
261
315
  Scenario: Modifying an existing file
262
316
  Given a file named "managed_modules.yml" with:
263
317
  """
@@ -288,7 +342,7 @@ Feature: update
288
342
  Files changed:
289
343
  +diff --git a/Gemfile b/Gemfile
290
344
  """
291
- Given I run `cat modules/puppet-test/Gemfile`
345
+ Given I run `cat modules/maestrodev/puppet-test/Gemfile`
292
346
  Then the output should contain:
293
347
  """
294
348
  source 'https://somehost.com'
@@ -351,7 +405,7 @@ Feature: update
351
405
  Not managing Gemfile in puppet-test
352
406
  """
353
407
  And the exit status should be 0
354
- Given I run `cat modules/puppet-test/Gemfile`
408
+ Given I run `cat modules/maestrodev/puppet-test/Gemfile`
355
409
  Then the output should contain:
356
410
  """
357
411
  source 'https://rubygems.org'
@@ -434,8 +488,8 @@ Feature: update
434
488
  """
435
489
  some spec_helper fud
436
490
  """
437
- And a directory named "modules/puppetlabs-apache/spec"
438
- 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:
439
493
  """
440
494
  This is a fake spec_helper!
441
495
  """
@@ -445,7 +499,7 @@ Feature: update
445
499
  Not managing spec/spec_helper.rb in puppetlabs-apache
446
500
  """
447
501
  And the exit status should be 0
448
- Given I run `cat modules/puppetlabs-apache/spec/spec_helper.rb`
502
+ Given I run `cat modules/puppetlabs/puppetlabs-apache/spec/spec_helper.rb`
449
503
  Then the output should contain:
450
504
  """
451
505
  This is a fake spec_helper!
@@ -484,7 +538,7 @@ Feature: update
484
538
  Files added:
485
539
  spec/spec_helper.rb
486
540
  """
487
- Given I run `cat modules/puppet-test/spec/spec_helper.rb`
541
+ Given I run `cat modules/maestrodev/puppet-test/spec/spec_helper.rb`
488
542
  Then the output should contain:
489
543
  """
490
544
  require 'puppetlabs_spec_helper/module_helper'
@@ -523,7 +577,7 @@ Feature: update
523
577
  Given a file named "managed_modules.yml" with:
524
578
  """
525
579
  ---
526
- - puppet-test
580
+ - maestrodev/puppet-test
527
581
  """
528
582
  And a file named "modulesync.yml" with:
529
583
  """
@@ -543,8 +597,8 @@ Feature: update
543
597
  require '<%= required %>'
544
598
  <% end %>
545
599
  """
546
- Given I run `git init modules/puppet-test`
547
- 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:
548
602
  """
549
603
  [core]
550
604
  repositoryformatversion = 0
@@ -613,7 +667,7 @@ Feature: update
613
667
  Files added:
614
668
  test
615
669
  """
616
- Given I run `cat modules/puppet-test/test`
670
+ Given I run `cat modules/maestrodev/puppet-test/test`
617
671
  Then the output should contain "aruba"
618
672
 
619
673
  Scenario: When specifying configurations in managed_modules.yml and using a filter
@@ -648,9 +702,9 @@ Feature: update
648
702
  Files added:
649
703
  test
650
704
  """
651
- Given I run `cat modules/puppet-test/test`
705
+ Given I run `cat modules/maestrodev/puppet-test/test`
652
706
  Then the output should contain "aruba"
653
- And a directory named "modules/puppet-blacksmith" should not exist
707
+ And a directory named "modules/maestrodev/puppet-blacksmith" should not exist
654
708
 
655
709
  Scenario: When specifying configurations in managed_modules.yml and using a negative filter
656
710
  Given a file named "managed_modules.yml" with:
@@ -684,15 +738,15 @@ Feature: update
684
738
  Files added:
685
739
  test
686
740
  """
687
- Given I run `cat modules/puppet-test/test`
741
+ Given I run `cat modules/maestrodev/puppet-test/test`
688
742
  Then the output should contain "aruba"
689
- And a directory named "modules/puppet-blacksmith" should not exist
743
+ And a directory named "modules/maestrodev/puppet-blacksmith" should not exist
690
744
 
691
745
  Scenario: Updating a module with a .sync.yml file
692
746
  Given a file named "managed_modules.yml" with:
693
747
  """
694
748
  ---
695
- - puppet-test
749
+ - maestrodev/puppet-test
696
750
  """
697
751
  And a file named "modulesync.yml" with:
698
752
  """
@@ -702,6 +756,9 @@ Feature: update
702
756
  And a file named "config_defaults.yml" with:
703
757
  """
704
758
  ---
759
+ :global:
760
+ global-default: some-default
761
+ global-to-overwrite: to-be-overwritten
705
762
  spec/spec_helper.rb:
706
763
  require:
707
764
  - puppetlabs_spec_helper/module_helper
@@ -712,8 +769,14 @@ Feature: update
712
769
  require '<%= required %>'
713
770
  <% end %>
714
771
  """
715
- Given I run `git init modules/puppet-test`
716
- 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:
717
780
  """
718
781
  [core]
719
782
  repositoryformatversion = 0
@@ -726,9 +789,12 @@ Feature: update
726
789
  url = https://github.com/maestrodev/puppet-test.git
727
790
  fetch = +refs/heads/*:refs/remotes/origin/*
728
791
  """
729
- Given a file named "modules/puppet-test/.sync.yml" with:
792
+ Given a file named "modules/maestrodev/puppet-test/.sync.yml" with:
730
793
  """
731
794
  ---
795
+ :global:
796
+ global-to-overwrite: it-is-overwritten
797
+ module-default: some-value
732
798
  spec/spec_helper.rb:
733
799
  unmanaged: true
734
800
  """
@@ -738,6 +804,13 @@ Feature: update
738
804
  """
739
805
  Not managing spec/spec_helper.rb in puppet-test
740
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
+ """
741
814
 
742
815
  Scenario: Module with custom namespace
743
816
  Given a file named "managed_modules.yml" with:
@@ -770,9 +843,9 @@ Feature: update
770
843
  Files added:
771
844
  test
772
845
  """
773
- Given I run `cat modules/puppet-test/.git/config`
846
+ Given I run `cat modules/maestrodev/puppet-test/.git/config`
774
847
  Then the output should contain "url = https://github.com/maestrodev/puppet-test.git"
775
- Given I run `cat modules/puppet-lib-file_concat/.git/config`
848
+ Given I run `cat modules/electrical/puppet-lib-file_concat/.git/config`
776
849
  Then the output should contain "url = https://github.com/electrical/puppet-lib-file_concat.git"
777
850
 
778
851
  Scenario: Modifying an existing file with values exposed by the module
@@ -804,7 +877,7 @@ Feature: update
804
877
  Files changed:
805
878
  +diff --git a/README.md b/README.md
806
879
  """
807
- Given I run `cat modules/puppet-test/README.md`
880
+ Given I run `cat modules/maestrodev/puppet-test/README.md`
808
881
  Then the output should contain:
809
882
  """
810
883
  echo 'https://github.com/maestrodev'
@@ -831,3 +904,54 @@ Feature: update
831
904
  Then the exit status should be 0
832
905
  Then the output should not contain "error"
833
906
  Then the output should not contain "rejected"
907
+
908
+ Scenario: Repository with a default branch other than master
909
+ Given a mocked git configuration
910
+ And a remote module repository with "develop" as the default branch
911
+ And a file named "config_defaults.yml" with:
912
+ """
913
+ ---
914
+ Gemfile:
915
+ gem_source: https://somehost.com
916
+ """
917
+ And a directory named "moduleroot"
918
+ And a file named "moduleroot/Gemfile.erb" with:
919
+ """
920
+ source '<%= @configs['gem_source'] %>'
921
+ """
922
+ When I run `msync update -m "Update Gemfile"`
923
+ Then the exit status should be 0
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
+ """