rspec-system 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,17 @@
1
+ 2.1.0
2
+ =====
3
+
4
+ This is a small feature release, that includes the ability for custom prefabs to be 'merged' with the inbuilt ones. This is a convenience, so that one can override the box definitions without having to also provide new Fact details (for example).
5
+
6
+ #### Detailed Changes
7
+
8
+ * Bundle exec should be used (Hunter Haugen)
9
+ * Align bundler instructions based on @hunner previous patch (Ken Barber)
10
+ * Perform deep merge of custom prefabs (Dominic Cleal)
11
+ * Fix yard doc error for Helpers (Ken Barber)
12
+
13
+ -------------------------------
14
+
1
15
  2.0.0
2
16
  =====
3
17
 
@@ -44,7 +58,13 @@ As part of this release, we have also removed some prior deprecations:
44
58
 
45
59
  Before upgrading, we suggest you upgrade to 1.7.0, paying heed to any deprecation warnings before upgrading to 2.0.0.
46
60
 
47
- #### Detail Changes
61
+ #### Detailed Changes
62
+
63
+ * Fix yarddoc for rcp (Ken Barber)
64
+ * Remove deprecations in prep for 2 (Ken Barber)
65
+ * More sugar through lazy helper object (Ken Barber)
66
+ * Fix 2 yard errors (Ken Barber)
67
+ * Minor improvements to tests and apidocs (Ken Barber)
48
68
 
49
69
  -------------------------------
50
70
 
data/README.md CHANGED
@@ -20,9 +20,9 @@ However it is usually recommended to include it in your `Gemfile` and let bundle
20
20
 
21
21
  Then installing with:
22
22
 
23
- bundle install --path vendor
23
+ bundle install --path vendor/bundle
24
24
 
25
- If your using git, add `.rspec_system` to your project's `.gitignore` file. This is the default location for files created by rspec-system.
25
+ If you're using git, add `.rspec_system` to your project's `.gitignore` file. This is the default location for files created by rspec-system.
26
26
 
27
27
  ### Writing tests
28
28
 
