onceover 3.2.5 → 3.2.6

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: 130a240137b4bcb6a3f12944ec67d87b5df340ce
4
- data.tar.gz: bb79bd6c41981ee5edb7aa0de06f8e54e8636ce3
3
+ metadata.gz: 3017c18343feee112c67aa4d2eee9e96ed40c269
4
+ data.tar.gz: d7e83b25247b59be7f5585ef0d0929888340270a
5
5
  SHA512:
6
- metadata.gz: a1a9a99167c3c55849ce9864271b85066b1698239e238113c8e782393e06e1b9f8b23077ba5a828ccfbf4572c9b04097e2d013b48f3624cd99dce1a838b2b96b
7
- data.tar.gz: 7fb28d8a49203486459fdd0599300c8ca88873d4d99aa5306e7c680030f291dbbbc7e01d27f9ef44732c83630849a633c392bfdccce5af0c37a2d5034abae1b7
6
+ metadata.gz: 3537a0ed03929ef0bb538aa291be8a38906ee17f0ff06901743571ec0905c05816b4459cd5febb3dff60b5bc47d2afae94a1902586160fd26438c36854fb03e4
7
+ data.tar.gz: a929a56a8431e7e853b671b23e39ed54c2a1bc40b8fea4f1a506e969a65a973b716ac8fcf49f60daa61d7990811468bac4b908b5c670731f1d0131afa57f993d
data/.gitignore CHANGED
@@ -6,6 +6,7 @@ Gemfile.lock
6
6
  /.bundle
7
7
  /.bin
8
8
  /.ruby-version
9
+ tmp
9
10
 
10
11
  #Vim
11
12
  /.projections.json
@@ -5,7 +5,7 @@ cache:
5
5
  directories:
6
6
  - 'spec/fixtures/puppet_controlrepo/.onceover' # Onceover cache
7
7
 
8
- script: bundler exec rake test
8
+ script: bundle exec rake full_tests
9
9
  bundler_args: --path vendor/bundle
10
10
 
11
11
  rvm:
@@ -15,4 +15,5 @@ rvm:
15
15
  - 2.1.9
16
16
  - 2.2.7
17
17
  - 2.3.4
18
+ - 2.4.0
18
19
  - 2.4.1
data/README.md CHANGED
@@ -634,6 +634,10 @@ Install gem dependencies:
634
634
 
635
635
  `bundle install`
636
636
 
637
+ Clone the submodules
638
+
639
+ `git submodule init && git submodule update --recursive`
640
+
637
641
  Execute tests
638
642
 
639
643
  `bundle exec rake`
@@ -650,3 +654,4 @@ Cheers to all of those who helped out:
650
654
  - natemccurdy
651
655
  - aardvark
652
656
  - Mandos
657
+
data/Rakefile CHANGED
@@ -1,14 +1,24 @@
1
1
  require 'rubygems/tasks'
2
2
  require 'rspec/core/rake_task'
3
+ require 'cucumber/rake/task'
3
4
  Gem::Tasks.new
4
5
 
5
6
  RSpec::Core::RakeTask.new(:spec) do |t|
6
7
  t.rspec_opts = '--pattern spec/\*/\*_spec.rb'
7
8
  end
8
9
 
9
- task default: :test
10
+ Cucumber::Rake::Task.new
10
11
 
11
- task test: [:syntax, :rubocop, :spec]
12
+ task default: :full_tests
13
+
14
+ desc "Run full set of tests"
15
+ task full_tests: [:unit_tests, :acceptance_tests]
16
+
17
+ desc "Run unit tests"
18
+ task unit_tests: [:syntax, :rubocop, :spec]
19
+
20
+ desc "Run acceptance tests"
21
+ task acceptance_tests: [:syntax, :rubocop, :cucumber]
12
22
 
13
23
  task :syntax do
14
24
  paths = ['lib',]
