busser-shunit2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.cane ADDED
File without changes
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.tailor ADDED
@@ -0,0 +1,4 @@
1
+ Tailor.config do |config|
2
+ config.formatters "text"
3
+ config.file_set 'lib/**/*.rb'
4
+ end
data/.travis.yml ADDED
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - 1.9.2
7
+ - ruby-head
8
+
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## 0.1.0 / 2013-04-13
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ Author:: Jeff Siegel (<jdsiegel@gmail.com>)
2
+
3
+ Copyright (C) 2013, Jeff Siegel
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # <a name="title"></a> Busser::RunnerPlugin::Shunit2
2
+
3
+ A Busser runner plugin for Shunit2
4
+
5
+ ## <a name="installation"></a> Installation and Setup
6
+
7
+ Please read the Busser [plugin usage][plugin_usage] page for more details.
8
+
9
+ ## <a name="usage"></a> Usage
10
+
11
+ **TODO:** Write documentation explaining the structure/format of testing files.
12
+
13
+ ## <a name="development"></a> Development
14
+
15
+ * Source hosted at [GitHub][repo]
16
+ * Report issues/questions/feature requests on [GitHub Issues][issues]
17
+
18
+ Pull requests are very welcome! Make sure your patches are well tested.
19
+ Ideally create a topic branch for every separate change you make. For
20
+ example:
21
+
22
+ 1. Fork the repo
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
24
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
25
+ 4. Push to the branch (`git push origin my-new-feature`)
26
+ 5. Create new Pull Request
27
+
28
+ ## <a name="authors"></a> Authors
29
+
30
+ Created and maintained by [Jeff Siegel][author] (<jdsiegel@gmail.com>)
31
+
32
+ ## <a name="license"></a> License
33
+
34
+ Apache 2.0 (see [LICENSE][license])
35
+
36
+
37
+ [author]: https://github.com/enter-github-user
38
+ [issues]: https://github.com/enter-github-user/busser-shunit2/issues
39
+ [license]: https://github.com/enter-github-user/busser-shunit2/blob/master/LICENSE
40
+ [repo]: https://github.com/enter-github-user/busser-shunit2
41
+ [plugin_usage]: http://docs.kitchen-ci.org/busser/plugin-usage
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ require "bundler/gem_tasks"
2
+ require 'cucumber/rake/task'
3
+ require 'cane/rake_task'
4
+ require 'tailor/rake_task'
5
+
6
+ Cucumber::Rake::Task.new(:features) do |t|
7
+ t.cucumber_opts = ['features', '-x', '--format progress']
8
+ end
9
+
10
+ desc "Run all test suites"
11
+ task :test => [:features]
12
+
13
+ desc "Run cane to check quality metrics"
14
+ Cane::RakeTask.new do |cane|
15
+ cane.canefile = './.cane'
16
+ end
17
+
18
+ Tailor::RakeTask.new
19
+
20
+ desc "Display LOC stats"
21
+ task :stats do
22
+ puts "\n## Production Code Stats"
23
+ sh "countloc -r lib"
24
+ puts "\n## Test Code Stats"
25
+ sh "countloc -r features"
26
+ end
27
+
28
+ desc "Run all quality tasks"
29
+ task :quality => [:cane, :tailor, :stats]
30
+
31
+ task :default => [:test, :quality]
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'busser/shunit2/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'busser-shunit2'
8
+ spec.version = Busser::Shunit2::VERSION
9
+ spec.authors = ['Jeff Siegel']
10
+ spec.email = ['jdsiegel@gmail.com']
11
+ spec.description = %q{A Busser runner plugin for Shunit2}
12
+ spec.summary = spec.description
13
+ spec.homepage = ''
14
+ spec.license = 'Apache 2.0'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = []
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'busser'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ spec.add_development_dependency 'aruba'
26
+
27
+ spec.add_development_dependency 'cane'
28
+ spec.add_development_dependency 'tailor'
29
+ spec.add_development_dependency 'countloc'
30
+ end
@@ -0,0 +1,14 @@
1
+ Feature: Plugin install command
2
+ In order to use this plugin
3
+ As a user of Busser
4
+ I want to run the postinstall for this plugin
5
+
6
+ Background:
7
+ Given a test BUSSER_ROOT directory named "busser-shunit2-install"
8
+
9
+ Scenario: Running the postinstall generator
10
+ When I run `busser plugin install busser-shunit2 --force-postinstall`
11
+ Then the vendor directory named "shunit2" should exist
12
+ And the vendor file "shunit2/shunit2" should contain "SHUNIT_VERSION="
13
+ And the vendor file "shunit2/runner" should contain "#!/bin/bash"
14
+ And the exit status should be 0
@@ -0,0 +1,8 @@
1
+ Feature: Plugin list command
2
+ In order to use this plugin
3
+ As a user of Busser
4
+ I want to see this plugin in the 'busser plugin list' command
5
+
6
+ Scenario: Plugin appears in plugin list command
7
+ When I successfully run `busser plugin list`
8
+ Then the output should match /^shunit2\b/
@@ -0,0 +1,13 @@
1
+ require 'aruba/cucumber'
2
+ require 'busser/cucumber'
3
+
4
+ Before do
5
+ @aruba_timeout_seconds = 10
6
+ end
7
+
8
+ After do |s|
9
+ # Tell Cucumber to quit after this scenario is done - if it failed.
10
+ # This is useful to inspect the 'tmp/aruba' directory before any other
11
+ # steps are executed and clear it out.
12
+ Cucumber.wants_to_quit = true if s.failed?
13
+ end
@@ -0,0 +1,49 @@
1
+ Feature: Test command
2
+ In order to run tests written with shunit2
3
+ As a user of Busser
4
+ I want my tests to run when the shunit2 runner plugin is installed
5
+
6
+ Background:
7
+ Given a test BUSSER_ROOT directory named "busser-shunit2-test"
8
+ When I successfully run `busser plugin install busser-shunit2 --force-postinstall`
9
+ Given a suite directory named "shunit2"
10
+
11
+ Scenario: A passing test suite
12
+ Given a file in suite "shunit2" named "foo_spec.sh" with:
13
+ """
14
+ test_pass()
15
+ {
16
+ assertEquals "kitchen" "kitchen"
17
+ }
18
+ """
19
+ When I run `busser test shunit2`
20
+ Then the output should contain:
21
+ """
22
+ [shunit2] foo_spec.sh
23
+ test_pass
24
+
25
+ Ran 1 test.
26
+
27
+ OK
28
+ """
29
+ And the exit status should be 0
30
+
31
+ Scenario: A failing test suite
32
+ Given a file in suite "shunit2" named "foo_spec.sh" with:
33
+ """
34
+ test_fail()
35
+ {
36
+ assertEquals "kitchen" "jamie"
37
+ }
38
+ """
39
+ When I run `busser test shunit2`
40
+ Then the output should contain:
41
+ """
42
+ test_fail
43
+ ASSERT:expected:<kitchen> but was:<jamie>
44
+
45
+ Ran 1 test.
46
+
47
+ FAILED (failures=1)
48
+ """
49
+ And the exit status should not be 0
@@ -0,0 +1,64 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Jeff Siegel (<jdsiegel@gmail.com>)
4
+ #
5
+ # Copyright (C) 2013, Jeff Siegel
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/runner_plugin'
20
+
21
+ # A Busser runner plugin for Shunit2.
22
+ #
23
+ # @author Jeff Siegel <jdsiegel@gmail.com>
24
+ #
25
+ class Busser::RunnerPlugin::Shunit2 < Busser::RunnerPlugin::Base
26
+
27
+ postinstall do
28
+ tmp_root = Pathname.new(Dir.mktmpdir("shunit2"))
29
+ tarball_url = "https://shunit2.googlecode.com/files/shunit2-2.1.6.tgz"
30
+ tarball_file = tmp_root.join("shunit2.tgz")
31
+ extract_root = tmp_root.join("shunit2")
32
+ dest_path = vendor_path("shunit2")
33
+
34
+ empty_directory(extract_root)
35
+ empty_directory(dest_path)
36
+
37
+ get(tarball_url, tarball_file)
38
+ inside(extract_root) do
39
+ run!(%{gunzip -c "#{tarball_file}" | tar xf - --strip-components=1})
40
+ run!(%{cp -f "#{extract_root}/src/shunit2" "#{dest_path}"})
41
+ end
42
+ remove_dir(tmp_root)
43
+
44
+ inside(dest_path) do
45
+ create_file("runner") do
46
+ """
47
+ #!/bin/bash
48
+ . $1
49
+ . $2
50
+ """
51
+ end
52
+ chmod("runner", 0755)
53
+ end
54
+ end
55
+
56
+ def test
57
+ shunit2_file = vendor_path('shunit2').join('shunit2')
58
+ runner = vendor_path('shunit2').join('runner')
59
+ Dir.glob("#{suite_path('shunit2')}/*_{test,spec}.{sh,bash}").each do |file|
60
+ banner "[shunit2] #{File.basename(file)}"
61
+ run!("#{runner} #{file} #{shunit2_file}")
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Jeff Siegel (<jdsiegel@gmail.com>)
4
+ #
5
+ # Copyright (C) 2013, Jeff Siegel
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 Shunit2
22
+
23
+ # Version string for the Shunit2 Busser runner plugin
24
+ VERSION = "0.1.0"
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,184 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: busser-shunit2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jeff Siegel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: busser
16
+ type: :runtime
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ! '>='
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ prerelease: false
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ type: :development
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '1.3'
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: '1.3'
45
+ prerelease: false
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ type: :development
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ prerelease: false
62
+ - !ruby/object:Gem::Dependency
63
+ name: aruba
64
+ type: :development
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ prerelease: false
78
+ - !ruby/object:Gem::Dependency
79
+ name: cane
80
+ type: :development
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ prerelease: false
94
+ - !ruby/object:Gem::Dependency
95
+ name: tailor
96
+ type: :development
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ version_requirements: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ! '>='
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ prerelease: false
110
+ - !ruby/object:Gem::Dependency
111
+ name: countloc
112
+ type: :development
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ prerelease: false
126
+ description: A Busser runner plugin for Shunit2
127
+ email:
128
+ - jdsiegel@gmail.com
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - .cane
134
+ - .gitignore
135
+ - .tailor
136
+ - .travis.yml
137
+ - CHANGELOG.md
138
+ - Gemfile
139
+ - LICENSE
140
+ - README.md
141
+ - Rakefile
142
+ - busser-shunit2.gemspec
143
+ - features/plugin_install_command.feature
144
+ - features/plugin_list_command.feature
145
+ - features/support/env.rb
146
+ - features/test_command.feature
147
+ - lib/busser/runner_plugin/shunit2.rb
148
+ - lib/busser/shunit2/version.rb
149
+ homepage: ''
150
+ licenses:
151
+ - Apache 2.0
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ! '>='
160
+ - !ruby/object:Gem::Version
161
+ segments:
162
+ - 0
163
+ version: '0'
164
+ hash: 775599996790431992
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ none: false
167
+ requirements:
168
+ - - ! '>='
169
+ - !ruby/object:Gem::Version
170
+ segments:
171
+ - 0
172
+ version: '0'
173
+ hash: 775599996790431992
174
+ requirements: []
175
+ rubyforge_project:
176
+ rubygems_version: 1.8.25
177
+ signing_key:
178
+ specification_version: 3
179
+ summary: A Busser runner plugin for Shunit2
180
+ test_files:
181
+ - features/plugin_install_command.feature
182
+ - features/plugin_list_command.feature
183
+ - features/support/env.rb
184
+ - features/test_command.feature