puppetfile_fixtures_generator 0.1.0 → 0.1.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/TODO.md +2 -0
- data/bin/puppetfile_fixtures_generator +7 -2
- data/lib/puppetfile_fixtures_generator.rb +12 -9
- data/lib/puppetfile_fixtures_generator/fixtures.rb +10 -4
- data/lib/puppetfile_fixtures_generator/version.rb +1 -1
- data/puppetfile_fixtures_generator-0.1.0.gem +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42f85d794634df200f033fbc717480ee9121d4a7
|
4
|
+
data.tar.gz: d99450ff101a049dc8f5b210f2da6ab7730e214d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9cc91bc50e14baa7d954e34676871a5f8e3993485ee0caef6f8e6fae0770044ca8734f50b311bc77fd1c782ca621d82d91240241afaf2991b253aacebef44cf
|
7
|
+
data.tar.gz: 1b4e000f90b572dfacd36b1f9ee499f29fa39a8195d92f22961c4ef8835c1b939447a19af3ae15722d628b49858c2a7f1132a27d6a8c1692578539b7860bf2de
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[](https://travis-ci.org/thejandroman/puppetfile_fixtures_generator)
|
2
2
|
[](https://coveralls.io/github/thejandroman/puppetfile_fixtures_generator?branch=master)
|
3
|
+
[](https://badge.fury.io/rb/puppetfile_fixtures_generator)
|
3
4
|
|
4
5
|
# PuppetfileFixturesGenerator
|
5
6
|
|
data/TODO.md
CHANGED
@@ -18,11 +18,15 @@ EOS
|
|
18
18
|
opt :puppetfile,
|
19
19
|
'The path, local or absolute, to the Puppetfile. This Puppetfile will be loaded and parsed to create the fixtures YAML file.',
|
20
20
|
type: :string,
|
21
|
-
default:
|
21
|
+
default: nil
|
22
22
|
opt :fixtures_yml,
|
23
23
|
'The path, local or absolute, to the fixtures file to be written. The path, not the file, must exist.',
|
24
24
|
type: :string,
|
25
25
|
default: './.fixtures.yml'
|
26
|
+
opt :symlink_name,
|
27
|
+
'The name of the module to include as the source_dir symlink in the fixtures file.',
|
28
|
+
type: :string,
|
29
|
+
default: nil
|
26
30
|
opt :quiet,
|
27
31
|
'Do not prompt.',
|
28
32
|
type: :bool,
|
@@ -42,6 +46,7 @@ end
|
|
42
46
|
say("Creating #{opts[:fixtures_yml]}...")
|
43
47
|
|
44
48
|
PuppetfileFixturesGenerator.create_fixtures(opts[:puppetfile],
|
45
|
-
opts[:fixtures_yml]
|
49
|
+
opts[:fixtures_yml],
|
50
|
+
opts[:symlink_name])
|
46
51
|
|
47
52
|
say('Complete.')
|
@@ -18,21 +18,24 @@ module PuppetfileFixturesGenerator
|
|
18
18
|
# the fixtures YAML file.
|
19
19
|
# @param [String] fixtures_yml The path, local or absolute, to the
|
20
20
|
# fixtures file to be written. The path, not the file, must exist.
|
21
|
+
# @param [String] symlink_name The name of the module to include as
|
22
|
+
# the source_dir symlink in the fixtures file.
|
21
23
|
#
|
22
24
|
# @return The fixtures file specified as a parameter.
|
23
25
|
#
|
24
|
-
def self.create_fixtures(puppetfile = '
|
25
|
-
|
26
|
-
# load puppetfile file
|
27
|
-
pf = R10K::Puppetfile.new(Pathname.new(puppetfile).dirname.to_s)
|
26
|
+
def self.create_fixtures(puppetfile = nil, fixtures_yml = './.fixtures.yml', symlink_name = nil)
|
27
|
+
modules = nil
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
unless puppetfile.nil?
|
30
|
+
# load puppetfile file
|
31
|
+
pf = R10K::Puppetfile.new(Pathname.new(puppetfile).dirname.to_s)
|
32
|
+
# parse puppetfile
|
33
|
+
pf.load
|
34
|
+
modules = pf.modules
|
35
|
+
end
|
31
36
|
|
32
37
|
# write fixtures
|
33
|
-
fixtures = PuppetfileFixturesGenerator::Fixtures.new(fixtures_yml,
|
34
|
-
pf.modules)
|
35
|
-
|
38
|
+
fixtures = PuppetfileFixturesGenerator::Fixtures.new(fixtures_yml, modules, symlink_name)
|
36
39
|
fixtures.write
|
37
40
|
end
|
38
41
|
|
@@ -6,10 +6,11 @@ module PuppetfileFixturesGenerator
|
|
6
6
|
# changes in the future this class will be rewritten.
|
7
7
|
class Fixtures
|
8
8
|
#
|
9
|
-
def initialize(fixtures_file, modules)
|
9
|
+
def initialize(fixtures_file, modules, symlink_name = nil)
|
10
10
|
@fixtures = Pathname.new(fixtures_file)
|
11
11
|
@modules = modules
|
12
12
|
@module_hash = { 'fixtures' => {} }
|
13
|
+
symlink_builder(symlink_name)
|
13
14
|
end
|
14
15
|
|
15
16
|
def write
|
@@ -24,12 +25,17 @@ module PuppetfileFixturesGenerator
|
|
24
25
|
private
|
25
26
|
|
26
27
|
#
|
27
|
-
def
|
28
|
-
|
29
|
-
|
28
|
+
def symlink_builder(name)
|
29
|
+
unless name.nil?
|
30
|
+
@module_hash['fixtures']['symlinks'] = { 'name' => '#{source_dir}' }
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
34
|
+
#
|
35
|
+
def hash_the_modules
|
36
|
+
@modules.each { |mod| module_builder(mod) } unless @modules.nil?
|
37
|
+
end
|
38
|
+
|
33
39
|
#
|
34
40
|
def module_builder(mod) # rubocop:disable Metrics/MethodLength
|
35
41
|
case mod.properties[:type]
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppetfile_fixtures_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Figueroa
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- lib/puppetfile_fixtures_generator.rb
|
185
185
|
- lib/puppetfile_fixtures_generator/fixtures.rb
|
186
186
|
- lib/puppetfile_fixtures_generator/version.rb
|
187
|
+
- puppetfile_fixtures_generator-0.1.0.gem
|
187
188
|
- puppetfile_fixtures_generator.gemspec
|
188
189
|
- spec/fixtures/Puppetfile
|
189
190
|
- spec/puppetfile_fixtures_generator_spec.rb
|