modulesync 0.8.0 → 0.8.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
  SHA1:
3
- metadata.gz: 68055a15d6cb04e09aa817ca80d02daaa18d871e
4
- data.tar.gz: 734cb292972fb267ed1e5139caf970d8a5678d2e
3
+ metadata.gz: b5fca884c7267a718852233b170a0c69c6e39499
4
+ data.tar.gz: 28dae495ca5daa3b95f0d1d4d3a2b9c9710192f1
5
5
  SHA512:
6
- metadata.gz: 2eed0ed67ad09ac3a2fe29e7d0acb516c7f07cd6626a9d1390258aa8ca18653f1c8744ed84a1107753855eb7557f52e45404fead5012b198119deb2ef3f5eb8e
7
- data.tar.gz: 6530399b6eebe0c779c41995f39a7e4e3d2fab6a562a525b02b05e76ae75a7df885e8822f9b30bfdc2b9ee2c46b15fa4d0ee069012ef9e6773335521887c11d6
6
+ metadata.gz: 9846cea6b1f68664a63a292edcadf2d7fa5ad4c27b1527e58938e1757a909955b1644bfe977e618d0812779d3b62c29b439a51c069f027f4a190b214d18c96e3
7
+ data.tar.gz: 98d64c9912a93f34fa1630a999b82d1f7c25267dbe67756152e85a54b781d3c40016bb24d4c359f3fe61be40c41661a21111985458b0eee62d64539433895604
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 2017-05-08 - 0.8.1
4
+
5
+ ### Summary
6
+
7
+ 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.
8
+
3
9
  ## 2017-05-05 - 0.8.0
4
10
 
5
11
  ### Summary
data/README.md CHANGED
@@ -27,7 +27,7 @@ Puppet Labs module engineers manage the zoo of Puppet modules on GitHub, and
27
27
  has now been restructured and generalized to be used within other
28
28
  organizations. Puppet modules within an organization tend to have a number of
29
29
  meta-files that are identical or very similar between modules, such as the
30
- `Gemfile`, `.travis.yml`, `.gitignore`, or `spec\_helper.rb`. If a file needs to
30
+ `Gemfile`, `.travis.yml`, `.gitignore`, or `spec_helper.rb`. If a file needs to
31
31
  change in one module, it likely needs to change in the same way in every other
32
32
  module that the organization manages.
33
33
 
@@ -57,12 +57,12 @@ ModuleSync is a gem that uses the GitHub workflow to clone, update, and push mod
57
57
  repositories. It expects to be activated from a directory containing
58
58
  configuration for modulesync and the modules, or you can pass it the location