@@ -0,0 +1,14 @@
1
+ Feature: Run basic function of Onceover
2
+ I would like to use executable file to run Onceover and read help
3
+
4
+ Background:
5
+ Given onceover executable
6
+
7
+ Scenario: Show main options with executable wihtout parameters
8
+ When I run onceover command ""
9
+ Then I see help for commands: "help, init, run, show, update"
10
+
11
+ Scenario: Show main help with "help" command
12
+ When I run onceover command "help"
13
+ Then I see help for commands: "help, init, run, show, update"
14
+
@@ -0,0 +1,18 @@
1
+ Given /^onceover executable$/ do
2
+ @executable = ENV["BUNDLE_GEMFILE"] ? "bundle exec onceover " : "onceover "
3
+ end
4
+
5
+ When /^I run onceover command "([^"]*)"$/ do |arg1|
6
+ command = @executable + arg1
7
+ puts command
8
+ @output = `#{command}`
9
+ expect($?.success?).to be true
10
+ end
11
+
12
+ Then /^I see help for commands: "([^"]*)"$/ do |commands|
13
+ commands_help = @output[/COMMANDS(.*)OPTIONS/m, 1]
14
+ commands.split(',').each do |command|
15
+ result = commands_help.match(/^\s+#{command.strip}.+\n/)
16
+ puts result.to_s if expect(result).not_to be nil
17
+ end
18
+ end
@@ -0,0 +1,2 @@
1
+
2
+
@@ -124,10 +124,10 @@ class Onceover
124
124
  host.install_package('git')
125
125
 
126
126
  # copy the file over to the host (Maybe I should be changing the directory here??)
127
- scp_to(host,repo.r10k_config_file,'/tmp/r10k.yaml')
127
+ scp_to(host, repo.r10k_config_file, '/tmp/r10k.yaml')
128
128
 
129
129
  # Do an r10k deploy
130
- r10k_deploy(host,{
130
+ r10k_deploy(host, {
131
131
  :puppetfile => true,
132
132
  :configfile => '/tmp/r10k.yaml',
133
133
  })
@@ -143,7 +143,7 @@ class Onceover
143
143
  # This is not helpful for us. We want to be able to test all of our classes on
144
144
  # all of our nodes, this could be a lot of vms and having them all running at once
145
145
  # would be a real kick in the dick for whatever system was running it.
146
- def self.provision_and_test(host,puppet_class,opts = {},repo = Onceover::Controlrepo.new)
146
+ def self.provision_and_test(host,puppet_class,opts = {}, repo = Onceover::Controlrepo.new)
147
147
  warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
148
148
 
149
149
  opts = {:runs_before_idempotency => 1}.merge(opts)
@@ -175,11 +175,11 @@ class Onceover
175
175
  manifest = "include #{puppet_class}"
176
176
 
177
177
  opts[:runs_before_idempotency].times do
178
- apply_manifest_on(host,manifest,{:catch_failures => true})
178
+ apply_manifest_on(host, manifest, {:catch_failures => true})
179
179
  end
180
180
 
181
181
  if opts[:check_idempotency]
182
- apply_manifest_on(host,manifest,{:catch_changes => true})
182
+ apply_manifest_on(host, manifest, {:catch_changes => true})
183
183
  end
184
184
 
185
185
  network_manager.cleanup
@@ -193,7 +193,7 @@ class Onceover
193
193
 
194
194
  def self.host_create(name, nodes)
195
195
  warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
196
-
196
+
197
197
  require 'beaker/network_manager'
198
198
 
199
199
  current_opts = {}
@@ -20,6 +20,9 @@ tool to work.
20
20
 
21
21
  run do |opts, args, cmd|
22
22
  Onceover::Controlrepo.init(Onceover::Controlrepo.new(opts))
23
+ # Would it make sense for #init to be a class instance method of Controlrepo ? Then you could:
24
+ # cp = Onceover::Controlrepo.new(opts)
25
+ # cp.init
23
26
  end
24
27
  end
25
28
  end
@@ -1,10 +1,10 @@
1
1
  require 'rubygems'
2
2
 
3
3
  # Get all of the gems that start with onceover-
4
- plugins = Gem::Specification.group_by{ |g| g.name }.keep_if do |name,details|
4
+ plugins = Gem::Specification.group_by{ |g| g.name }.keep_if do |name, details|
5
5
  name =~ /^onceover-.*$/
6
6
  end.keys
7
7
 
8
8
  plugins.each do |plugin|
9
- require plugin.gsub('-','/')
9
+ require plugin.gsub('-', '/')
10
10
  end
@@ -38,7 +38,7 @@ This includes deploying using r10k and running all custom tests.
38
38
  usage 'spec'
39
39
  summary 'Runs spec tests'
40
40
 
41
- optional :p, :parallel, 'Runs spec tests in parallel. This increases speed at the cost of poorly formatted logs and irrelevant junit output.'
41
+ optional :p, :parallel, 'Runs spec tests in parallel. This increases speed at the cost of poorly formatted logs and irrelevant junit output.'
42
42
 
43
43
  run do |opts, args, cmd|
44
44
  repo = Onceover::Controlrepo.new(opts)
@@ -61,7 +61,7 @@ This includes deploying using r10k and running all custom tests.
61
61
  warn "[DEPRECATION] Acceptance testing is deprecated due to the removal of Beaker dependencies"
62
62
  warn "[DEPRECATION] Appeptance testing will be replaced by a more pluggable framework in the future, if you have ideas as to how this should be done please submit a ticket."
63
63
  repo = Onceover::Controlrepo.new(opts)
64
- runner = Onceover::Runner.new(repo,Onceover::TestConfig.new(repo.onceover_yaml,opts),:acceptance)
64
+ runner = Onceover::Runner.new(repo,Onceover::TestConfig.new(repo.onceover_yaml,opts), :acceptance)
65
65
  runner.prepare!
66
66
  runner.run_acceptance!
67
67
  end
@@ -89,38 +89,38 @@ class Onceover
89
89
  @root = opts[:path]
90
90
  else
91
91
  @root = Dir.pwd
92
- until File.exist?(File.expand_path('./environment.conf',@root)) do
92
+ until File.exist?(File.expand_path('./environment.conf', @root)) do
93
93
  # Throw an exception if we can't go any further up
94
- throw "Could not file root of the controlrepo anywhere above #{Dir.pwd}" if @root == File.expand_path('../',@root)
94
+ throw "Could not file root of the controlrepo anywhere above #{Dir.pwd}" if @root == File.expand_path('../', @root)
95
95
 
96
96
  # Step up and try again
97
- @root = File.expand_path('../',@root)
97
+ @root = File.expand_path('../', @root)
98
98
  end
99
99
  end
100
100
 
101
- @onceover_yaml = ENV['ONCEOVER_YAML'] || opts[:onceover_yaml] || File.expand_path("#{@root}/spec/onceover.yaml")
101
+ @onceover_yaml = ENV['ONCEOVER_YAML'] || opts[:onceover_yaml] || File.expand_path("#{@root}/spec/onceover.yaml")
102
102
 
103
103
  if File.exists?(@onceover_yaml) && _data = YAML.load_file(@onceover_yaml)
104
104
  opts.merge!(_data.fetch('opts',{})||{})
105
105
  end
106
- opts.fetch(:facts_dir,'').sub!(%r{^[^/.].+} ){|path| File.expand_path(path,@root)}
106
+ opts.fetch(:facts_dir,'').sub!(%r{^[^/.].+} ){|path| File.expand_path(path, @root)}
107
107
  opts.fetch(:facts_files,[]).map!{|path| path =~ %r{^[/.]} ? path : File.expand_path(path, @root)}
108
108
 
109
- @environmentpath = opts[:environmentpath] || 'etc/puppetlabs/code/environments'
110
- @puppetfile = opts[:puppetfile] || File.expand_path('./Puppetfile',@root)
111
- @environment_conf = opts[:environment_conf] || File.expand_path('./environment.conf',@root)
112
- @spec_dir = opts[:spec_dir] || File.expand_path('./spec',@root)
113
- @facts_dir = opts[:facts_dir] || File.expand_path('factsets',@spec_dir)
114
- _facts_dirs = [@facts_dir, File.expand_path('../../../factsets',__FILE__)]
115
- _facts_files = opts[:facts_files] || _facts_dirs.map{|d| File.join(d,'*.json')}
109
+ @environmentpath = opts[:environmentpath] || 'etc/puppetlabs/code/environments'
110
+ @puppetfile = opts[:puppetfile] || File.expand_path('./Puppetfile', @root)
111
+ @environment_conf = opts[:environment_conf] || File.expand_path('./environment.conf', @root)
112
+ @spec_dir = opts[:spec_dir] || File.expand_path('./spec', @root)
113
+ @facts_dir = opts[:facts_dir] || File.expand_path('factsets', @spec_dir)
114
+ _facts_dirs = [@facts_dir, File.expand_path('../../../factsets', __FILE__)]
115
+ _facts_files = opts[:facts_files] || _facts_dirs.map{|d| File.join(d, '*.json')}
116
116
  @facts_files = _facts_files.map{|_path| Dir[_path]}.flatten
117
117
 
118
- @nodeset_file = opts[:nodeset_file] || File.expand_path('./spec/acceptance/nodesets/onceover-nodes.yml',@root)
119
- @role_regex = opts[:role_regex] ? Regexp.new(opts[:role_regex]) : /role[s]?:{2}/
120
- @profile_regex = opts[:profile_regex] ? Regexp.new(opts[:profile_regex]) : /profile[s]?:{2}/
121
- @tempdir = opts[:tempdir] || File.expand_path('./.onceover',@root)
118
+ @nodeset_file = opts[:nodeset_file] || File.expand_path('./spec/acceptance/nodesets/onceover-nodes.yml', @root)
119
+ @role_regex = opts[:role_regex] ? Regexp.new(opts[:role_regex]) : /role[s]?:{2}/
120
+ @profile_regex = opts[:profile_regex] ? Regexp.new(opts[:profile_regex]) : /profile[s]?:{2}/
121
+ @tempdir = opts[:tempdir] || File.expand_path('./.onceover', @root)
122
122
  $temp_modulepath = nil
123
- @manifest = opts[:manifest] || config['manifest'] ? File.expand_path(config['manifest'],@root) : nil
123
+ @manifest = opts[:manifest] || config['manifest'] ? File.expand_path(config['manifest'], @root) : nil
124
124
  @opts = opts
125
125
  logger.level = :debug if @opts[:debug]
126
126
  @@existing_controlrepo = self
@@ -159,7 +159,7 @@ class Onceover
159
159
 
160
160
  # Make sure that the paths are relative to the controlrepo root
161
161
  code_dirs.map! do |dir|
162
- File.expand_path(dir,@root)
162
+ File.expand_path(dir, @root)
163
163
  end
164
164
 
165
165
  # Get all the classes from all of the manifests
@@ -230,8 +230,8 @@ class Onceover
230
230
  end
231
231
  else
232
232
  return_hash[:current_version] = "N/A"
233
- return_hash[:latest_version] = "N/A"
234
- return_hash[:out_of_date] = "N/A"
233
+ return_hash[:latest_version] = "N/A"
234
+ return_hash[:out_of_date] = "N/A"
235
235
  end
236
236
  output_array << return_hash
237
237
  end
@@ -239,11 +239,11 @@ class Onceover
239
239
 
240
240
  threads.map(&:join)
241
241
 
242
- tp output_array, \
243
- {:full_name => {:display_name => "Full Name"}}, \
244
- {:current_version => {:display_name => "Current Version"}}, \
245
- {:latest_version => {:display_name => "Latest Version"}}, \
246
- {:out_of_date => {:display_name => "Out of Date?"}}
242
+ tp output_array,
243
+ {:full_name => {:display_name => "Full Name"}},
244
+ {:current_version => {:display_name => "Current Version"}},
245
+ {:latest_version => {:display_name => "Latest Version"}},
246
+ {:out_of_date => {:display_name => "Out of Date?"}}
247
247
  end
248
248
 
249
249
  def update_puppetfile
@@ -291,9 +291,9 @@ class Onceover
291
291
  modules = puppetfile.modules
292
292
 
293
293
  # Iterate over everything and seperate it out for the sake of readability
294
- symlinks = []
294
+ symlinks = []
295
295
  forge_modules = []
296
- repositories = []
296
+ repositories = []
297
297
 
298
298
  modules.each do |mod|
299
299
  logger.debug "Converting #{mod.to_s} to .fixtures.yml format"
@@ -303,14 +303,14 @@ class Onceover
303
303
  # Set it up as a symlink, because we are using local files in the Puppetfile
304
304
  symlinks << {
305
305
  'name' => mod.name,
306
- 'dir' => mod.expected_version[:path]
306
+ 'dir' => mod.expected_version[:path]
307
307
  }
308
308
  elsif mod.expected_version.is_a?(String)
309
- # Set it up as a normal firge module
309
+ # Set it up as a normal forge module
310
310
  forge_modules << {
311
311
  'name' => mod.name,
312
312
  'repo' => mod.title,
313
- 'ref' => mod.expected_version
313
+ 'ref' => mod.expected_version
314
314
  }
315
315
  end
316
316
  elsif mod.is_a? R10K::Module::Git
@@ -320,7 +320,7 @@ class Onceover
320
320
  # I know I shouldn't be doing this, but trust me, there are no methods
321
321
  # anywhere that expose this value, I looked.
322
322
  'repo' => mod.instance_variable_get(:@remote),
323
- 'ref' => mod.version
323
+ 'ref' => mod.version
324
324
  }
325
325
  end
326
326
  end
@@ -335,20 +335,24 @@ class Onceover
335
335
  Dir["#{dir}/*"].each do |mod|
336
336
  symlinks << {
337
337
  'name' => File.basename(mod),
338
- 'dir' => Pathname.new(File.expand_path(mod)).relative_path_from(Pathname.new(@root))#File.expand_path(mod)
338
+ 'dir' => Pathname.new(File.expand_path(mod)).relative_path_from(Pathname.new(@root))#File.expand_path(mod)
339
339
  }
340
340
  end
341
341
  end
342
342
 
343
343
  # Use an ERB template to write the files
344
- Onceover::Controlrepo.evaluate_template('.fixtures.yml.erb',binding)
344
+ Onceover::Controlrepo.evaluate_template('.fixtures.yml.erb', binding)
345
345
  end
346
346
 
347
347
  def hiera_config_file
348
- # try to find the hiera.iyaml file
349
- hiera_config_file = File.expand_path('./hiera.yaml',@root) if File.exist?(File.expand_path('./hiera.yaml',@root))
350
- hiera_config_file = File.expand_path('./hiera.yaml',@spec_dir) if File.exist?(File.expand_path('./hiera.yaml',@spec_dir))
351
- hiera_config_file
348
+ case
349
+ when File.exist?(File.expand_path('./hiera.yaml', @spec_dir))
350
+ File.expand_path('./hiera.yaml', @spec_dir)
351
+ when File.exist?(File.expand_path('./hiera.yaml', @root))
352
+ File.expand_path('./hiera.yaml', @root)
353
+ else
354
+ nil
355
+ end
352
356
  end
353
357
 
354
358
  def hiera_config_file_relative_path
@@ -402,9 +406,14 @@ class Onceover
402
406
  end
403
407
 
404
408
  def r10k_config_file
405
- r10k_config_file = File.expand_path('./r10k.yaml',@spec_dir) if File.exist?(File.expand_path('./r10k.yaml',@spec_dir))
406
- r10k_config_file = File.expand_path('./r10k.yaml',@root) if File.exist?(File.expand_path('./r10k.yaml',@root))
407
- r10k_config_file
409
+ case
410
+ when File.exist?(File.expand_path('./r10k.yaml', @spec_dir))
411
+ File.expand_path('./r10k.yaml', @spec_dir)
412
+ when File.exist?(File.expand_path('./r10k.yaml', @root))
413
+ File.expand_path('./r10k.yaml', @root)
414
+ else
415
+ nil
416
+ end
408
417
  end
409
418
 
410
419
  def r10k_config
@@ -412,11 +421,11 @@ class Onceover
412
421
  end
413
422
 
414
423
  def r10k_config=(data)
415
- File.write(r10k_config_file,data.to_yaml)
424
+ File.write(r10k_config_file, data.to_yaml)
416
425
  end
417
426
 
418
427
  def temp_manifest
419
- config['manifest'] ? File.expand_path(config['manifest'],@tempdir) : nil
428
+ config['manifest'] ? File.expand_path(config['manifest'], @tempdir) : nil
420
429
  end
421
430
 
422
431
  def self.init(repo)
@@ -425,18 +434,26 @@ class Onceover
425
434
  require 'pathname'
426
435
  require 'colored'
427
436
 
428
- Onceover::Controlrepo.init_write_file(generate_onceover_yaml(repo),repo.onceover_yaml)
437
+ Onceover::Controlrepo.init_write_file(generate_onceover_yaml(repo), repo.onceover_yaml)
429
438
  # [DEPRECATION] Writing nodesets is deprecated due to the removal of Beaker"
430
439
  #Onceover::Controlrepo.init_write_file(generate_nodesets(repo),repo.nodeset_file)
431
- Onceover::Controlrepo.init_write_file(Onceover::Controlrepo.evaluate_template('pre_conditions_README.md.erb',binding),File.expand_path('./pre_conditions/README.md',repo.spec_dir))
432
- Onceover::Controlrepo.init_write_file(Onceover::Controlrepo.evaluate_template('factsets_README.md.erb',binding),File.expand_path('./factsets/README.md',repo.spec_dir))
433
- Onceover::Controlrepo.init_write_file(Onceover::Controlrepo.evaluate_template('Rakefile.erb',binding),File.expand_path('./Rakefile',repo.root))
434
- Onceover::Controlrepo.init_write_file(Onceover::Controlrepo.evaluate_template('Gemfile.erb',binding),File.expand_path('./Gemfile',repo.root))
440
+ init_write_file(
441
+ evaluate_template('pre_conditions_README.md.erb', binding),
442
+ File.expand_path('./pre_conditions/README.md', repo.spec_dir))
443
+ init_write_file(
444
+ evaluate_template('factsets_README.md.erb', binding),
445
+ File.expand_path('./factsets/README.md', repo.spec_dir))
446
+ init_write_file(
447
+ evaluate_template('Rakefile.erb', binding),
448
+ File.expand_path('./Rakefile', repo.root))
449
+ init_write_file(
450
+ evaluate_template('Gemfile.erb', binding),
451
+ File.expand_path('./Gemfile', repo.root))
435
452
 
436
453
  # Add .onceover to Gitignore
437
- gitignore_path = File.expand_path('.gitignore',repo.root)
454
+ gitignore_path = File.expand_path('.gitignore', repo.root)
438
455
  if File.exists? gitignore_path
439
- gitignore_content = (File.open(gitignore_path,'r') {|f| f.read }).split("\n")
456
+ gitignore_content = (File.open(gitignore_path, 'r') {|f| f.read }).split("\n")
440
457
  message = "#{'changed'.green}"
441
458
  else
442
459
  message = "#{'created'.green}"
@@ -445,14 +462,14 @@ class Onceover
445
462
 
446
463
  unless gitignore_content.include?(".onceover")
447
464
  gitignore_content << ".onceover\n"
448
- File.open(gitignore_path,'w') {|f| f.write(gitignore_content.join("\n")) }
465
+ File.open(gitignore_path, 'w') {|f| f.write(gitignore_content.join("\n")) }
449
466
  puts "#{message} #{Pathname.new(gitignore_path).relative_path_from(Pathname.new(Dir.pwd)).to_s}"
450
467
  end
451
468
  end
452
469
 
453
470
  def self.generate_onceover_yaml(repo)
454
471
  # This will return a controlrepo.yaml that can be written to a file
455
- Onceover::Controlrepo.evaluate_template('controlrepo.yaml.erb',binding)
472
+ evaluate_template('controlrepo.yaml.erb', binding)
456
473
  end
457
474
 
458
475
  def self.generate_nodesets(repo)
@@ -465,9 +482,9 @@ class Onceover
465
482
  hosts_hash = {}
466
483
 
467
484
  repo.facts.each do |fact_set|
468
- node_name = File.basename(repo.facts_files[repo.facts.index(fact_set)],'.json')
469
- boxname = Onceover::Beaker.facts_to_vagrant_box(fact_set)
470
- platform = Onceover::Beaker.facts_to_platform(fact_set)
485
+ node_name = File.basename(repo.facts_files[repo.facts.index(fact_set)], '.json')
486
+ boxname = Onceover::Beaker.facts_to_vagrant_box(fact_set)
487
+ platform = Onceover::Beaker.facts_to_platform(fact_set)
471
488
 
472
489
  logger.debug "Querying hashicorp API for Vagrant box that matches #{boxname}"
473
490
 
@@ -484,7 +501,7 @@ class Onceover
484
501
  comment_out = false
485
502
  box_info = JSON.parse(response.body)
486
503
  box_info['current_version']['providers'].each do |provider|
487
- if provider['name'] == 'virtualbox'
504
+ if provider['name'] == 'virtualbox'
488
505
  url = provider['original_url']
489
506
  end
490
507
  end
@@ -501,7 +518,7 @@ class Onceover
501
518
  end
502
519
 
503
520
  # Use an ERB template
504
- Onceover::Controlrepo.evaluate_template('nodeset.yaml.erb',binding)
521
+ evaluate_template('nodeset.yaml.erb', binding)
505
522
  end
506
523
 
507
524
  def self.create_dirs_and_log(dir)
@@ -513,15 +530,15 @@ class Onceover
513
530
  end
514
531
  end
515
532
 
516
- def self.evaluate_template(template_name,bind)
533
+ def self.evaluate_template(template_name, bind)
517
534
  logger.debug "Evaluating template #{template_name}"
518
- template_dir = File.expand_path('../../templates',File.dirname(__FILE__))
519
- template = File.read(File.expand_path("./#{template_name}",template_dir))
535
+ template_dir = File.expand_path('../../templates', File.dirname(__FILE__))
536
+ template = File.read(File.expand_path("./#{template_name}", template_dir))
520
537
  ERB.new(template, nil, '-').result(bind)
521
538
  end
522
539
 
523
- def self.init_write_file(contents,out_file)
524
- Onceover::Controlrepo.create_dirs_and_log(File.dirname(out_file))
540
+ def self.init_write_file(contents, out_file)
541
+ create_dirs_and_log(File.dirname(out_file))
525
542
  if File.exists?(out_file)
526
543
  puts "#{'skipped'.yellow} #{Pathname.new(out_file).relative_path_from(Pathname.new(Dir.pwd)).to_s} #{'(exists)'.yellow}"
527
544
  else
@@ -536,13 +553,13 @@ class Onceover
536
553
  require 'onceover/testconfig'
537
554
 
538
555
  # Load up all of the tests and deduplicate them
539
- testconfig = Onceover::TestConfig.new(@onceover_yaml,@opts)
540
- testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self,tst) }
556
+ testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)
557
+ testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }
541
558
  tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))