@@ -92,7 +92,7 @@ The file must adhere to the Kwalify schema supplied in `resources/kwalify-schema
92
92
  * `sets`: Each set contains a series of nodes, and is given a unique name. You can create sets with only 1 node if you like.
93
93
  * `sets -> [setname] -> nodes`: Node definitions for a set. Each node needs a unique name so you can address each one individualy if you like.
94
94
  * `sets -> [setname] -> nodes -> [name] -> prefab`: This relates to the prefabricated node template you wish to use. Currently this is the only way to launch a node. Look in `resources/prefabs.yml` for more details.
95
- * `default_set`: this is the default set to run if none are provided with `rake spec:system`. This should be the most common platform normally.
95
+ * `default_set`: this is the default set to run if none are provided with `bundle exec rake spec:system`. This should be the most common platform normally.
96
96
 
97
97
  ### Prefabs
98
98
 
@@ -162,7 +162,7 @@ Make sure you have already installed:
162
162
 
163
163
  Once these are ready, you can Run the system tests with:
164
164
 
165
- rake spec:system
165
+ bundle exec rake spec:system
166
166
 
167
167
  The VM's should be downloaded from the internet, started and tests should run.
168
168
 
@@ -175,7 +175,7 @@ Instead of switches, we use a number of environment variables to modify the beha
175
175
 
176
176
  So if you wanted to run an alternate nodeset you could use:
177
177
 
178
- RSPEC_SET=fedora18 rake spec:system
178
+ RSPEC_SET=fedora18 bundle exec rake spec:system
179
179
 
180
180
  In Jenkins you should be able to use RSPEC\_SET in a test matrix, thus obtaining quite a nice integration and visual display of nodesets in Jenkins.
181
181
 
@@ -203,7 +203,7 @@ This provider has a lot more options for setup, in the form of environment varia
203
203
 
204
204
  Set these variables, and run the usual rake command:
205
205
 
206
- rake spec:system
206
+ bundle exec rake spec:system
207
207
 
208
208
  In Jenkins, set the authentication variables above using environment variable injection. I recommend using the private environment variables feature for user & pass however so these do not get displayed in the console output. As with the vagrant provider however, turn RSPEC\_SET into a test matrix, containing all the sets you want to test against.
209
209
 
@@ -269,10 +269,9 @@ The setup for a job is basically:
269
269
  set +e
270
270
 
271
271
  [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
272
- rvm use ruby-2.0.0@some_unique_name_here --create
273
-
274
- bundle update
275
- rake spec:system
272
+ rvm use ruby-2.0.0
273
+ bundle install --path vendor/bundle
274
+ bundle exec rake spec:system
276
275
 
277
276
  I went quite complex and had Github pull request integration working with this, and quite a few other nice features. If you need help setting it up get in touch.
278
277
 
@@ -297,7 +296,7 @@ The setup for a job is basically:
297
296
  set +e
298
297
  [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
299
298
  rvm use ruby-2.0.0
300
- bundle install --vendor
299
+ bundle install --path vendor/bundle
301
300
  bundle exec rake spec:system
302
301
 
303
302
  Basically the results were quite nice, as apposed to the 'vagrant' provider I was able to achieve running parallel jobs using my matrix setup.
@@ -57,8 +57,6 @@ require 'rspec-system/helpers/rcp'
57
57
  module RSpecSystem::Helpers
58
58
  # @!group Actions
59
59
 
60
- # @!macro shell_method
61
-
62
60
  # Runs a shell command on a test host.
63
61
  #
64
62
  # When invoked as a block a result hash is yielded to the block as a
@@ -73,9 +71,7 @@ module RSpecSystem::Helpers
73
71
  # node provider, however this abstraction should mean you shouldn't need
74
72
  # to worry about that.
75
73
  #
76
- # @api public
77
- # @api public
78
- # @overload $0(options)
74
+ # @overload shell(options)
79
75
  # @param options [Hash] options for command execution
80
76
  # @option options [String] :command command to execute. Mandatory.
81
77
  # @option options [String] :c alias for :command
@@ -83,7 +79,7 @@ module RSpecSystem::Helpers
83
79
  # default in your YAML file, otherwise if there is only one node it uses
84
80
  # that) specifies node to execute command on.
85
81
  # @option options [RSpecSystem::Node] :n alias for :node
86
- # @overload $0(command)
82
+ # @overload shell(command)
87
83
  # @param command [String] command to execute
88
84
  # @yield [result] yields result when called as a block
89
85
  # @yieldparam result [RSpecSystem::Helpers::Shell] result of run
@@ -1,6 +1,8 @@
1
1
  module RSpecSystem
2
2
  # This object represents a prefab definition from the prefabs.yml file
3
3
  class Prefab
4
+ extend RSpecSystem::Util
5
+
4
6
  attr_reader :name
5
7
  attr_reader :description
6
8
  attr_reader :facts
@@ -15,7 +17,7 @@ module RSpecSystem
15
17
  end
16
18
 
17
19
  prefabs = YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', 'resources', 'prefabs.yml'))
18
- prefabs.merge!(custom_prefabs)
20
+ deep_merge!(prefabs, custom_prefabs)
19
21
  raise "No such prefab" unless pf = prefabs[name]
20
22
 
21
23
  RSpecSystem::Prefab.new(
@@ -1,10 +1,5 @@
1
1
  # Include this file to create the spec:* rake tasks
2
2
 
3
- require 'rubygems'
4
- require "bundler/setup"
5
-
6
- Bundler.require :default, :test
7
-
8
3
  require 'rspec/core/rake_task'
9
4
  require 'rspec-system/formatter'
10
5
 
@@ -23,4 +23,17 @@ module RSpecSystem::Util
23
23
 
24
24
  return str
25
25
  end
26
+
27
+ # This is based on the Hash#deep_merge! method from activesupport
28
+ #
29
+ # @param dest_hash [Hash] hash to save merged values into
30
+ # @param other_hash [Hash] hash to merge values from
31
+ # @return [Hash] dest_hash
32
+ def deep_merge!(dest_hash, other_hash)
33
+ other_hash.each_pair do |k,v|
34
+ tv = dest_hash[k]
35
+ dest_hash[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? deep_merge!(tv.dup, v) : v
36
+ end
37
+ dest_hash
38
+ end
26
39
  end
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  # Metadata
4
4
  s.name = "rspec-system"
5
- s.version = "2.0.0"
5
+ s.version = "2.1.0"
6
6
  s.authors = ["Ken Barber"]
7
7
  s.email = ["ken@bob.sh"]
8
8
  s.homepage = "https://github.com/puppetlabs/rspec-system"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-system
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-10 00:00:00.000000000 Z
12
+ date: 2013-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec