puppet-retrospec 1.1.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02ba74daa4e9c7b8f14e53e78a748a19bd6a2452
4
- data.tar.gz: e92c12020b905fdde3be60f8e87b48a6ddd497f6
3
+ metadata.gz: a9bd4527b504e3bed3e18861dae6308ebe725441
4
+ data.tar.gz: de5419b0edc23e427d8559e9ddcafc3f18f72109
5
5
  SHA512:
6
- metadata.gz: 66debb7167d01c98db0a1bba91ce18668d1a83fa4a2bf562ab6e5f54b4121cf88daee015df8a850f7a7e8bf8d36e26a3158b55b008bee52bab2db2d1d2049b76
7
- data.tar.gz: 46b9b0111a51e811be08dacca780a5c0ff1a34bcfee9b4a204c96d1208cebe8009c38a686b6c0823919d3e0bcb68ae4afe25cedc644a69f89416e57d88e69789
6
+ metadata.gz: fa079425ba609de77e12cc553b71602736c63d0ed1ad1c00c4d15ed7b5fe258b2038c0abe561a29b9ce3e96fca26c99ca6df4fbf26f8d5be3d15ceb7132f7cd5
7
+ data.tar.gz: 97a2a24de34fcdde1c48515f8de008a1df85770393b208bd3849f43b924dee6e620d9b903fc56b7f1029fffa3a7a4fee25c78bd75fce45c29c2a0f8b589a960f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## 1.2.0
2
+ * fixes gh-53 - adds windows support
1
3
  ## 1.1.0
2
4
  * fixes gh-62 - add support for creating native puppet fuctions
3
5
  ## 1.0.0
data/Gemfile CHANGED
@@ -11,12 +11,12 @@ group :development do
11
11
  end
12
12
 
13
13
  group :test do
14
- gem 'rubocop'
14
+ gem 'rubocop', platforms: :ruby_20
15
15
  gem 'rspec', '~> 3.2'
16
16
  gem 'puppet', '4.5.2', :path => 'vendor/gems/puppet-4.5.2'
17
+ gem 'json_pure', '= 2.0.1' # force this gem as 2.0.2 requires ruby > 2.0.0
17
18
  gem 'rake'
18
19
  gem 'bundler', '~> 1.0'
19
20
  gem 'yard', '~> 0.7'
20
21
  gem 'fakefs', :require => 'fakefs/safe'
21
- gem 'rspec', '~> 3.2'
22
22
  end
data/Gemfile.lock CHANGED
@@ -17,13 +17,12 @@ GEM
17
17
  facets (3.1.0)
18
18
  facter (2.4.6)
19
19
  CFPropertyList (~> 2.2.6)
20
- fakefs (0.9.0)
21
- hiera (3.2.0)
22
- json_pure
20
+ fakefs (0.9.1)
21
+ hiera (3.2.1)
23
22
  json (1.8.3)
24
- json_pure (2.0.2)
23
+ json_pure (2.0.1)
25
24
  method_source (0.8.2)
26
- parser (2.3.1.2)
25
+ parser (2.3.1.4)
27
26
  ast (~> 2.2)
28
27
  powerpack (0.1.1)
29
28
  pry (0.10.4)
@@ -31,7 +30,7 @@ GEM
31
30
  method_source (~> 0.8.1)
32
31
  slop (~> 3.4)
33
32
  rainbow (2.1.0)
34
- rake (11.2.2)
33
+ rake (11.3.0)
35
34
  rdoc (3.12.2)
36
35
  json (~> 1.4)
37
36
  retrospec (0.4.0)
@@ -40,7 +39,7 @@ GEM
40
39
  rspec-core (~> 3.5.0)
41
40
  rspec-expectations (~> 3.5.0)
42
41
  rspec-mocks (~> 3.5.0)
43
- rspec-core (3.5.1)
42
+ rspec-core (3.5.3)
44
43
  rspec-support (~> 3.5.0)
45
44
  rspec-expectations (3.5.0)
46
45
  diff-lcs (>= 1.2.0, < 2.0)
@@ -49,7 +48,7 @@ GEM
49
48
  diff-lcs (>= 1.2.0, < 2.0)
