puppetfile_editor 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -0
- data/bin/pfile +3 -3
- data/lib/puppetfile_editor/cli.rb +5 -5
- data/lib/puppetfile_editor/module.rb +7 -5
- data/lib/puppetfile_editor/puppetfile.rb +18 -11
- data/lib/puppetfile_editor/version.rb +1 -1
- metadata +19 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c65880cea1d9c5542724d9297779007c5422d436fba0491110a338067d12a361
|
4
|
+
data.tar.gz: c51a9958b20477aba74ce37400601b91778f0ef03ca8e5c6e995be70347b2330
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1d60910bae9716a96533f9484884db3770a1050392439bcae948b3baf93179e1e6392d59738f95d3e61c9200d14a93d78ee823c349aaea1c4b4300b1aee4044
|
7
|
+
data.tar.gz: 89c5ea8214da8acafcbedd302d9345632b9f5e9950238f6a1a3b5802abd5ee7b844462e38c93dfe65ee4f48186530dcf5c1739aa08753d507e05c03fade49744
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [0.9.0] - 2019-08-06
|
10
|
+
### Changed
|
11
|
+
- Add ability to compare Puppetfiles ignoring module types (`git` vs `hg`).
|
12
|
+
|
7
13
|
## [0.8.0] - 2018-07-12
|
8
14
|
### Changed
|
9
15
|
- [#1](https://github.com/pegasd/puppetfile_editor/issues/1): Do not downgrade modules while merging, whenever possible (see issue for more details).
|
data/bin/pfile
CHANGED
@@ -12,7 +12,7 @@ ARGV.push('-h') if ARGV.empty?
|
|
12
12
|
options = { puppetfile: 'Puppetfile' }
|
13
13
|
|
14
14
|
subcommands = {
|
15
|
-
'edit'
|
15
|
+
'edit' => OptionParser.new do |parser|
|
16
16
|
parser.banner = "Usage: #{filename} edit [options]"
|
17
17
|
parser.on('-m', '--module-name NAME', 'Module name') do |setting|
|
18
18
|
options[:name] = setting
|
@@ -30,7 +30,7 @@ subcommands = {
|
|
30
30
|
options[:name] = setting
|
31
31
|
end
|
32
32
|
end,
|
33
|
-
'add'
|
33
|
+
'add' => OptionParser.new do |parser|
|
34
34
|
parser.banner = "Usage: #{filename} add [options]"
|
35
35
|
parser.on('-m', '--module-name NAME', 'Module name') do |setting|
|
36
36
|
options[:name] = setting
|
@@ -53,7 +53,7 @@ subcommands = {
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end,
|
56
|
-
'merge'
|
56
|
+
'merge' => OptionParser.new do |parser|
|
57
57
|
parser.banner = "Usage: #{filename} merge [options]"
|
58
58
|
parser.separator ' Merge existing Puppetfile with another one from STDIN.'
|
59
59
|
parser.separator ' Dump the result to STDOUT.'
|
@@ -122,11 +122,11 @@ module PuppetfileEditor
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def log(message, message_type = :undef)
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
if @statuses.key? message_type
|
126
|
+
status = @statuses[message_type]
|
127
|
+
else
|
128
|
+
status = @statuses[:undef]
|
129
|
+
end
|
130
130
|
puts "#{status} #{message}"
|
131
131
|
end
|
132
132
|
|
@@ -123,11 +123,11 @@ module PuppetfileEditor
|
|
123
123
|
when :hg, :git
|
124
124
|
output.push "mod '#{full_title}'"
|
125
125
|
@params.each do |param_name, param_value|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
126
|
+
if param_value == :latest
|
127
|
+
value = ':latest'
|
128
|
+
else
|
129
|
+
value = "'#{param_value}'"
|
130
|
+
end
|
131
131
|
param = "#{param_name}:".ljust(@indent)
|
132
132
|
output.push " #{param} #{value}"
|
133
133
|
end
|
@@ -145,6 +145,7 @@ module PuppetfileEditor
|
|
145
145
|
|
146
146
|
def full_title
|
147
147
|
return "#{@author}/#{@name}" if @author
|
148
|
+
|
148
149
|
@name
|
149
150
|
end
|
150
151
|
|
@@ -154,6 +155,7 @@ module PuppetfileEditor
|
|
154
155
|
@params.reject { |param, _| param.eql? @type }.map { |param, value| "#{param}: #{value}" }.sort.join(', ')
|
155
156
|
when :forge
|
156
157
|
return @params[:version] if @params.key? :version
|
158
|
+
|
157
159
|
nil
|
158
160
|
end
|
159
161
|
end
|
@@ -34,14 +34,15 @@ module PuppetfileEditor
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def load
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
if @from_stdin
|
38
|
+
puppetfile_contents = $stdin.gets(nil).chomp
|
39
|
+
elsif @contents
|
40
|
+
puppetfile_contents = @contents
|
41
|
+
else
|
42
|
+
raise(IOError, "'#{@puppetfile_path}' is missing or unreadable") unless File.readable?(@puppetfile_path)
|
43
|
+
|
44
|
+
puppetfile_contents = File.read @puppetfile_path
|
45
|
+
end
|
45
46
|
|
46
47
|
dsl = PuppetfileEditor::DSL.new(self)
|
47
48
|
dsl.instance_eval(puppetfile_contents)
|
@@ -58,6 +59,7 @@ module PuppetfileEditor
|
|
58
59
|
@module_sections.each do |module_type, module_comment|
|
59
60
|
module_list = modules.select { |_, mod| mod.type == module_type }
|
60
61
|
next unless module_list.any?
|
62
|
+
|
61
63
|
contents.push "# #{module_comment}"
|
62
64
|
module_list.values.sort_by(&:name).each do |mod|
|
63
65
|
contents.push mod.dump
|
@@ -78,11 +80,12 @@ module PuppetfileEditor
|
|
78
80
|
@modules[name].set(param, value, true)
|
79
81
|
end
|
80
82
|
|
81
|
-
def compare_with(pfile)
|
83
|
+
def compare_with(pfile, compare_across_types: false)
|
82
84
|
diff = {}
|
83
85
|
pfile.modules.each do |mod_name, mod|
|
84
86
|
next unless [:git, :hg, :forge].include? mod.type
|
85
|
-
|
87
|
+
|
88
|
+
mod.type == :forge ? version_key = :version : version_key = :tag
|
86
89
|
|
87
90
|
unless @modules.key? mod_name
|
88
91
|
diff[mod_name] = { new: mod.params[version_key], type: mod.type } if mod.params.key?(version_key)
|
@@ -91,9 +94,12 @@ module PuppetfileEditor
|
|
91
94
|
|
92
95
|
local_mod = @modules[mod_name]
|
93
96
|
|
94
|
-
|
97
|
+
unless compare_across_types
|
98
|
+
next unless mod.type == local_mod.type
|
99
|
+
end
|
95
100
|
next unless mod.params.key?(version_key) && local_mod.params.key?(version_key)
|
96
101
|
next if mod.params[version_key] == local_mod.params[version_key]
|
102
|
+
|
97
103
|
diff[mod_name] = { old: local_mod.params[version_key], new: mod.params[version_key], type: mod.type }
|
98
104
|
end
|
99
105
|
diff
|
@@ -112,6 +118,7 @@ module PuppetfileEditor
|
|
112
118
|
|
113
119
|
def update_forge_url(url)
|
114
120
|
raise StandardError, "Forge URL must be a String, but it is a #{url.class}" unless url.is_a? String
|
121
|
+
|
115
122
|
@forge = url
|
116
123
|
end
|
117
124
|
end
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppetfile_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugene Piven
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
68
|
+
version: '0'
|
69
69
|
description: |2
|
70
70
|
PuppetfileEditor provides an easy-to-use interface to check Puppetfile for validity,
|
71
71
|
update module versions, add, and remove modules.
|
@@ -102,8 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
|
106
|
-
rubygems_version: 2.6.14.1
|
105
|
+
rubygems_version: 3.0.4
|
107
106
|
signing_key:
|
108
107
|
specification_version: 4
|
109
108
|
summary: Parse and edit Puppetfile
|