busser 0.1.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.
@@ -0,0 +1,46 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'busser/thor'
20
+ require 'busser/plugin'
21
+
22
+ module Busser
23
+
24
+ module Command
25
+
26
+ # Test command.
27
+ #
28
+ # @author Fletcher Nichol <fnichol@nichol.ca>
29
+ #
30
+ class Test < Busser::Thor::BaseGroup
31
+
32
+ argument :plugins, :type => :array, :required => false
33
+
34
+ def perform
35
+ Busser::Plugin.runner_plugins(plugins).each do |runner_path|
36
+ runner = File.basename(runner_path)
37
+ klass = ::Thor::Util.camel_case(runner)
38
+
39
+ banner "Running #{runner} test suite"
40
+ Busser::Plugin.require!(runner_path)
41
+ invoke Busser::Plugin.runner_class(klass)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'pathname'
20
+
21
+ module Busser
22
+
23
+ module Helpers
24
+
25
+ module_function
26
+
27
+ def suite_path(name = nil)
28
+ path = root_path + "suites"
29
+ path += name if name
30
+ path
31
+ end
32
+
33
+ def root_path
34
+ Pathname.new(ENV['BUSSER_ROOT'] || "/opt/busser")
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,64 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ module Busser
20
+
21
+ module RunnerPlugin
22
+ end
23
+
24
+ module Plugin
25
+
26
+ module_function
27
+
28
+ def runner_plugins(plugin_names = nil)
29
+ if plugin_names
30
+ Array(plugin_names).map { |plugin| "busser/runner_plugin/#{plugin}" }
31
+ else
32
+ all_runner_plugins
33
+ end
34
+ end
35
+
36
+ def all_runner_plugins
37
+ Gem.find_files('busser/runner_plugin/*.rb').map do |file|
38
+ "busser/runner_plugin/#{File.basename(file).sub(/\.rb$/, '')}"
39
+ end
40
+ end
41
+
42
+ def require!(plugin_path)
43
+ require plugin_path
44
+ rescue LoadError => e
45
+ die "Could not load #{plugin_path} (#{e.class}: #{e.message})"
46
+ end
47
+
48
+ def runner_class(klass)
49
+ Busser::RunnerPlugin.const_get(klass)
50
+ end
51
+
52
+ def gem_from_path(plugin_path)
53
+ local_gem_path = "#{File.expand_path(plugin_path, $LOAD_PATH.first)}"
54
+ local_gemspec = File.join(
55
+ File.dirname($LOAD_PATH.first), "busser.gemspec")
56
+
57
+ if ! Dir.glob("#{local_gem_path}#{Gem.suffix_pattern}").empty?
58
+ Gem::Specification.load(File.expand_path(local_gemspec))
59
+ else
60
+ Gem::Specification.find_by_path(plugin_path)
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'busser/thor'
20
+
21
+ module Busser
22
+
23
+ module RunnerPlugin
24
+
25
+ # Base class for all test runner plugins.
26
+ #
27
+ # @author Fletcher Nichol <fnichol@nichol.ca>
28
+ #
29
+ class Base < Busser::Thor::BaseGroup
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,50 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'thor'
20
+
21
+ require 'busser/helpers'
22
+ require 'busser/ui'
23
+
24
+ module Busser
25
+
26
+ module Thor
27
+
28
+ # Base class for all Thor subclasses which includes useful mixins.
29
+ #
30
+ # @author Fletcher Nichol <fnichol@nichol.ca>
31
+ #
32
+ class Base < ::Thor
33
+
34
+ include Helpers
35
+ include UI
36
+ include ::Thor::Actions
37
+ end
38
+
39
+ # Base class for all Thor Group subclasses which includes useful mixins.
40
+ #
41
+ # @author Fletcher Nichol <fnichol@nichol.ca>
42
+ #
43
+ class BaseGroup < ::Thor::Group
44
+
45
+ include Helpers
46
+ include UI
47
+ include ::Thor::Actions
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,52 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'thor/shell'
20
+
21
+ module Busser
22
+
23
+ module UI
24
+
25
+ def banner(msg)
26
+ say("-----> #{msg}")
27
+ end
28
+
29
+ def info(msg)
30
+ say(" #{msg}")
31
+ end
32
+
33
+ def warn(msg)
34
+ say(">>>>>> #{msg}")
35
+ end
36
+
37
+ def run!(cmd)
38
+ run(cmd, :capture => false, :verbose => false)
39
+
40
+ if $?.success?
41
+ true
42
+ else
43
+ die "Command [#{cmd}] exit code was #{$?.exitstatus}", $?.exitstatus
44
+ end
45
+ end
46
+
47
+ def die(msg, exitstatus = 1)
48
+ $stderr.puts(msg)
49
+ exit(exitstatus)
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ module Busser
20
+ VERSION = "0.1.0"
21
+ end
@@ -0,0 +1,42 @@
1
+ require_relative '../spec_helper'
2
+
3
+ require 'busser/helpers'
4
+
5
+ describe Busser::Helpers do
6
+
7
+ include Busser::Helpers
8
+
9
+ describe ".suite_path" do
10
+
11
+ it "Returns a Pathname" do
12
+ suite_path.must_be_kind_of Pathname
13
+ end
14
+
15
+ describe "with a default root path" do
16
+
17
+ it "Returns a base path if no suite name is given" do
18
+ suite_path.to_s.must_equal "/opt/busser/suites"
19
+ end
20
+
21
+ it "Returns a suite path given a suite name" do
22
+ suite_path("fuzzy").to_s.must_equal "/opt/busser/suites/fuzzy"
23
+ end
24
+ end
25
+
26
+ describe "with a custom root path" do
27
+
28
+ before { ENV['_SPEC_BUSSER_ROOT'] = ENV['BUSSER_ROOT'] }
29
+ after { ENV['BUSSER_ROOT'] = ENV.delete('_SPEC_BUSSER_ROOT') }
30
+
31
+ it "Returns a base path if no suite name is given" do
32
+ ENV['BUSSER_ROOT'] = "/path/to/busser"
33
+ suite_path.to_s.must_equal "/path/to/busser/suites"
34
+ end
35
+
36
+ it "Returns a suite path given a suite name" do
37
+ ENV['BUSSER_ROOT'] = "/path/to/busser"
38
+ suite_path("fuzzy").to_s.must_equal "/path/to/busser/suites/fuzzy"
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
+ #
5
+ # Copyright (C) 2013, Fletcher Nichol
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+
19
+ require 'simplecov'
20
+ require 'fakefs/safe'
21
+ require 'minitest/autorun'
22
+ require 'mocha/setup'
23
+
24
+ SimpleCov.command_name "unit"
metadata ADDED
@@ -0,0 +1,319 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: busser
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Fletcher Nichol
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.3'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.3'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: minitest
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: guard-minitest
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: mocha
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: fakefs
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: aruba
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: guard-cucumber
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: cane
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: guard-cane
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ - !ruby/object:Gem::Dependency
191
+ name: tailor
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ - !ruby/object:Gem::Dependency
207
+ name: simplecov
208
+ requirement: !ruby/object:Gem::Requirement
209
+ none: false
210
+ requirements:
211
+ - - ! '>='
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ type: :development
215
+ prerelease: false
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
218
+ requirements:
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ - !ruby/object:Gem::Dependency
223
+ name: countloc
224
+ requirement: !ruby/object:Gem::Requirement
225
+ none: false
226
+ requirements:
227
+ - - ! '>='
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ! '>='
236
+ - !ruby/object:Gem::Version
237
+ version: '0'
238
+ description: Kitchen Busser - Runs tests for projects in test-kitchen
239
+ email:
240
+ - fnichol@nichol.ca
241
+ executables:
242
+ - busser
243
+ extensions: []
244
+ extra_rdoc_files: []
245
+ files:
246
+ - .cane
247
+ - .gitignore
248
+ - .simplecov
249
+ - .tailor
250
+ - .travis.yml
251
+ - CHANGELOG.md
252
+ - Gemfile
253
+ - Guardfile
254
+ - LICENSE
255
+ - README.md
256
+ - Rakefile
257
+ - bin/busser
258
+ - busser.gemspec
259
+ - features/plugin_install_command.feature
260
+ - features/setup_command.feature
261
+ - features/step_definitions/busser_root_steps.rb
262
+ - features/suite_cleanup_command.feature
263
+ - features/suite_path_command.feature
264
+ - features/support/env.rb
265
+ - lib/busser.rb
266
+ - lib/busser/cli.rb
267
+ - lib/busser/command/plugin.rb
268
+ - lib/busser/command/plugin_install.rb
269
+ - lib/busser/command/plugin_list.rb
270
+ - lib/busser/command/setup.rb
271
+ - lib/busser/command/suite.rb
272
+ - lib/busser/command/suite_cleanup.rb
273
+ - lib/busser/command/suite_path.rb
274
+ - lib/busser/command/test.rb
275
+ - lib/busser/helpers.rb
276
+ - lib/busser/plugin.rb
277
+ - lib/busser/runner_plugin.rb
278
+ - lib/busser/thor.rb
279
+ - lib/busser/ui.rb
280
+ - lib/busser/version.rb
281
+ - spec/busser/helpers_spec.rb
282
+ - spec/spec_helper.rb
283
+ homepage: https://github.com/fnichol/busser
284
+ licenses:
285
+ - Apache 2.0
286
+ post_install_message:
287
+ rdoc_options: []
288
+ require_paths:
289
+ - lib
290
+ required_ruby_version: !ruby/object:Gem::Requirement
291
+ none: false
292
+ requirements:
293
+ - - ! '>='
294
+ - !ruby/object:Gem::Version
295
+ version: 1.9.1
296
+ required_rubygems_version: !ruby/object:Gem::Requirement
297
+ none: false
298
+ requirements:
299
+ - - ! '>='
300
+ - !ruby/object:Gem::Version
301
+ version: '0'
302
+ segments:
303
+ - 0
304
+ hash: 3775856880424031112
305
+ requirements: []
306
+ rubyforge_project:
307
+ rubygems_version: 1.8.24
308
+ signing_key:
309
+ specification_version: 3
310
+ summary: Kitchen Busser - Runs tests for projects in test-kitchen
311
+ test_files:
312
+ - features/plugin_install_command.feature
313
+ - features/setup_command.feature
314
+ - features/step_definitions/busser_root_steps.rb
315
+ - features/suite_cleanup_command.feature
316
+ - features/suite_path_command.feature
317
+ - features/support/env.rb
318
+ - spec/busser/helpers_spec.rb
319
+ - spec/spec_helper.rb