50
49
  rspec-support (~> 3.5.0)
51
50
  rspec-support (3.5.0)
52
- rubocop (0.42.0)
51
+ rubocop (0.43.0)
53
52
  parser (>= 2.3.1.1, < 3.0)
54
53
  powerpack (~> 0.1)
55
54
  rainbow (>= 1.99.1, < 3.0)
@@ -58,7 +57,7 @@ GEM
58
57
  ruby-progressbar (1.8.1)
59
58
  slop (3.6.0)
60
59
  trollop (2.1.2)
61
- unicode-display_width (1.1.0)
60
+ unicode-display_width (1.1.1)
62
61
  yard (0.9.5)
63
62
 
64
63
  PLATFORMS
@@ -69,6 +68,7 @@ DEPENDENCIES
69
68
  bundler (~> 1.0)
70
69
  facets
71
70
  fakefs
71
+ json_pure (= 2.0.1)
72
72
  pry
73
73
  puppet (= 4.5.2)!
74
74
  rake
@@ -80,4 +80,4 @@ DEPENDENCIES
80
80
  yard (~> 0.7)
81
81
 
82
82
  BUNDLED WITH
83
- 1.12.5
83
+ 1.13.1
@@ -1,4 +1,5 @@
1
1
  require_relative 'serializers/rspec_dumper'
2
+ require_relative 'resource_base_generator'
2
3
  require 'puppet'
3
4
  require 'puppet/pops'
4
5
 
@@ -67,8 +67,8 @@ module Retrospec
67
67
  # the user passed in /tmp/test1 and the name is irrelevent
68
68
  if ! File.exists?(plugin_data[:module_path])
69
69
  plugin_data[:module_path] = File.join(plugin_data[:module_path])
70
- # if the module path basename is the same as the module name
71
- # this is a parent directory or the module already exists
70
+ # if the module path basename is the same as the module name
71
+ # this is a parent directory or the module already exists
72
72
  elsif File.basename(plugin_data[:module_path]) != plugin_data[:name]
73
73
  plugin_data[:module_path] = File.join(plugin_data[:module_path], plugin_data[:name])
74
74
  end
@@ -101,16 +101,16 @@ module Retrospec
101
101
  plugin_opts = Trollop.options(args) do
102
102
  version "Retrospec puppet plugin: #{Retrospec::Puppet::VERSION} (c) Corey Osman"
103
103
  banner <<-EOS
104
- Generates puppet rspec test code based on the classes and defines inside the manifests directory.\n
105
- #{sub_command_help}
104
+ Generates puppet rspec test code based on the classes and defines inside the manifests directory.\n
105
+ #{sub_command_help}
106
106
 
107
107
  EOS
108
108
  opt :template_dir, 'Path to templates directory (only for overriding Retrospec templates)', :type => :string,
109
- :required => false, :default => template_dir
109
+ :required => false, :default => template_dir
110
110
  opt :scm_url, 'SCM url for retrospec templates', :type => :string, :required => false,
111
- :default => scm_url
111
+ :default => scm_url
112
112
  opt :branch, 'Branch you want to use for the retrospec template repo', :type => :string, :required => false,
113
- :default => scm_branch
113
+ :default => scm_branch
114
114
  opt :enable_beaker_tests, 'Enable the creation of beaker tests', :require => false, :type => :boolean, :default => beaker_tests
115
115
  stop_on sub_commands
116
116
  end
@@ -240,31 +240,25 @@ Generates puppet rspec test code based on the classes and defines inside the man
240
240
  # runs a user defined hook called pre-hook
241
241
  def run_pre_hook
242
242
  hook_file = File.join(template_dir, 'pre-hook')
243
- if File.exist?(hook_file)
244
- output = `#{hook_file} #{module_path}`
245
- if $CHILD_STATUS.success?
246
- puts "Successfully ran hook: #{hook_file}".info
247
- puts output.info
248
- else
249
- puts "Error running hook: #{hook_file}".fatal
250
- puts output.fatal
251
- end
243
+ run_hook(hook_file)
244
+ end
245
+
246
+ def run_hook(hook_file)
247
+ return if File.exist?(hook_file)
248
+ output = `ruby #{hook_file} #{module_path}`
249
+ if $CHILD_STATUS.success?
250
+ puts "Successfully ran hook: #{hook_file}".info
251
+ puts output.info
252
+ else
253
+ puts "Error running hook: #{hook_file}".fatal
254
+ puts output.fatal
252
255
  end
