kitchen-verifier-serverspec 0.3.1 → 0.4.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: 0c6714cf2d0e9650191e995f574f04e41d82a93f
4
- data.tar.gz: ff945273b667c74be626404334d7e84ec67b140a
3
+ metadata.gz: 31658d1ce8d109b50e8a0bd4fee136aaaff4ef05
4
+ data.tar.gz: e9a6e86d7281a6427415ebf39a90ebea247d029e
5
5
  SHA512:
6
- metadata.gz: dff14d247fda8eb4f815aef042f94f4403f9b9cfeb6d797184d39f768d8c43f660b996163847a857cc8cdc8c6179e1d9a30536b7ec1cbbd65bd4235632fbba6f
7
- data.tar.gz: 566bc642fc3b9e9f6fb147f0dab6136162bfe6853c364e310d9860c75b8c7ebb30a20bac74c18af97c8684eb5cbecd82c945481cf57b7b1aea0d8f408058f6b8
6
+ metadata.gz: 674d382c7fcaa9f73875e7cf3e46d51edb791e8da6c973d9c8c7d2f9bf66bcdc683a9054a92ee07be5dceb2e920a2b0b738e7c89f95237801738bc18a0399944
7
+ data.tar.gz: 1b72bb70e1754d7efc2989c5d69ac4c1b0179a26e724d3bb2f8c94d9c87904b0ebd5c25faf1a7e22e9cf14596b89d8e2bc369b075b7e731c20963a4c493d03b2
data/README.md CHANGED
@@ -127,13 +127,15 @@ key | default value | Notes
127
127
  ----|---------------|--------
128
128
  sleep | 0 |
129
129
  remote_exec | true | specify false to run serverspec on workstation
130
- serverspec_command | nil | custom command to run serverspec
130
+ custom_serverspec_command | nil | custom command to run serverspec. Can be multiline. See examples below.
131
+ additional_serverspec_command | nil | additional command to run serverspec. Can be multiline. See examples below.
131
132
  format | 'documentation' | format of serverspec output
132
133
  color | true | enable color in the output
133
134
  default_path | '/tmp/kitchen' | Set the default path where serverspec looks for patterns
134
135
  patterns | [] | array of patterns for spec test files
135
136
  gemfile | nil | custom gemfile to use to install serverspec
136
137
  custom_install_commmand | nil | Custom shell command to be used at install stage. Can be multiline. See examples below.
138
+ additional_install_commmand | nil | Additional shell command to be used at install stage. Can be multiline. See examples below.
137
139
  test_serverspec_installed | true | only run install_command if serverspec not installed
138
140
  extra_flags | nil | extra flags to add to ther serverspec command
139
141
  remove_default_path | false | remove the default_path after successful serverspec run
@@ -26,6 +26,8 @@ module Kitchen
26
26
 
27
27
  default_config :sleep, 0
28
28
  default_config :serverspec_command, nil
29
+ default_config :custom_serverspec_command, nil
30
+ default_config :additional_serverspec_command, nil
29
31
  default_config :shellout_opts, {}
30
32
  default_config :live_stream, $stdout
31
33
  default_config :remote_exec, true
@@ -35,6 +37,7 @@ module Kitchen
35
37
  default_config :patterns, []
36
38
  default_config :gemfile, nil
37
39
  default_config :custom_install_command, nil
40
+ default_config :additional_install_command, nil
38
41
  default_config :test_serverspec_installed, true
39
42
  default_config :extra_flags, nil
40
43
  default_config :remove_default_path, false
@@ -75,12 +78,13 @@ module Kitchen
75
78
 
76
79
  def serverspec_commands
77
80
  if config[:remote_exec]
78
- if config[:serverspec_command]
81
+ if custom_serverspec_command
79
82
  <<-INSTALL
80
- #{config[:serverspec_command]}
83
+ #{custom_serverspec_command}
81
84
  INSTALL
82
85
  else
83
86
  <<-INSTALL
87
+ #{config[:additional_serverspec_command]}
84
88
  if [ -d #{config[:default_path]} ]; then
85
89
  cd #{config[:default_path]}
86
90
  #{rspec_commands}
@@ -91,10 +95,15 @@ module Kitchen
91
95
  fi
92
96
  INSTALL
93
97
  end
94
- elsif config[:serverspec_command]
95
- info("Running command: #{config[:serverspec_command]}")
96
- system config[:serverspec_command]
98
+ elsif custom_serverspec_command
99
+ info("Running command: #{custom_serverspec_command}")
100
+ system custom_serverspec_command
97
101
  else
102
+ if config[:additional_serverspec_command]
103
+ c = config[:additional_serverspec_command]
104
+ info("Running command: #{c}")
105
+ system c
106
+ end
98
107
  c = rspec_commands
99
108
  info("Running command: #{c}")
100
109
  system c
@@ -107,6 +116,7 @@ module Kitchen
107
116
  if config[:remote_exec]
108
117
  info('Installing ruby, bundler and serverspec remotely on server')
109
118
  <<-INSTALL
119
+ #{config[:additional_install_command]}
110
120
  if [ ! $(which ruby) ]; then
111
121
  echo '-----> Installing ruby, will try to determine platform os'
112
122
  if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/oracle-release ]; then
@@ -130,6 +140,11 @@ module Kitchen
130
140
  INSTALL
131
141
  else
132
142
  info('Installing bundler and serverspec locally on workstation')
143
+ if config[:additional_install_command]
144
+ c = config[:additional_install_command]
145
+ info("Running command: #{c}")
146
+ system c
147
+ end
133
148
  install_bundler
134
149
  install_serverspec
135
150
  install_runner
@@ -280,6 +295,11 @@ module Kitchen
280
295
  end
281
296
  end
282
297
 
298
+ def custom_serverspec_command
299
+ return config[:custom_serverspec_command] if config[:custom_serverspec_command]
300
+ config[:serverspec_command]
301
+ end
302
+
283
303
  def bundler_path
284
304
  config[:bundler_path] ? "#{config[:bundler_path]}/" : nil
285
305
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kitchen
4
4
  module Verifier
5
- SERVERSPEC_VERSION = '0.3.1'.freeze
5
+ SERVERSPEC_VERSION = '0.4.0'.freeze
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-verifier-serverspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neill Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-26 00:00:00.000000000 Z
11
+ date: 2016-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen