busser 0.6.0 → 0.6.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: 800f39c4cfe169cf851757eca11e4e278759066d
4
- data.tar.gz: 82795ffc0a8d04d0390bc03dcbe84c12d8856bf8
3
+ metadata.gz: 7b72fd59135ca003d371dd87f7424b419b1c6b4c
4
+ data.tar.gz: b54e624af6811629926648fb49b9506e8c3b4def
5
5
  SHA512:
6
- metadata.gz: da2598e151602e7b976c03137060bfa3a3a582d08f89b172109c5d28a59baaa02eebcf86c25130f42a5d8e15b0978c5b24431ff8d108a573dea1726c239558c3
7
- data.tar.gz: 79414b62137ed0a2e8bd6622fb3d35b6ab3e47755ba81023763f2de9d69fe42954f3a5a996232fbc7de63a30c64f7f44bcf65548f65a4f9d25854faaf7c64dce
6
+ metadata.gz: e884518990da3a8a31c6076e2f9cbd386b5ef3aa940e70c8d346010f425418ec14cd5372e92aa0e8fb32ba50356b6188ce473b37bd18f9f9cb476525b9eab666
7
+ data.tar.gz: a806bd91b9f165c6588c54b5ae69a6ba9972be466fa5b5ad3327355697f5e08310c002c33662a032fe98300e3dd612bc0118c9620f3ce7468a37896b2f357384
@@ -1,3 +1,13 @@
1
+ ## 0.6.1 / 2014-03-23
2
+
3
+ ### Bug fixes
4
+
5
+ * Issue [#7][]: Ensure that Pathname is coerced to a String before calling Thor's #say. ([@fnichol][])
6
+ * Pull request [#4][], issue [#3][]: /usr/bin/env sh shouldn't assume bourne shell. ([@jtimberman][])
7
+ * Pull request [#5][]: Remove binstub before create. ([@sawanoboly][])
8
+ * Pull request [#6][]: Support binstub on SmartOS. ([@neuhalje][])
9
+
10
+
1
11
  ## 0.6.0 / 2013-11-27
2
12
 
3
13
  ### Breaking changes
@@ -84,4 +94,12 @@
84
94
 
85
95
  <!--- The following link definition list is generated by PimpMyChangelog --->
86
96
  [#2]: https://github.com/test-kitchen/busser/issues/2
87
- [@fnichol]: https://github.com/fnichol
97
+ [#3]: https://github.com/test-kitchen/busser/issues/3
98
+ [#4]: https://github.com/test-kitchen/busser/issues/4
99
+ [#5]: https://github.com/test-kitchen/busser/issues/5
100
+ [#6]: https://github.com/test-kitchen/busser/issues/6
101
+ [#7]: https://github.com/test-kitchen/busser/issues/7
102
+ [@fnichol]: https://github.com/fnichol
103
+ [@jtimberman]: https://github.com/jtimberman
104
+ [@neuhalje]: https://github.com/neuhalje
105
+ [@sawanoboly]: https://github.com/sawanoboly
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Busser::VERSION
9
9
  spec.authors = ["Fletcher Nichol"]
10
10
  spec.email = ["fnichol@nichol.ca"]
11
- spec.description = %q{Kitchen Busser - Runs tests for projects in test-kitchen}
11
+ spec.description = %q{Busser - Runs tests for projects in Test Kitchen}
12
12
  spec.summary = spec.description
13
- spec.homepage = "https://github.com/fnichol/busser"
13
+ spec.homepage = "https://github.com/test-kitchen/busser"
14
14
  spec.license = 'Apache 2.0'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.required_ruby_version = ">= 1.9.1"
22
22
 
23
- spec.add_dependency 'thor'
23
+ spec.add_dependency 'thor', '<= 0.19.0'
24
24
 
25
25
  spec.add_development_dependency "chef"
26
26
 
@@ -46,6 +46,7 @@ module Busser
46
46
  binstub = root_path + "bin/busser"
47
47
 
48
48
  info "Creating busser binstub"
49
+ File.unlink(binstub) if File.exists?(binstub)
49
50
  create_file(binstub, :verbose => false) do
50
51
  <<-BUSSER_BINSTUB.gsub(/^ {12}/, '')
51
52
  #!/usr/bin/env sh
@@ -62,7 +63,7 @@ module Busser
62
63
  # resolved path.
63
64
  SOURCE="#{ruby_bin}"
64
65
  while [ -h "$SOURCE" ] ; do SOURCE="`readlink "$SOURCE"`"; done
65
- DIR="`cd -P "\\`dirname "$SOURCE"\\`" && pwd`"
66
+ DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
66
67
 
67
68
  # Set Busser Root path
68
69
  BUSSER_ROOT="#{root_path}"
@@ -31,7 +31,7 @@ module Busser
31
31
  argument :suite_name, :required => false
32
32
 
33
33
  def path
34
- say suite_path(suite_name)
34
+ say suite_path(suite_name).to_s
35
35
  end
36
36
  end
37
37
  end
@@ -43,10 +43,11 @@ module Busser
43
43
  def run!(cmd)
44
44
  run(cmd, :capture => false, :verbose => false)
45
45
 
46
- if $?.success?
46
+ if status.success?
47
47
  true
48
48
  else
49
- die "Command [#{cmd}] exit code was #{$?.exitstatus}", $?.exitstatus
49
+ code = status.exitstatus
50
+ die "Command [#{cmd}] exit code was #{code}", code
50
51
  end
51
52
  end
52
53
 
@@ -54,15 +55,21 @@ module Busser
54
55
  config = { :capture => false, :verbose => false }.merge(config)
55
56
  run_ruby_script(cmd, config)
56
57
 
57
- if $?.success?
58
+ if status.success?
58
59
  true
59
60
  else
60
- die "Ruby Script[#{cmd}] exit code was #{$?.exitstatus}", $?.exitstatus
61
+ code = status.exitstatus
62
+ die "Ruby Script [#{cmd}] exit code was #{code}", code
61
63
  end
62
64
  end
65
+
63
66
  def die(msg, exitstatus = 1)
64
67
  $stderr.puts(msg)
65
68
  exit(exitstatus)
66
69
  end
70
+
71
+ def status
72
+ $?
73
+ end
67
74
  end
68
75
  end
@@ -17,5 +17,5 @@
17
17
  # limitations under the License.
18
18
 
19
19
  module Busser
20
- VERSION = "0.6.0"
20
+ VERSION = "0.6.1"
21
21
  end
@@ -0,0 +1,171 @@
1
+ require_relative '../spec_helper'
2
+
3
+ require 'busser/ui'
4
+
5
+ # Dummy class containing diagnostic methods approximating Thor mixins
6
+ class SneakyUI
7
+
8
+ include Busser::UI
9
+
10
+ attr_reader :run_args, :run_ruby_script_args
11
+ attr_accessor :status
12
+
13
+ def say(msg)
14
+ msg
15
+ end
16
+
17
+ def run(cmd, opts)
18
+ @run_args = [cmd, opts]
19
+ end
20
+
21
+ def run_ruby_script(cmd, opts)
22
+ @run_ruby_script_args = [cmd, opts]
23
+ end
24
+
25
+ def exit(status)
26
+ @died = true
27
+ status
28
+ end
29
+
30
+ def died?
31
+ @died
32
+ end
33
+
34
+ # these methods are technically private, so we'll avoid straight send
35
+ # calls in the specs
36
+ %w{banner info warn die run! run_ruby_script!}.each do |meth|
37
+ define_method("invoke_#{meth}") { |*args| send(meth, *args) }
38
+ end
39
+ end
40
+
41
+ # Stub that mimicks a Process::Status object
42
+ class FakeStatus
43
+
44
+ attr_reader :exitstatus
45
+
46
+ def initialize(success = true, exitstatus = 0)
47
+ @success, @exitstatus = success, exitstatus
48
+ end
49
+
50
+ def success?
51
+ @success
52
+ end
53
+ end
54
+
55
+ describe Busser::UI do
56
+
57
+ let(:ui) do
58
+ ui = SneakyUI.new
59
+ ui.status = FakeStatus.new(true)
60
+ ui
61
+ end
62
+
63
+ it "#banner should display a formatted message" do
64
+ ui.invoke_banner("coffee").must_equal "-----> coffee"
65
+ end
66
+
67
+ it "#info should display a formatted message" do
68
+ ui.invoke_info("beans").must_equal " beans"
69
+ end
70
+
71
+ it "#warn should display a formatted message" do
72
+ ui.invoke_warn("grinder").must_equal ">>>>>> grinder"
73
+ end
74
+
75
+ describe "#die" do
76
+ it "prints a message to stderr" do
77
+ capture_stderr { ui.invoke_die("noes") }.must_equal "noes\n"
78
+ end
79
+
80
+ it "calls exit with 1 by default" do
81
+ capture_stderr do
82
+ ui.invoke_die("fail").must_equal 1
83
+ end
84
+ end
85
+
86
+ it "exits with a custom exit status" do
87
+ capture_stderr do
88
+ ui.invoke_die("fail", 16).must_equal 16
89
+ end
90
+ end
91
+ end
92
+
93
+ describe "#run!" do
94
+
95
+ it "calls #run with correct options" do
96
+ ui.invoke_run!("doitpls")
97
+
98
+ ui.run_args.must_equal([
99
+ "doitpls",
100
+ { :capture => false, :verbose => false}
101
+ ])
102
+ end
103
+
104
+ it "returns true if command succeeded" do
105
+ ui.invoke_run!("great-stuff").must_equal true
106
+ end
107
+
108
+ it "terminates the program if the command failed" do
109
+ ui.status = FakeStatus.new(false)
110
+ capture_stderr { ui.invoke_run!("failwhale") }
111
+
112
+ ui.died?.must_equal true
113
+ end
114
+
115
+ it "terminates with the exit code of the failed command" do
116
+ ui.status = FakeStatus.new(false, 24)
117
+
118
+ capture_stderr do
119
+ ui.invoke_run!("failwhale").must_equal 24
120
+ end
121
+ end
122
+ end
123
+
124
+ describe "#run_ruby_script!" do
125
+
126
+ it "calls #run_ruby_script with correct default options" do
127
+ ui.invoke_run_ruby_script!("theworks.rb")
128
+
129
+ ui.run_ruby_script_args.must_equal([
130
+ "theworks.rb",
131
+ { :capture => false, :verbose => false }
132
+ ])
133
+ end
134
+
135
+ it "calls #run_ruby_script with correct default options" do
136
+ ui.invoke_run_ruby_script!("theworks.rb", :verbose => true)
137
+
138
+ ui.run_ruby_script_args.must_equal([
139
+ "theworks.rb",
140
+ { :capture => false, :verbose => true }
141
+ ])
142
+ end
143
+
144
+ it "returns true if command succeeded" do
145
+ ui.invoke_run_ruby_script!("thewin.rb").must_equal true
146
+ end
147
+
148
+ it "terminates the program if the script failed" do
149
+ ui.status = FakeStatus.new(false)
150
+ capture_stderr { ui.invoke_run_ruby_script!("nope.rb") }
151
+
152
+ ui.died?.must_equal true
153
+ end
154
+
155
+ it "terminates with the exit code of the failed script" do
156
+ ui.status = FakeStatus.new(false, 97)
157
+
158
+ capture_stderr do
159
+ ui.invoke_run_ruby_script!("nadda.rb").must_equal 97
160
+ end
161
+ end
162
+ end
163
+
164
+ def capture_stderr
165
+ original_stderr, $stderr = $stderr, StringIO.new
166
+ yield
167
+ $stderr.string
168
+ ensure
169
+ $stderr = original_stderr
170
+ end
171
+ end
metadata CHANGED
@@ -1,184 +1,184 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: busser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-28 00:00:00.000000000 Z
11
+ date: 2014-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "<="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.19.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - "<="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.19.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mocha
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: fakefs
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: aruba
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: cane
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: tailor
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: simplecov
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - '>='
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: countloc
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '>='
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '>='
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
- description: Kitchen Busser - Runs tests for projects in test-kitchen
181
+ description: Busser - Runs tests for projects in Test Kitchen
182
182
  email:
183
183
  - fnichol@nichol.ca
184
184
  executables:
@@ -186,11 +186,11 @@ executables:
186
186
  extensions: []
187
187
  extra_rdoc_files: []
188
188
  files:
189
- - .cane
190
- - .gitignore
191
- - .simplecov
192
- - .tailor
193
- - .travis.yml
189
+ - ".cane"
190
+ - ".gitignore"
191
+ - ".simplecov"
192
+ - ".tailor"
193
+ - ".travis.yml"
194
194
  - CHANGELOG.md
195
195
  - Gemfile
196
196
  - Guardfile
@@ -230,6 +230,7 @@ files:
230
230
  - lib/busser/ui.rb
231
231
  - lib/busser/version.rb
232
232
  - spec/busser/helpers_spec.rb
233
+ - spec/busser/ui_spec.rb
233
234
  - spec/spec_helper.rb
234
235
  - templates/plugin/CHANGELOG.md.erb
235
236
  - templates/plugin/Gemfile.erb
@@ -249,7 +250,7 @@ files:
249
250
  - templates/plugin/tailor.erb
250
251
  - templates/plugin/travis.yml.erb
251
252
  - templates/plugin/version.rb.erb
252
- homepage: https://github.com/fnichol/busser
253
+ homepage: https://github.com/test-kitchen/busser
253
254
  licenses:
254
255
  - Apache 2.0
255
256
  metadata: {}
@@ -259,20 +260,20 @@ require_paths:
259
260
  - lib
260
261
  required_ruby_version: !ruby/object:Gem::Requirement
261
262
  requirements:
262
- - - '>='
263
+ - - ">="
263
264
  - !ruby/object:Gem::Version
264
265
  version: 1.9.1
265
266
  required_rubygems_version: !ruby/object:Gem::Requirement
266
267
  requirements:
267
- - - '>='
268
+ - - ">="
268
269
  - !ruby/object:Gem::Version
269
270
  version: '0'
270
271
  requirements: []
271
272
  rubyforge_project:
272
- rubygems_version: 2.0.3
273
+ rubygems_version: 2.2.2
273
274
  signing_key:
274
275
  specification_version: 4
275
- summary: Kitchen Busser - Runs tests for projects in test-kitchen
276
+ summary: Busser - Runs tests for projects in Test Kitchen
276
277
  test_files:
277
278
  - features/deserialize_command.feature
278
279
  - features/files/base64.txt
@@ -283,4 +284,5 @@ test_files:
283
284
  - features/suite_path_command.feature
284
285
  - features/support/env.rb
285
286
  - spec/busser/helpers_spec.rb
287
+ - spec/busser/ui_spec.rb
286
288
  - spec/spec_helper.rb