542
559
 
543
560
  # Loop over each test, executing the user's block on each
544
561
  tests.each do |tst|
545
- block.call(tst.classes[0].name,tst.nodes[0].name,tst.nodes[0].fact_set,testconfig.pre_condition)
562
+ block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, testconfig.pre_condition)
546
563
  end
547
564
  end
548
565
 
@@ -562,8 +579,8 @@ class Onceover
562
579
  matches = []
563
580
  if first_hash.has_key?(key)
564
581
  if value.is_a?(Hash)
565
- value.each do |k,v|
566
- matches << keypair_is_in_hash(first_hash[key],k,v)
582
+ value.each do |k, v|
583
+ matches << keypair_is_in_hash(first_hash[key], k, v)
567
584
  end
568
585
  else
569
586
  if first_hash[key] == value
@@ -5,7 +5,7 @@ class Onceover
5
5
  class Group
6
6
  @@all = []
7
7
 
8
- # Work out how to do class veriables so that I can keep track of all the groups easily
8
+ # Work out how to do class variables so that I can keep track of all the groups easily
9
9
  attr_accessor :name
10
10
  attr_accessor :members
11
11
 
@@ -13,7 +13,7 @@ class Onceover
13
13
  # by itself, and yes it will reference them, not just create additional ones, woo!