253
256
  end
254
257
 
255
258
  # runs a user defined hook called post-hook
256
259
  def run_post_hook
257
260
  hook_file = File.join(template_dir, 'post-hook')
258
- if File.exist?(hook_file)
259
- output = `#{hook_file} #{module_path}`
260
- if $CHILD_STATUS.success?
261
- puts "Successfully ran hook: #{hook_file}".info
262
- puts output.info
263
- else
264
- puts "Error running hook: #{hook_file}".fatal
265
- puts output.fatal
266
- end
267
- end
261
+ run_hook(hook_file)
268
262
  end
269
263
 
270
264
  # this is the method that performs all the magic and creates all the files
@@ -44,26 +44,34 @@ module Retrospec
44
44
  File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
45
45
  end
46
46
 
47
+ # @return [String] window's specific file path for windows and unix specific path for unix
48
+ # @param [String] path to the template directory
49
+ def clone_hook_file(template_dir)
50
+ hook_file_name = 'clone-hook'
51
+ if File.exist?(File.join(template_dir, hook_file_name))
52
+ hook_file = File.join(template_dir, hook_file_name)
53
+ else
54
+ hook_file = File.join(gem_template_dir, hook_file_name)
55
+ end
56
+ hook_file
57
+ end
58
+
47
59
  # runs the clone hook file
48
60
  # the intention of this method and hook is to download the templates
49
61
  # from an external repo. Because templates are updated frequently
50
62
  # and users will sometimes have client specific templates I wanted to
51
63
  # externalize them for easier management.
52
64
  def run_clone_hook(template_dir, git_url = nil, branch = nil)
53
- if File.exist?(File.join(template_dir, 'clone-hook'))
54
- hook_file = File.join(template_dir, 'clone-hook')
65
+ hook_file = clone_hook_file(template_dir)
66
+ return if File.exist?(hook_file)
67
+ output = `ruby #{hook_file} #{template_dir} #{git_url} #{branch}`
68
+ puts output
69
+ if $CHILD_STATUS.success?
70
+ puts "Successfully ran hook: #{hook_file}".info
71
+ puts output.info
55
72
  else
56
- hook_file = File.join(gem_template_dir, 'clone-hook')
57
- end
58
- if File.exist?(hook_file)
59
- output = `#{hook_file} #{template_dir} #{git_url} #{branch}`
60
- if $CHILD_STATUS.success?
61
- puts "Successfully ran hook: #{hook_file}".info
62
- puts output.info
63
- else
64
- puts "Error running hook: #{hook_file}".fatal
65
- puts output.fatal
66
- end
73
+ puts "Error running hook: #{hook_file}".fatal
74
+ puts output.fatal
67
75
  end
68
76
  end
69
77
  end
@@ -1,5 +1,5 @@
1
1
  module Retrospec
2
2
  module Puppet
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
@@ -1,5 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require_relative 'lib/retrospec/plugins/v1/plugin/version'
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'retrospec/plugins/v1/plugin/version'
3
5
 
4
6
  Gem::Specification.new do |s|
5
7
  s.name = "puppet-retrospec"
@@ -358,7 +358,7 @@ describe 'function_generator' do
358
358
  path = File.join(generator.module_path, 'spec', 'functions', 'abs_spec.rb')
359
359
  expect(generator.generate_spec_files).to eq([path])
360
360
  test_file_content = File.read(path)
361
- result = "require 'spec_helper'\n\nlet(:x) do\n 'some_value_goes_here'\nend\n\ndescribe 'abs' do\n it { is_expected.to run.with_params(x).and_return('some_value') }\nend\n"
361
+ result = "require 'spec_helper'\n\ndescribe 'abs' do\n let(:x) do\n 'some_value_goes_here'\n end\n it { is_expected.to run.with_params(x).and_return('some_value') }\nend\n"
362
362
  expect(test_file_content).to eq(result)
363
363
  end
364
364
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-retrospec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Osman