puppetfile_editor 1.0.0 → 1.1.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: 1aa03506290047e4f702b9511a949ecf5e9fecb97b09a3637fee1176049530fb
4
- data.tar.gz: 1542a0a8a403612ccaceaecd6ab39080be93544fa310cc6611cb87f520c97714
3
+ metadata.gz: 3a347a0fee5e0a6c168996c2ff509d9af68ee1995638c35bc13d4d903a8d5093
4
+ data.tar.gz: 3dc080184ab3152eac00a5664a965f88b0ca8abd99da2242900ebe1764e0129b
5
5
  SHA512:
6
- metadata.gz: 6849ca1462a835339be88650ea522eb188c5a3575e928a30074a8cdd0c03d3ab5555e9dc8d508adc1ec2a3f165f51b08013c1f7d49c51fda4792e108b6c31099
7
- data.tar.gz: 43d366d447bb52e136dfa0c79dea57902ad72ce70d1670df977546ea3f357e0ce4db51b502f9e160b8390df47d601af8c3b04cb7a28176b5e523c700174f9107
6
+ metadata.gz: 33463d2cda5d3627e9e5f8bdb1a7b7d4755dadd7d19e5893c6c355e45ab6f7bdb0b12885809117d802dcf8b4b251be71db5b7a75f99ef50b5a1a7cc4f889be70
7
+ data.tar.gz: 32c2cce8cf5f554b662a90ea0ccac29d606fc79fb7e312b1436ddfea932689e714538622831e7c46507413b09e784cd282c9c6eb09ccf048f7126cb76d9ee77e
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.1.0] - 2019-10-16
10
+ ### Added
11
+ - [GH-3](https://github.com/pegasd/puppetfile_editor/issues/3): Ability to write local modules in legacy format using
12
+ `pfile format --legacy-local`.
13
+
9
14
  ## [1.0.0] - 2019-10-16
10
15
  ### Changed
11
16
  - [GH-3](https://github.com/pegasd/puppetfile_editor/issues/3): Write local modules in non-legacy format: `, local: true`.
data/bin/pfile CHANGED
@@ -23,6 +23,9 @@ subcommands = {
23
23
  end,
24
24
  'format' => OptionParser.new do |parser|
25
25
  parser.banner = "Usage: #{filename} format"
26
+ parser.on('--legacy-local', 'Use legacy format for local modules') do |setting|
27
+ options[:legacy_local] = setting
28
+ end
26
29
  end,
27
30
  'delete' => OptionParser.new do |parser|
28
31
  parser.banner = "Usage: #{filename} format -m MODULENAME"
@@ -35,8 +35,8 @@ module PuppetfileEditor
35
35
  @pfile.dump
36
36
  end
37
37
 
38
- def format(_why_am_i_here)
39
- @pfile.dump
38
+ def format(opts)
39
+ @pfile.dump(opts)
40
40
  end
41
41
 
42
42
  def delete(opts)
@@ -117,7 +117,7 @@ module PuppetfileEditor
117
117
  end
118
118
  end
119
119
 
120
- def dump(legacy_local = false)
120
+ def dump(args = {})
121
121
  output = []
122
122
  case @type
123
123
  when :hg, :git
@@ -132,7 +132,7 @@ module PuppetfileEditor
132
132
  output.push " #{param} #{value}"
133
133
  end
134
134
  when :local
135
- if legacy_local
135
+ if args[:legacy_local]
136
136
  output.push("mod '#{full_title}', :local")
137
137
  else
138
138
  output.push("mod '#{full_title}', local: true")
@@ -49,7 +49,7 @@ module PuppetfileEditor
49
49
  @loaded = true
50
50
  end
51
51
 
52
- def generate_puppetfile
52
+ def generate_puppetfile(args = {})
53
53
  raise StandardError, 'File is not loaded' unless @loaded
54
54
 
55
55
  contents = []
@@ -62,7 +62,7 @@ module PuppetfileEditor
62
62
 
63
63
  contents.push "# #{module_comment}"
64
64
  module_list.values.sort_by(&:name).each do |mod|
65
- contents.push mod.dump
65
+ contents.push mod.dump(args)
66
66
  end
67
67
  contents.push ''
68
68
  end
@@ -70,8 +70,8 @@ module PuppetfileEditor
70
70
  contents.join("\n")
71
71
  end
72
72
 
73
- def dump
74
- File.write(@puppetfile_path, generate_puppetfile) if @loaded
73
+ def dump(args = {})
74
+ File.write(@puppetfile_path, generate_puppetfile(args)) if @loaded
75
75
  end
76
76
 
77
77
  def update_module(name, param, value)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PuppetfileEditor
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetfile_editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Piven