14
14
 
15
15
  def initialize(name = nil, members = [])
16
- @name = name
16
+ @name = name
17
17
  @members = []
18
18
 
19
19
  case
@@ -21,7 +21,7 @@ class Onceover
21
21
  # If it's already a valid list just chuck it in there
22
22
  @members = members
23
23
  when members.is_a?(Hash)
24
- # if it's a hash then do subtractive stiff
24
+ # if it's a hash then do subtractive stuff
25
25
  @members = Onceover::TestConfig.subtractive_to_list(members)
26
26
  when members.nil?
27
27
  # Support empty groups yo
@@ -17,7 +17,7 @@ module Onceover::Logger
17
17
  Logging.appenders.stdout(
18
18
  'stdout',
19
19
  :layout => Logging.layouts.pattern(
20
- :pattern => '%l\t -> %m\n',
20
+ :pattern => '%l\t -> %m\n',
21
21
  :color_scheme => 'bright'
22
22
  )
23
23
  )
@@ -15,7 +15,10 @@ class Onceover
15
15
 
16
16
  # If we can't find the factset it will fail, so just catch that error and ignore it
17
17
  begin
18
- @fact_set = Onceover::Controlrepo.facts[Onceover::Controlrepo.facts_files.index{|facts_file| File.basename(facts_file,'.json') == name}]
18
+ facts_file_index = Onceover::Controlrepo.facts_files.index {|facts_file|
19
+ File.basename(facts_file, '.json') == name
20
+ }
21
+ @fact_set = Onceover::Controlrepo.facts[facts_file_index]
19
22
  rescue TypeError