59
59
  of this configuration directory. [The configuration for the Puppet Labs
60
- modules](https://github.com/puppetlabs/modulesync\_configs), can be used as an
60
+ modules](https://github.com/puppetlabs/modulesync_configs), can be used as an
61
61
  example for your own configuration. The configuration directory contains a
62
62
  directory called moduleroot which mirrors the structure of a module. The files
63
63
  in the moduleroot are ERB templates, and MUST be named after the target file,
64
64
  with `.erb.` appended. The templates are
65
- rendered using values from a file called `config\_defaults.yml` in the root (not
65
+ rendered using values from a file called `config_defaults.yml` in the root (not
66
66
  moduleroot) of the configuration directory. The default values can be
67
67
  overridden or extended by adding a file called `.sync.yml` to the module itself.
68
68
  This allows us to, for example, have a set of "required" gems that are added
@@ -72,7 +72,7 @@ Within the templates, values can be accessed in the `@configs` hash, which is
72
72
  merged from the values under the keys `:global` and the target file name (no
73
73
  `.erb` suffix).
74
74
 
75
- The list of modules to manage is in `managed\_modules.yml` in the configuration
75
+ The list of modules to manage is in `managed_modules.yml` in the configuration
76
76
  directory. This lists just the names of the modules to be managed.
77
77
 
78
78
  ModuleSync can be called from the command line with parameters to change the
@@ -234,7 +234,8 @@ Available parameters for modulesync.yml
234
234
  * namespace : Namespace of the projects to manage (Default: 'puppetlabs')
235
235
  * branch : Branch to push to (Default: 'master')
236
236
  * remote_branch : Remote branch to push to (Default: Same value as branch)
237
- * pre_commit_script : A script to be run before commiting (ie. contrib/myfooscript.sh)
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')
238
239
 
239
240
  ##### Example
240
241
 
data/features/cli.feature CHANGED
@@ -16,3 +16,20 @@ Feature: CLI
16
16
  Scenario: When running the help subcommand
17
17
  When I run `msync help`
18
18
  And the output should match /Commands:/
19
+
20
+ Scenario: When overriding a setting from the config file on the command line
21
+ Given a file named "managed_modules.yml" with:
22
+ """
23
+ ---
24
+ - puppet-test
25
+ """
26
+ And a file named "modulesync.yml" with:
27
+ """
28
+ ---
29
+ namespace: maestrodev
30
+ git_base: 'git@github.com:'
31
+ """
32
+ And a directory named "moduleroot"
33
+ When I run `msync update --noop --git-base https://github.com/`
34
+ Then the exit status should be 0
35
+ And the output should not match /git@github.com:/
@@ -5,9 +5,18 @@ require 'modulesync/util'
5
5
 
6
6
  module ModuleSync
7
7
  class CLI
8
+ def self.defaults
9
+ @defaults ||= Util.symbolize_keys(Util.parse_config(Constants::MODULESYNC_CONF_FILE))
10
+ end
11
+
8
12
  class Hook < Thor
9
- class_option :project_root, :aliases => '-c', :desc => 'Path used by git to clone modules into. Defaults to "modules"', :default => 'modules'
10
- class_option :hook_args, :aliases => '-a', :desc => 'Arguments to pass to msync in the git hook'
13
+ class_option :project_root,
14
+ :aliases => '-c',
15
+ :desc => 'Path used by git to clone modules into. Defaults to "modules"',
16
+ :default => CLI.defaults[:project_root] || 'modules'
17
+ class_option :hook_args,
18
+ :aliases => '-a',
19
+ :desc => 'Arguments to pass to msync in the git hook'
11
20
 
12
21
  desc 'activate', 'Activate the git hook.'
13
22
  def activate
@@ -25,32 +34,81 @@ module ModuleSync
25
34
  end
26
35
 
27
36
  class Base < Thor
28
- include Constants
29
-
30
- class_option :project_root, :aliases => '-c', :desc => 'Path used by git to clone modules into. Defaults to "modules"', :default => 'modules'
31
- class_option :git_base, :desc => 'Specify the base part of a git URL to pull from', :default => 'git@github.com:'
32
- class_option :namespace, :aliases => '-n', :desc => 'Remote github namespace (user or organization) to clone from and push to. Defaults to puppetlabs', :default => 'puppetlabs'
33
- class_option :filter, :aliases => '-f', :desc => 'A regular expression to select repositories to update.'
34
- class_option :negative_filter, :aliases => '-x', :desc => 'A regular expression to skip repositories.'
35
- class_option :branch, :aliases => '-b', :desc => 'Branch name to make the changes in. Defaults to master.', :default => 'master'
37
+ class_option :project_root,
38
+ :aliases => '-c',
39
+ :desc => 'Path used by git to clone modules into. Defaults to "modules"',
40
+ :default => CLI.defaults[:project_root] || 'modules'
41
+ class_option :git_base,
42
+ :desc => 'Specify the base part of a git URL to pull from',
43
+ :default => CLI.defaults[:git_base] || 'git@github.com:'
44
+ class_option :namespace,
45
+ :aliases => '-n',
46
+ :desc => 'Remote github namespace (user or organization) to clone from and push to. Defaults to puppetlabs',
47
+ :default => CLI.defaults[:namespace] || 'puppetlabs'
48
+ class_option :filter,
49
+ :aliases => '-f',
50
+ :desc => 'A regular expression to select repositories to update.'
51
+ class_option :negative_filter,
52
+ :aliases => '-x',
53
+ :desc => 'A regular expression to skip repositories.'
54
+ class_option :branch,
55
+ :aliases => '-b',
56
+ :desc => 'Branch name to make the changes in. Defaults to master.',
57
+ :default => CLI.defaults[:branch] || 'master'
36
58
 
37
59
  desc 'update', 'Update the modules in managed_modules.yml'
38
- option :message, :aliases => '-m', :desc => 'Commit message to apply to updated modules. Required unless running in noop mode.'
39
- option :configs, :aliases => '-c', :desc => 'The local directory or remote repository to define the list of managed modules, the file templates, and the default values for template variables.'
40
- option :remote_branch, :aliases => '-r', :desc => 'Remote branch name to push the changes to. Defaults to the branch name.'
41
- option :skip_broken, :type => :boolean, :aliases => '-s', :desc => 'Process remaining modules if an error is found', :default => false
42
- option :amend, :type => :boolean, :desc => 'Amend previous commit', :default => false
43
- option :force, :type => :boolean, :desc => 'Force push amended commit', :default => false
44
- option :noop, :type => :boolean, :desc => 'No-op mode', :default => false
45
- option :offline, :type => :boolean, :desc => 'Do not run any Git commands. Allows the user to manage Git outside of ModuleSync.', :default => false
46
- option :bump, :type => :boolean, :desc => 'Bump module version to the next minor', :default => false
47
- option :changelog, :type => :boolean, :desc => 'Update CHANGELOG.md if version was bumped', :default => false
48
- option :tag, :type => :boolean, :desc => 'Git tag with the current module version', :default => false
49
- option :tag_pattern, :desc => 'The pattern to use when tagging releases.'
60
+ option :message,
61
+ :aliases => '-m',
62
+ :desc => 'Commit message to apply to updated modules. Required unless running in noop mode.',
63
+ :default => CLI.defaults[:message]
64
+ option :configs,
65
+ :aliases => '-c',
66
+ :desc => 'The local directory or remote repository to define the list of managed modules, the file templates, and the default values for template variables.'
67
+ option :remote_branch,
68
+ :aliases => '-r',
69
+ :desc => 'Remote branch name to push the changes to. Defaults to the branch name.',
70
+ :default => CLI.defaults[:remote_branch]
71
+ option :skip_broken,
72
+ :type => :boolean,
73
+ :aliases => '-s',
74
+ :desc => 'Process remaining modules if an error is found',
75
+ :default => false
76
+ option :amend,
77
+ :type => :boolean,
78
+ :desc => 'Amend previous commit',
79
+ :default => false
80
+ option :force,
81
+ :type => :boolean,
82
+ :desc => 'Force push amended commit',
83
+ :default => false
84
+ option :noop,
85
+ :type => :boolean,
86
+ :desc => 'No-op mode',
87
+ :default => false
88
+ option :offline,
89
+ :type => :boolean,
90
+ :desc => 'Do not run any Git commands. Allows the user to manage Git outside of ModuleSync.',
91
+ :default => false
92
+ option :bump,
93
+ :type => :boolean,
94
+ :desc => 'Bump module version to the next minor',
95
+ :default => false
96
+ option :changelog,
97
+ :type => :boolean,
98
+ :desc => 'Update CHANGELOG.md if version was bumped',
99
+ :default => false
100
+ option :tag,
101
+ :type => :boolean,
102
+ :desc => 'Git tag with the current module version',
103
+ :default => false
104
+ option :tag_pattern,
105
+ :desc => 'The pattern to use when tagging releases.'
106
+ option :pre_commit_script,
107
+ :desc => 'A script to be run before commiting',
108
+ :default => CLI.defaults[:pre_commit_script]
50
109
 
51
110
  def update
52
111
  config = { :command => 'update' }.merge(options)
53
- config.merge!(Util.parse_config(MODULESYNC_CONF_FILE))
54
112
  config = Util.symbolize_keys(config)
55
113
  raise Thor::Error, 'No value provided for required option "--message"' unless config[:noop] || config[:message] || config[:offline]
56
114
  config[:git_opts] = { 'amend' => config[:amend], 'force' => config[:force] }
data/modulesync.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'modulesync'
8
- spec.version = '0.8.0'
8
+ spec.version = '0.8.1'
9
9
  spec.authors = ['Vox Pupuli']
10
10
  spec.email = ['voxpupuli@groups.io']
11
11
  spec.summary = 'Puppet Module Synchronizer'
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.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-05 00:00:00.000000000 Z
11
+ date: 2017-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba