generate-puppetfile 0.9.10 → 0.9.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/generate_puppetfile/bin.rb +24 -13
- data/lib/generate_puppetfile/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6cfe094ce5b85bfe42cc9d3322df42e66e7114a
|
4
|
+
data.tar.gz: 5b6d91785f56a5371a33c138bcad94e534768f88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f2ccf87f37078a07a0b2643e0caa735537f8038585f86ff4de90d7b666d21fa1ac712011cfcbe0719a0da37d2adbd6d917901eb71076d1b4831b796bcbf357e
|
7
|
+
data.tar.gz: 366bb61416ed9f2aaa4d2b66e2d0f93dbc112074672e66df88ea827ca1d2d21c1c21fdca6065a696f2cc2e6698b1941a992ae9de609927cf7435da0769ce11b7
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/rnelson0/puppet-generate-puppetfile.png?branch=master)](https://travis-ci.org/rnelson0/puppet-generate-puppetfile)
|
1
2
|
[![Gem Version](https://badge.fury.io/rb/generate-puppetfile.svg)](https://badge.fury.io/rb/generate-puppetfile)
|
2
3
|
|
3
4
|
Tired of searching for dependencies on the forge and hoping you got everything? Have an existing Puppetfile that's getting long in the tooth? Use generate-puppetfile to generate a list of modules and their dependencies, at the latest version, in Puppetfile format for use with r10k or librarian-puppet.
|
@@ -11,9 +11,10 @@ module GeneratePuppetfile
|
|
11
11
|
# Internal: The Bin class contains the logic for calling generate_puppetfile at the command line
|
12
12
|
class Bin
|
13
13
|
Module_Regex = Regexp.new("mod ['\"]([a-z0-9_]+\/[a-z0-9_]+)['\"](, ['\"](\\d\.\\d\.\\d)['\"])?", Regexp::IGNORECASE)
|
14
|
-
@options = {}
|
15
|
-
@workspace = nil
|
16
|
-
@module_data = {}
|
14
|
+
@options = {} # Options hash
|
15
|
+
@workspace = nil # Working directory for module download and inspection
|
16
|
+
@module_data = {} # key: modulename, value: version number
|
17
|
+
@download_errors = '' # A list of errors encountered while downloading modules. Should remain empty.
|
17
18
|
Silence = ('>' + File::NULL.to_str + ' 2>&1 ').freeze
|
18
19
|
Puppetfile_Header = '# Modules discovered by generate-puppetfile'.freeze
|
19
20
|
Extras_Note = '# Discovered elements from existing Puppetfile'.freeze
|
@@ -84,17 +85,22 @@ module GeneratePuppetfile
|
|
84
85
|
@module_data = generate_module_data
|
85
86
|
puppetfile_contents = generate_puppetfile_contents(extras)
|
86
87
|
|
87
|
-
|
88
|
+
if @download_errors == ''
|
89
|
+
create_puppetfile(puppetfile_contents) if @options[:create_puppetfile]
|
90
|
+
display_puppetfile(puppetfile_contents) unless @options[:silent]
|
88
91
|
|
89
|
-
|
92
|
+
if @options[:create_fixtures]
|
93
|
+
fixtures_data = generate_fixtures_data
|
94
|
+
write_fixtures_data(fixtures_data)
|
95
|
+
end
|
90
96
|
|
91
|
-
|
92
|
-
|
93
|
-
|
97
|
+
cleanup_workspace
|
98
|
+
else
|
99
|
+
$stderr.puts @download_errors
|
100
|
+
display_puppetfile(puppetfile_contents) unless @options[:silent]
|
101
|
+
return 2
|
94
102
|
end
|
95
103
|
|
96
|
-
cleanup_workspace
|
97
|
-
|
98
104
|
0
|
99
105
|
end
|
100
106
|
|
@@ -183,11 +189,16 @@ Your Puppetfile has been generated. Copy and paste between the markers:
|
|
183
189
|
# module_list is an array of forge module names to be downloaded
|
184
190
|
def download_modules(module_list)
|
185
191
|
puts "\nInstalling modules. This may take a few minutes.\n\n" unless @options[:silent]
|
192
|
+
|
193
|
+
@download_errors = ''
|
186
194
|
module_list.each do |name|
|
187
195
|
next if _download_module(name)
|
188
|
-
|
189
|
-
|
190
|
-
|
196
|
+
@download_errors << "There was a problem with the module name '#{name}'.".red + "\n"
|
197
|
+
end
|
198
|
+
|
199
|
+
if @download_errors != ''
|
200
|
+
@download_errors << ' Check that modules exist as under the listed name, and/or your connectivity to the puppet forge.'.red + "\n\n"
|
201
|
+
@download_errors << 'Here is the PARTIAL Puppetfile that would have been generated.'.red + "\n\n\n"
|
191
202
|
end
|
192
203
|
end
|
193
204
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: generate-puppetfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Nelson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|