20
23
  @fact_set = nil
21
24
  end
@@ -1,15 +1,17 @@
1
1
  require 'onceover/controlrepo'
2
2
  require 'pathname'
3
3
 
4
- @repo = nil
4
+ @repo = nil
5
5
  @config = nil
6
6
 
7
7
 
8
8
  desc 'Writes a `fixtures.yml` file based on the Puppetfile'
9
9
  task :generate_fixtures do
10
10
  repo = Onceover::Controlrepo.new
11
- raise ".fixtures.yml already exits, we won't overwrite because we are scared" if File.exists?(File.expand_path('./.fixtures.yml',repo.root))
12
- File.write(File.expand_path('./.fixtures.yml',repo.root),repo.fixtures)
11
+ if File.exists?(File.expand_path('./.fixtures.yml', repo.root))
12
+ raise ".fixtures.yml already exits, we won't overwrite because we are scared"
13
+ end
14
+ File.write(File.expand_path('./.fixtures.yml', repo.root), repo.fixtures)
13
15
  end
14
16
 
15
17
 
@@ -20,7 +22,8 @@ task :hiera_setup do
20
22
  current_config.each do |key, value|
21
23
  if value.is_a?(Hash)
22
24
  if value.has_key?(:datadir)
23
- current_config[key][:datadir] = Pathname.new(repo.hiera_data).relative_path_from(Pathname.new(File.expand_path('..',repo.hiera_config_file))).to_s
25
+ hiera_config_path = Pathname.new(File.expand_path('..', repo.hiera_config_file))
26
+ current_config[key][:datadir] = Pathname.new(repo.hiera_data).relative_path_from(hiera_config_path).to_s
24
27
  end
25
28
  end
26
29
  end
@@ -36,8 +39,8 @@ end
36
39
  task :generate_onceover_yaml do
37
40
  require 'onceover/controlrepo'
38
41
  repo = Onceover::Controlrepo.new
39
- template_dir = File.expand_path('../../templates',File.dirname(__FILE__))
40
- onceover_yaml_template = File.read(File.expand_path('./controlrepo.yaml.erb',template_dir))
42
+ template_dir = File.expand_path('../../templates', File.dirname(__FILE__))
43
+ onceover_yaml_template = File.read(File.expand_path('./controlrepo.yaml.erb', template_dir))
41
44
  puts ERB.new(onceover_yaml_template, nil, '-').result(binding)
42
45
  end
43
46
 
@@ -54,9 +57,9 @@ task :generate_nodesets do
54
57
  puts "HOSTS:"
55
58
 
56
59
  repo.facts.each do |fact_set|
57
- node_name = File.basename(repo.facts_files[repo.facts.index(fact_set)],'.json')
58
- boxname = Onceover::Beaker.facts_to_vagrant_box(fact_set)
59
- platform = Onceover::Beaker.facts_to_platform(fact_set)
60
+ node_name = File.basename(repo.facts_files[repo.facts.index(fact_set)], '.json')
61
+ boxname = Onceover::Beaker.facts_to_vagrant_box(fact_set)
62
+ platform = Onceover::Beaker.facts_to_platform(fact_set)
60
63
 
61
64
  uri = URI("https://atlas.hashicorp.com:443/api/v1/box/#{boxname}")
