puppetfile_fixtures_generator 0.1.0 → 0.1.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: d650113446bdbf29caf7b5dc5d6532d3c82897f5
4
- data.tar.gz: d03ef7e52bb21726716dfb31a483644167c4c693
3
+ metadata.gz: 42f85d794634df200f033fbc717480ee9121d4a7
4
+ data.tar.gz: d99450ff101a049dc8f5b210f2da6ab7730e214d
5
5
  SHA512:
6
- metadata.gz: 5687f90da4ad17e2a19f73b3a57aa2000e5fc240dd8673f32c5e29955978472db8befe168648ebae733252d6ba5afa336262cc97bb510fc394229ac1dc5358a3
7
- data.tar.gz: 11cec5b1d9638c8ca9f907edfb47b07deae239982b13bac6766a31584dce37d1ba41b6d8ad921654e2cd3354d335e8f5180efb10baef1781a8a1af3c8655137d
6
+ metadata.gz: e9cc91bc50e14baa7d954e34676871a5f8e3993485ee0caef6f8e6fae0770044ca8734f50b311bc77fd1c782ca621d82d91240241afaf2991b253aacebef44cf
7
+ data.tar.gz: 1b4e000f90b572dfacd36b1f9ee499f29fa39a8195d92f22961c4ef8835c1b939447a19af3ae15722d628b49858c2a7f1132a27d6a8c1692578539b7860bf2de
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppetfile_fixtures_generator (0.1.0)
4
+ puppetfile_fixtures_generator (0.1.1)
5
5
  highline (~> 1.7)
6
6
  r10k (~> 2.1)
7
7
  trollop (~> 2.1)
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Build Status](https://travis-ci.org/thejandroman/puppetfile_fixtures_generator.svg?branch=master)](https://travis-ci.org/thejandroman/puppetfile_fixtures_generator)
2
2
  [![Coverage Status](https://coveralls.io/repos/github/thejandroman/puppetfile_fixtures_generator/badge.svg?branch=master)](https://coveralls.io/github/thejandroman/puppetfile_fixtures_generator?branch=master)
3
+ [![Gem Version](https://badge.fury.io/rb/puppetfile_fixtures_generator.svg)](https://badge.fury.io/rb/puppetfile_fixtures_generator)
3
4
 
4
5
  # PuppetfileFixturesGenerator
5
6
 
data/TODO.md CHANGED
@@ -1,3 +1,5 @@
1
1
  - Add support for creating a Puppetfile from a fixtures file
2
2
  - Update library documentation
3
3
  - Update tests
4
+ - Sort the resulting fixtures file
5
+ - Handle Symlinks in fixtures better
@@ -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: './Puppetfile'
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 = './Puppetfile',
25
- fixtures_yml = './.fixtures.yml')
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
- # parse puppetfile
30
- pf.load
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 hash_the_modules
28
- @modules.each do |mod|
29
- module_builder(mod)
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]
@@ -1,3 +1,3 @@
1
1
  module PuppetfileFixturesGenerator
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  end
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.0
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