62
65
  request = Net::HTTP.new(uri.host, uri.port)
@@ -78,8 +81,8 @@ task :generate_nodesets do
78
81
  end
79
82
 
80
83
  # Use an ERB template
81
- template_dir = File.expand_path('../../templates',File.dirname(__FILE__))
82
- fixtures_template = File.read(File.expand_path('./nodeset.yaml.erb',template_dir))
84
+ template_dir = File.expand_path('../../templates', File.dirname(__FILE__))
85
+ fixtures_template = File.read(File.expand_path('./nodeset.yaml.erb', template_dir))
83
86
  puts ERB.new(fixtures_template, nil, '-').result(binding)
84
87
  end
85
88
 
@@ -11,10 +11,8 @@ class Onceover
11
11
  end
12
12
 
13
13
  def prepare!
14
- unless @config.skip_r10k
15
- # Deploy the puppetfile
16
- @config.r10k_deploy_local(@repo)
17
- end
14
+ # Deploy the control repo
15
+ @config.deploy_local(@repo, {:skip_r10k => @config.skip_r10k})
18
16
 
19
17
  # Remove the entire spec directory to make sure we have
20
18
  # all the latest tests
@@ -25,48 +23,49 @@ class Onceover
25
23
  FileUtils.mkdir_p("#{@repo.tempdir}/spec/acceptance/nodesets")
26
24
 
27
25
  # Copy our entire spec directory over
28
- FileUtils.cp_r("#{@repo.spec_dir}","#{@repo.tempdir}")
26
+ FileUtils.cp_r("#{@repo.spec_dir}", "#{@repo.tempdir}")
29
27
 
30
28
  # Create the Rakefile so that we can take advantage of the existing tasks
31
29
  @config.write_rakefile(@repo.tempdir, "spec/classes/**/*_spec.rb")
32
30
 
33
31
  # Create spec_helper.rb
34
- @config.write_spec_helper("#{@repo.tempdir}/spec",@repo)
32
+ @config.write_spec_helper("#{@repo.tempdir}/spec", @repo)
35
33
 
36
34
  # Create spec_helper_accpetance.rb
37
- @config.write_spec_helper_acceptance("#{@repo.tempdir}/spec",@repo)
35
+ @config.write_spec_helper_acceptance("#{@repo.tempdir}/spec", @repo)
38
36
 
39
37
  # TODO: Remove all tests that do not match set tags
40
38
 
41
39
  if @mode.include?(:spec)
42
40
  # Verify all of the spec tests
43
- @config.spec_tests.each { |test| @config.verify_spec_test(@repo,test) }
41
+ @config.spec_tests.each { |test| @config.verify_spec_test(@repo, test) }
44
42
 
45
43
  # Deduplicate and write the tests (Spec and Acceptance)
46
44
  @config.run_filters(Onceover::Test.deduplicate(@config.spec_tests)).each do |test|
47
- @config.write_spec_test("#{@repo.tempdir}/spec/classes",test)
45
+ @config.write_spec_test("#{@repo.tempdir}/spec/classes", test)
48
46
  end
49
47
  end
50
48
 
51
49
  if @mode.include?(:acceptance)
52
50
  # Verify all of the acceptance tests
53
- @config.acceptance_tests.each { |test| @config.verify_acceptance_test(@repo,test) }
51
+ @config.acceptance_tests.each { |test| @config.verify_acceptance_test(@repo, test) }
54
52
 
55
53
  # Write them out
56
- @config.write_acceptance_tests("#{@repo.tempdir}/spec/acceptance",@config.run_filters(Onceover::Test.deduplicate(@config.acceptance_tests)))
54
+ @config.write_acceptance_tests("#{@repo.tempdir}/spec/acceptance",
55
+ @config.run_filters(Onceover::Test.deduplicate(@config.acceptance_tests)))
57
56
  end
58
57
 
59
58
  # Parse the current hiera config, modify, and write it to the temp dir
60
- unless @repo.hiera_config ==nil
59
+ unless @repo.hiera_config == nil
61
60
  hiera_config = @repo.hiera_config
62
- hiera_config.each do |setting,value|
61
+ hiera_config.each do |setting, value|
63
62
  if value.is_a?(Hash)
64
63
  if value.has_key?(:datadir)
65
64
  hiera_config[setting][:datadir] = "#{@repo.tempdir}/#{@repo.environmentpath}/production/#{value[:datadir]}"
66
65
  end
67
66
  end
68
67
  end
69
- File.write("#{@repo.tempdir}/#{@repo.environmentpath}/production/hiera.yaml",hiera_config.to_yaml)
68
+ File.write("#{@repo.tempdir}/#{@repo.environmentpath}/production/hiera.yaml", hiera_config.to_yaml)
70
69
  end
71
70
 
72
71
  @config.create_fixtures_symlinks(@repo)
@@ -11,24 +11,22 @@ class Onceover
11
11
  # This can accept a bunch of stuff. It can accept nodes, classes or groups anywhere
12
12
  # it will then detect them and expand them out into their respective objects so that
13
13
  # we just end up with a list of nodes and classes
14
- #def initialize(on_this,test_config['classes'],options = {})
15
- def initialize(on_this,test_this,test_config)
14
+ def initialize(on_this, test_this, test_config)
16
15
 
17
16
  @default_test_config = {
18
- 'check_idempotency' => true,
17
+ 'check_idempotency' => true,
19
18
  'runs_before_idempotency' => 1
20
19
  }
21
20
 
22
21
  # Add defaults if they do not exist
23
22
  test_config = @default_test_config.merge(test_config)
24
23
 
25
- @nodes = []
24
+ @nodes = []
26
25
  @classes = []
27
26
  @test_config = test_config
28
27
  @test_config.delete('classes') # remove classes from the config
29
28
  @tags = @test_config['tags']
30
29
 
31
-
32
30
  # Make sure that tags are an array
33
31
  @test_config['tags'] = [@test_config['tags']].flatten if @test_config['tags']
34
32
 
@@ -64,12 +62,12 @@ class Onceover
64
62
  end
65
63
 
66
64
  def eql?(other)
67
- (@nodes.sort.eql?(other.nodes.sort)) and (@classes.sort.eql?(other.classes.sort))
65
+ @nodes.sort.eql?(other.nodes.sort) and @classes.sort.eql?(other.classes.sort)
68
66
  end
69
67
 
70
68
  def to_s
71
69
  class_msg = ""
72
- node_msg = ""
70
+ node_msg = ""
73
71
  if classes.count > 1
74
72
  class_msg = "#{classes.count}_classes"
75
73
  else
@@ -91,7 +89,8 @@ class Onceover
91
89
 
92
90
  # this will be an array of arrays, or maybe hashes
93
91
  combinations = []
94
- new_tests = []
92
+ new_tests = []
93
+
95
94
  tests.each do |test|
96
95
  test.nodes.each do |node|
97
96
  test.classes.each do |cls|
@@ -104,7 +103,7 @@ class Onceover
104
103
  end]
105
104
 
106
105
  # Delete all default values in the current options hash
107
- test.test_config.delete_if do |key,value|
106
+ test.test_config.delete_if do |key, value|
108
107
  test.default_test_config[key] == value
109
108
  end
110
109
 
@@ -112,7 +111,7 @@ class Onceover
112
111
  relevant_test.test_config.deep_merge!(test.test_config)
113
112
  else
114
113
  combinations << combo
115
- new_tests << Onceover::Test.new(node,cls,test.test_config)
114
+ new_tests << Onceover::Test.new(node, cls, test.test_config)
116
115
  end
117
116
  end
118
117
  end
@@ -124,7 +123,7 @@ class Onceover
124
123
  # we don't want too many copies of the same shit going around
125
124
  #
126
125
  # Actually based on the way things are written I don't think this
127
- # will duplicated node or class objects, just test objects,
126
+ # will deduplicate node or class objects, just test objects,
128
127
  # everything else is passed by reference
129
128
  new_tests
130
129
  end
@@ -26,7 +26,7 @@ class Onceover
26
26
  attr_accessor :skip_r10k
27
27
  attr_accessor :strict_variables
28
28
 
29
- def initialize(file,opts = {})
29
+ def initialize(file, opts = {})
30
30
  begin
31
31
  config = YAML.load(File.read(file))
32
32
  rescue Errno::ENOENT
@@ -53,26 +53,26 @@ class Onceover
53
53
  @nodes = Onceover::Node.all
54
54
 
55
55
  # Add the 'all_classes' and 'all_nodes' default groups
56
- @node_groups << Onceover::Group.new('all_nodes',@nodes)
57
- @class_groups << Onceover::Group.new('all_classes',@classes)
56
+ @node_groups << Onceover::Group.new('all_nodes', @nodes)
57
+ @class_groups << Onceover::Group.new('all_classes', @classes)
58
58
 
59
59
  # Initialise all of the groups
60
60
  config['node_groups'].each { |name, members| @node_groups << Onceover::Group.new(name, members) } unless config['node_groups'] == nil
61
61
  config['class_groups'].each { |name, members| @class_groups << Onceover::Group.new(name, members) } unless config['class_groups'] == nil
62
62
 
63
- @filter_tags = opts[:tags] ? [opts[:tags].split(',')].flatten : nil
64
- @filter_classes = opts[:classes] ? [opts[:classes].split(',')].flatten.map {|x| Onceover::Class.find(x)} : nil
65
- @filter_nodes = opts[:nodes] ? [opts[:nodes].split(',')].flatten.map {|x| Onceover::Node.find(x)} : nil
66
- @skip_r10k = opts[:skip_r10k] ? true : false
63
+ @filter_tags = opts[:tags] ? [opts[:tags].split(',')].flatten : nil
64
+ @filter_classes = opts[:classes] ? [opts[:classes].split(',')].flatten.map {|x| Onceover::Class.find(x)} : nil
65
+ @filter_nodes = opts[:nodes] ? [opts[:nodes].split(',')].flatten.map {|x| Onceover::Node.find(x)} : nil
66
+ @skip_r10k = opts[:skip_r10k] ? true : false
67
67
 
68
68
  # Loop over all of the items in the test matrix and add those as test
69
69
  # objects to the list of tests
70
70
  config['test_matrix'].each do |test_hash|
71
71
  test_hash.each do |machines, settings|
72
72
  if settings['tests'] == 'spec'
73
- @spec_tests << Onceover::Test.new(machines,settings['classes'],settings)
73
+ @spec_tests << Onceover::Test.new(machines, settings['classes'], settings)
74
74
  elsif settings['tests'] == 'acceptance'
75
- @acceptance_tests << Onceover::Test.new(machines,settings['classes'],settings)
75
+ @acceptance_tests << Onceover::Test.new(machines, settings['classes'], settings)
76
76
  elsif settings['tests'] == 'all_tests'
77
77
  tst = Onceover::Test.new(machines,settings['classes'],settings)
78
78
  @spec_tests << tst
@@ -125,7 +125,7 @@ class Onceover
125
125
  include_list - exclude_list
126
126
  end
127
127
 
128
- def verify_spec_test(controlrepo,test)
128
+ def verify_spec_test(controlrepo, test)
129
129
  test.nodes.each do |node|
130
130
  unless controlrepo.facts_files.any? { |file| file =~ /\/#{node.name}\.json/ }
131
131
  raise "Could not find factset for node: #{node.name}"
@@ -133,7 +133,7 @@ class Onceover
133
133
  end
134
134
  end
135
135
 
136
- def verify_acceptance_test(controlrepo,test)
136
+ def verify_acceptance_test(controlrepo, test)
137
137
  warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
138
138
 
139
139
  require 'yaml'
@@ -157,9 +157,12 @@ class Onceover
157
157
  puppetcode.join("\n")
158
158
  end
159
159
 
160
- def r10k_deploy_local(repo = Onceover::Controlrepo.new)
160
+ def deploy_local(repo = Onceover::Controlrepo.new, opts = {})
161
161
  require 'onceover/controlrepo'
162
162
  require 'pathname'
163
+
164
+ skip_r10k = opts[:skip_r10k] || false
165
+
163
166
  if repo.tempdir == nil
164
167
  repo.tempdir = Dir.mktmpdir('r10k')
165
168
  else
@@ -174,7 +177,7 @@ class Onceover
174
177
  # We might need to exclude some files
175
178
  #
176
179
  # if we are using bundler to install gems below the controlrepo
177
- # we don't wan two copies so exclude those
180
+ # we don't want two copies so exclude those
178
181
  #
179
182
  # If there are more situations like this we can add them to this array as
180
183
  # full paths
@@ -187,8 +190,8 @@ class Onceover
187
190
 
188
191
  # Exclude the files we need to
189
192
  controlrepo_files = Dir.glob("#{repo.root}/**/*")
190
- files_to_copy = (controlrepo_files - excluded_files).delete_if { |path| Pathname(path).directory? }
191
- folders_to_copy = (controlrepo_files - excluded_files).keep_if { |path| Pathname(path).directory? }
193
+ files_to_copy = (controlrepo_files - excluded_files).delete_if { |path| Pathname(path).directory? }
194
+ folders_to_copy = (controlrepo_files - excluded_files).keep_if { |path| Pathname(path).directory? }
192
195
 
193
196
  logger.debug "Creating temp dir as a staging directory for copying the controlrepo to #{repo.tempdir}"
194
197
  temp_controlrepo = Dir.mktmpdir('controlrepo')
@@ -207,15 +210,17 @@ class Onceover
207
210
  FileUtils.rm_rf(temp_controlrepo)
208
211
 
209
212
  # Pull the trigger! If it's not already been pulled
210
- if repo.tempdir
213
+ if repo.tempdir and not skip_r10k
211
214
  if File.directory?(repo.tempdir)
212
215
  # TODO: Change this to call out to r10k directly to do this
213
216
  # Probably something like:
214
217
  # R10K::Settings.global_settings.evaluate(with_overrides)
215
218
  # R10K::Action::Deploy::Environment
216
- Dir.chdir("#{repo.tempdir}/#{repo.environmentpath}/production") do
217
- logger.debug "Runing r10k puppetfile install --verbose --color --puppetfile #{repo.puppetfile} from #{repo.tempdir}/#{repo.environmentpath}/production"
218
- system("r10k puppetfile install --verbose --color --puppetfile #{repo.puppetfile}")
219
+ prod_dir = "#{repo.tempdir}/#{repo.environmentpath}/production"
220
+ Dir.chdir(prod_dir) do
221
+ install_cmd = "r10k puppetfile install --verbose --color"
222
+ logger.debug "Running #{install_cmd} from #{prod_dir}"
223
+ system(install_cmd)
219
224
  end
220
225
  else
221
226
  raise "#{repo.tempdir} is not a directory"
@@ -228,21 +233,25 @@ class Onceover
228
233
 
229
234
  def write_spec_test(location, test)
230
235
  # Use an ERB template to write a spec test
231
- File.write("#{location}/#{test.to_s}_spec.rb",Onceover::Controlrepo.evaluate_template('test_spec.rb.erb',binding))
236
+ File.write("#{location}/#{test.to_s}_spec.rb",
237
+ Onceover::Controlrepo.evaluate_template('test_spec.rb.erb', binding))
232
238
  end
233
239
 
234
240
  def write_acceptance_tests(location, tests)
235
241
  warn "[DEPRECATION] #{__method__} is deprecated due to the removal of Beaker"
236
242
 
237
- File.write("#{location}/acceptance_spec.rb",Onceover::Controlrepo.evaluate_template('acceptance_test_spec.rb.erb',binding))
243
+ File.write("#{location}/acceptance_spec.rb",
244
+ Onceover::Controlrepo.evaluate_template('acceptance_test_spec.rb.erb', binding))
238
245
  end
239
246
 
240
247
  def write_spec_helper_acceptance(location, repo)
241
- File.write("#{location}/spec_helper_acceptance.rb",Onceover::Controlrepo.evaluate_template('spec_helper_acceptance.rb.erb',binding))
248
+ File.write("#{location}/spec_helper_acceptance.rb",
249
+ Onceover::Controlrepo.evaluate_template('spec_helper_acceptance.rb.erb', binding))
242
250
  end
243
251
 
244
252
  def write_rakefile(location, pattern)
245
- File.write("#{location}/Rakefile",Onceover::Controlrepo.evaluate_template('testconfig_Rakefile.erb',binding))
253
+ File.write("#{location}/Rakefile",
254
+ Onceover::Controlrepo.evaluate_template('testconfig_Rakefile.erb', binding))
246
255
  end
247
256
 
248
257
  def write_spec_helper(location, repo)
@@ -256,7 +265,8 @@ class Onceover
256
265
  repo.temp_modulepath = modulepath
257
266
 
258
267
  # Use an ERB template to write a spec test
259
- File.write("#{location}/spec_helper.rb",Onceover::Controlrepo.evaluate_template('spec_helper.rb.erb',binding))
268
+ File.write("#{location}/spec_helper.rb",
269
+ Onceover::Controlrepo.evaluate_template('spec_helper.rb.erb', binding))
260
270
  end
261
271
 
262
272
  def create_fixtures_symlinks(repo)
@@ -279,7 +289,7 @@ class Onceover
279
289
  'classes' => @filter_classes,
280
290
  'nodes' => @filter_nodes
281
291
  }
282
- filters.each do |method,filter_list|
292
+ filters.each do |method, filter_list|
283
293
  if filter_list
284
294
  # Remove tests that do not have matching tags
285
295
  tests.keep_if do |test|
@@ -295,5 +305,6 @@ class Onceover
295
305
  end
296
306
  tests
297
307
  end
308
+
298
309
  end
299
310
  end
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "onceover"
6
- s.version = "3.2.5"
6
+ s.version = "3.2.6"
7
7
  s.authors = ["Dylan Ratcliffe"]
8
8
  s.email = ["dylan.ratcliffe@puppet.com"]
9
9
  s.homepage = "https://github.com/dylanratcliffe/onceover"
@@ -38,5 +38,6 @@ Gem::Specification.new do |s|
38
38
  # Development
39
39
  s.add_development_dependency 'rubocop', '~> 0.39.0'
40
40
  s.add_development_dependency 'rubygems-tasks', '~> 0.2.0'
41
-
41
+ s.add_development_dependency 'pry', '~> 0.10.0'
42
+ s.add_development_dependency 'cucumber', '~> 2.0'
42
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onceover
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.5
4
+ version: 3.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Ratcliffe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2017-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -276,6 +276,34 @@ dependencies:
276
276
  - - "~>"
277
277
  - !ruby/object:Gem::Version
278
278
  version: 0.2.0
279
+ - !ruby/object:Gem::Dependency
280
+ name: pry
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: 0.10.0
286
+ type: :development
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - "~>"
291
+ - !ruby/object:Gem::Version
292
+ version: 0.10.0
293
+ - !ruby/object:Gem::Dependency
294
+ name: cucumber
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - "~>"
298
+ - !ruby/object:Gem::Version
299
+ version: '2.0'
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - "~>"
305
+ - !ruby/object:Gem::Version
306
+ version: '2.0'
279
307
  description: Automatically generates tests for your Puppet code
280
308
  email:
281
309
  - dylan.ratcliffe@puppet.com
@@ -313,6 +341,9 @@ files:
313
341
  - factsets/Windows_Server-2012r2-64.json
314
342
  - factsets/solaris-10_u9-sparc-64.json
315
343
  - factsets/solaris-11.2-sparc-64.json
344
+ - features/basic.feature
345
+ - features/step_definitions/common.rb
346
+ - features/support/env.rb
316
347
  - lib/onceover/beaker.rb
317
348
  - lib/onceover/beaker/spec_helper.rb
318
349
  - lib/onceover/class.rb