kb 1.0.0.alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.cane +0 -0
- data/.gitignore +17 -0
- data/.simplecov +10 -0
- data/.tailor +4 -0
- data/.travis.yml +10 -0
- data/Gemfile +10 -0
- data/Guardfile +18 -0
- data/LICENSE +15 -0
- data/README.md +35 -0
- data/Rakefile +38 -0
- data/bin/kb +8 -0
- data/features/step_definitions/kb_root_steps.rb +25 -0
- data/features/suite_cleanup_command.feature +28 -0
- data/features/suite_path_command.feature +15 -0
- data/features/support/env.rb +19 -0
- data/kb.gemspec +39 -0
- data/lib/kb/cli.rb +33 -0
- data/lib/kb/command/suite.rb +39 -0
- data/lib/kb/command/suite_cleanup.rb +43 -0
- data/lib/kb/command/suite_path.rb +38 -0
- data/lib/kb/helpers.rb +37 -0
- data/lib/kb/thor.rb +48 -0
- data/lib/kb/ui.rb +37 -0
- data/lib/kb/version.rb +21 -0
- data/lib/kb.rb +22 -0
- data/spec/kb/helpers_spec.rb +42 -0
- data/spec/spec_helper.rb +24 -0
- metadata +304 -0
data/.cane
ADDED
File without changes
|
data/.gitignore
ADDED
data/.simplecov
ADDED
data/.tailor
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
guard 'minitest' do
|
2
|
+
watch(%r|^spec/(.*)_spec\.rb|)
|
3
|
+
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
4
|
+
watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
5
|
+
end
|
6
|
+
|
7
|
+
guard 'cucumber' do
|
8
|
+
watch(%r{^features/.+\.feature$})
|
9
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
10
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
|
11
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || 'features'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
guard 'cane' do
|
16
|
+
watch(%r|.*\.rb|)
|
17
|
+
watch('.cane')
|
18
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Author:: Fletcher Nichol (<fnichol@nichol.ca>)
|
2
|
+
|
3
|
+
Copyright 2013 Fletcher Nichol
|
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,35 @@
|
|
1
|
+
# Kitchen Busser
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/fnichol/kb-ruby.png?branch=master)](https://travis-ci.org/fnichol/kb-ruby)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/fnichol/kb-ruby.png)](https://codeclimate.com/github/fnichol/kb-ruby)
|
5
|
+
|
6
|
+
The Kitchen Busser (kb) is a test setup and execution framework designed to
|
7
|
+
work on remote nodes whose system dependencies cannot be relied upon, except
|
8
|
+
for an Omnibus installation of Chef. It uses a plugin architecture to add
|
9
|
+
support for different testing strategies such minitest, cucumber, bash, etc.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'kb'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install kb
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
TODO: Write usage instructions here
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'cucumber/rake/task'
|
4
|
+
require 'cane/rake_task'
|
5
|
+
require 'tailor/rake_task'
|
6
|
+
|
7
|
+
Rake::TestTask.new(:unit) do |t|
|
8
|
+
t.libs.push "lib"
|
9
|
+
t.test_files = FileList['spec/**/*_spec.rb']
|
10
|
+
t.verbose = true
|
11
|
+
end
|
12
|
+
|
13
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
14
|
+
t.cucumber_opts = ['features', '-x', '--format progress']
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run all test suites"
|
18
|
+
task :test => [:unit, :features]
|
19
|
+
|
20
|
+
desc "Run cane to check quality metrics"
|
21
|
+
Cane::RakeTask.new do |cane|
|
22
|
+
cane.canefile = './.cane'
|
23
|
+
end
|
24
|
+
|
25
|
+
Tailor::RakeTask.new
|
26
|
+
|
27
|
+
desc "Display LOC stats"
|
28
|
+
task :stats do
|
29
|
+
puts "\n## Production Code Stats"
|
30
|
+
sh "countloc -r lib"
|
31
|
+
puts "\n## Test Code Stats"
|
32
|
+
sh "countloc -r spec features"
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Run all quality tasks"
|
36
|
+
task :quality => [:cane, :tailor, :stats]
|
37
|
+
|
38
|
+
task :default => [:test, :quality]
|
data/bin/kb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
|
3
|
+
Given(/^a KB_ROOT of "(.*?)"$/) do |kb_root|
|
4
|
+
ENV['KB_ROOT'] = kb_root
|
5
|
+
end
|
6
|
+
|
7
|
+
Given(/^a test KB_ROOT directory named "(.*?)"$/) do |name|
|
8
|
+
kb_root = Pathname.new(Dir.mktmpdir(name))
|
9
|
+
(kb_root + "suites").mkpath
|
10
|
+
ENV['KB_ROOT'] = kb_root.to_s
|
11
|
+
@kb_root_dirs << kb_root
|
12
|
+
end
|
13
|
+
|
14
|
+
Given(/^I delete the KB_ROOT directory$/) do
|
15
|
+
FileUtils.rm_rf(ENV['KB_ROOT'])
|
16
|
+
end
|
17
|
+
|
18
|
+
Given(/^a suite directory named "(.*?)"$/) do |name|
|
19
|
+
FileUtils.mkdir_p(File.join(ENV['KB_ROOT'], "suites", name))
|
20
|
+
end
|
21
|
+
|
22
|
+
Then(/^the suite directory named "(.*?)" should not exist$/) do |name|
|
23
|
+
directory = File.join(ENV['KB_ROOT'], "suites", name)
|
24
|
+
check_directory_presence([directory], false)
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Feature: Suite cleanup command
|
2
|
+
In order to have a fresh suite directory base for each test run
|
3
|
+
As a user of kb
|
4
|
+
I want a command to clean any suite subdirectories
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a test KB_ROOT directory named "kb-suite"
|
8
|
+
|
9
|
+
Scenario: A nonexistent base suite path
|
10
|
+
Given I delete the KB_ROOT directory
|
11
|
+
When I run `kb suite cleanup`
|
12
|
+
Then the output should contain "does not exist"
|
13
|
+
And the exit status should be 0
|
14
|
+
|
15
|
+
Scenario: An empty base suite path
|
16
|
+
When I run `kb suite cleanup`
|
17
|
+
Then the stdout should not contain anything
|
18
|
+
And the exit status should be 0
|
19
|
+
|
20
|
+
Scenario: A base suite path containing suite directories
|
21
|
+
Given a suite directory named "bats"
|
22
|
+
And a suite directory named "minitest"
|
23
|
+
When I run `kb suite cleanup`
|
24
|
+
Then the output should contain "bats"
|
25
|
+
And the output should contain "minitest"
|
26
|
+
And the suite directory named "bats" should not exist
|
27
|
+
And the suite directory named "minitest" should not exist
|
28
|
+
And the exit status should be 0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Feature: Suite path command
|
2
|
+
In order to determine the directory containing suite tests
|
3
|
+
As a user of kb
|
4
|
+
I want a command to echo this directory on standard output
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a KB_ROOT of "/path/to/kb"
|
8
|
+
|
9
|
+
Scenario: Get base suite path
|
10
|
+
When I successfully run `kb suite path`
|
11
|
+
Then the output should contain exactly "/path/to/kb/suites\n"
|
12
|
+
|
13
|
+
Scenario: Get suite path for a plugin
|
14
|
+
When I successfully run `kb suite path footester`
|
15
|
+
Then the output should contain exactly "/path/to/kb/suites/footester\n"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'aruba/cucumber'
|
3
|
+
|
4
|
+
SimpleCov.command_name "features"
|
5
|
+
|
6
|
+
Before do
|
7
|
+
@aruba_timeout_seconds = 5
|
8
|
+
@kb_root_dirs = []
|
9
|
+
end
|
10
|
+
|
11
|
+
After do |s|
|
12
|
+
# Tell Cucumber to quit after this scenario is done - if it failed.
|
13
|
+
# This is useful to inspect the 'tmp/aruba' directory before any other
|
14
|
+
# steps are executed and clear it out.
|
15
|
+
Cucumber.wants_to_quit = true if s.failed?
|
16
|
+
|
17
|
+
ENV['KB_ROOT'] = ENV.delete('_CUKE_KB_ROOT') if ENV['_CUKE_KB_ROOT']
|
18
|
+
@kb_root_dirs.each { |dir| FileUtils.rm_rf(dir) }
|
19
|
+
end
|
data/kb.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'kb/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kb"
|
8
|
+
spec.version = KB::VERSION
|
9
|
+
spec.authors = ["Fletcher Nichol"]
|
10
|
+
spec.email = ["fnichol@nichol.ca"]
|
11
|
+
spec.description = %q{Kitchen Busser - Runs tests for projects in test-kitchen}
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = "https://github.com/fnichol/kb-ruby"
|
14
|
+
spec.license = 'Apache 2.0'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.required_ruby_version = ">= 1.9.1"
|
22
|
+
|
23
|
+
spec.add_dependency 'thor'
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency 'minitest'
|
28
|
+
spec.add_development_dependency 'guard-minitest'
|
29
|
+
spec.add_development_dependency 'mocha'
|
30
|
+
spec.add_development_dependency 'fakefs'
|
31
|
+
spec.add_development_dependency 'aruba'
|
32
|
+
spec.add_development_dependency 'guard-cucumber'
|
33
|
+
|
34
|
+
spec.add_development_dependency 'cane'
|
35
|
+
spec.add_development_dependency 'guard-cane'
|
36
|
+
spec.add_development_dependency 'tailor'
|
37
|
+
spec.add_development_dependency 'simplecov'
|
38
|
+
spec.add_development_dependency 'countloc'
|
39
|
+
end
|
data/lib/kb/cli.rb
ADDED
@@ -0,0 +1,33 @@
|
|
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 'kb/thor'
|
20
|
+
require 'kb/command/suite'
|
21
|
+
|
22
|
+
module KB
|
23
|
+
|
24
|
+
# Main command line interface class which delegates to subcommands.
|
25
|
+
#
|
26
|
+
# @author Fletcher Nichol <fnichol@nichol.ca>
|
27
|
+
#
|
28
|
+
class CLI < Thor::Base
|
29
|
+
|
30
|
+
register KB::Command::Suite, "suite",
|
31
|
+
"suite SUBCOMMAND", "Suite subcommands"
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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 'kb/thor'
|
20
|
+
require 'kb/command/suite_cleanup'
|
21
|
+
require 'kb/command/suite_path'
|
22
|
+
|
23
|
+
module KB
|
24
|
+
|
25
|
+
module Command
|
26
|
+
|
27
|
+
# Suite commands.
|
28
|
+
#
|
29
|
+
# @author Fletcher Nichol <fnichol@nichol.ca>
|
30
|
+
#
|
31
|
+
class Suite < KB::Thor::Base
|
32
|
+
|
33
|
+
register KB::Command::SuiteCleanup, "cleanup",
|
34
|
+
"cleanup", "Cleans up test suite directories"
|
35
|
+
register KB::Command::SuitePath, "path",
|
36
|
+
"path [<plugin_name>]", "Displays the directory for suite tests"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,43 @@
|
|
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 'kb/thor'
|
20
|
+
|
21
|
+
module KB
|
22
|
+
|
23
|
+
module Command
|
24
|
+
|
25
|
+
# Suite cleanup command.
|
26
|
+
#
|
27
|
+
# @author Fletcher Nichol <fnichol@nichol.ca>
|
28
|
+
#
|
29
|
+
class SuiteCleanup < KB::Thor::BaseGroup
|
30
|
+
|
31
|
+
def cleanup
|
32
|
+
if suite_path.directory?
|
33
|
+
Pathname.glob(suite_path + "*").each do |dir|
|
34
|
+
info "Removing #{dir}"
|
35
|
+
dir.rmtree
|
36
|
+
end
|
37
|
+
else
|
38
|
+
info "Suite path directory #{suite_path} does not exist, skipping."
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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 'kb/thor'
|
20
|
+
|
21
|
+
module KB
|
22
|
+
|
23
|
+
module Command
|
24
|
+
|
25
|
+
# Suite path command.
|
26
|
+
#
|
27
|
+
# @author Fletcher Nichol <fnichol@nichol.ca>
|
28
|
+
#
|
29
|
+
class SuitePath < KB::Thor::BaseGroup
|
30
|
+
|
31
|
+
argument :suite_name, :required => false
|
32
|
+
|
33
|
+
def path
|
34
|
+
say suite_path(suite_name)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/kb/helpers.rb
ADDED
@@ -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 KB
|
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['KB_ROOT'] || "/opt/kb")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/kb/thor.rb
ADDED
@@ -0,0 +1,48 @@
|
|
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 'kb/helpers'
|
22
|
+
require 'kb/ui'
|
23
|
+
|
24
|
+
module KB
|
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
|
+
end
|
37
|
+
|
38
|
+
# Base class for all Thor Group subclasses which includes useful mixins.
|
39
|
+
#
|
40
|
+
# @author Fletcher Nichol <fnichol@nichol.ca>
|
41
|
+
#
|
42
|
+
class BaseGroup < ::Thor::Group
|
43
|
+
|
44
|
+
include Helpers
|
45
|
+
include UI
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/kb/ui.rb
ADDED
@@ -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 'thor/shell'
|
20
|
+
|
21
|
+
module KB
|
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
|
+
end
|
37
|
+
end
|
data/lib/kb/version.rb
ADDED
@@ -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 KB
|
20
|
+
VERSION = "1.0.0.alpha.0"
|
21
|
+
end
|
data/lib/kb.rb
ADDED
@@ -0,0 +1,22 @@
|
|
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 "kb/version"
|
20
|
+
|
21
|
+
module KB
|
22
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
require 'kb/helpers'
|
4
|
+
|
5
|
+
describe KB::Helpers do
|
6
|
+
|
7
|
+
include KB::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/kb/suites"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "Returns a suite path given a suite name" do
|
22
|
+
suite_path("fuzzy").to_s.must_equal "/opt/kb/suites/fuzzy"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "with a custom root path" do
|
27
|
+
|
28
|
+
before { ENV['_SPEC_KB_ROOT'] = ENV['KB_ROOT'] }
|
29
|
+
after { ENV['KB_ROOT'] = ENV.delete('_SPEC_KB_ROOT') }
|
30
|
+
|
31
|
+
it "Returns a base path if no suite name is given" do
|
32
|
+
ENV['KB_ROOT'] = "/path/to/kb"
|
33
|
+
suite_path.to_s.must_equal "/path/to/kb/suites"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "Returns a suite path given a suite name" do
|
37
|
+
ENV['KB_ROOT'] = "/path/to/kb"
|
38
|
+
suite_path("fuzzy").to_s.must_equal "/path/to/kb/suites/fuzzy"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -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,304 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.alpha.0
|
5
|
+
prerelease: 6
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Fletcher Nichol
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-15 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
|
+
- kb
|
243
|
+
extensions: []
|
244
|
+
extra_rdoc_files: []
|
245
|
+
files:
|
246
|
+
- .cane
|
247
|
+
- .gitignore
|
248
|
+
- .simplecov
|
249
|
+
- .tailor
|
250
|
+
- .travis.yml
|
251
|
+
- Gemfile
|
252
|
+
- Guardfile
|
253
|
+
- LICENSE
|
254
|
+
- README.md
|
255
|
+
- Rakefile
|
256
|
+
- bin/kb
|
257
|
+
- features/step_definitions/kb_root_steps.rb
|
258
|
+
- features/suite_cleanup_command.feature
|
259
|
+
- features/suite_path_command.feature
|
260
|
+
- features/support/env.rb
|
261
|
+
- kb.gemspec
|
262
|
+
- lib/kb.rb
|
263
|
+
- lib/kb/cli.rb
|
264
|
+
- lib/kb/command/suite.rb
|
265
|
+
- lib/kb/command/suite_cleanup.rb
|
266
|
+
- lib/kb/command/suite_path.rb
|
267
|
+
- lib/kb/helpers.rb
|
268
|
+
- lib/kb/thor.rb
|
269
|
+
- lib/kb/ui.rb
|
270
|
+
- lib/kb/version.rb
|
271
|
+
- spec/kb/helpers_spec.rb
|
272
|
+
- spec/spec_helper.rb
|
273
|
+
homepage: https://github.com/fnichol/kb-ruby
|
274
|
+
licenses:
|
275
|
+
- Apache 2.0
|
276
|
+
post_install_message:
|
277
|
+
rdoc_options: []
|
278
|
+
require_paths:
|
279
|
+
- lib
|
280
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
281
|
+
none: false
|
282
|
+
requirements:
|
283
|
+
- - ! '>='
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: 1.9.1
|
286
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
287
|
+
none: false
|
288
|
+
requirements:
|
289
|
+
- - ! '>'
|
290
|
+
- !ruby/object:Gem::Version
|
291
|
+
version: 1.3.1
|
292
|
+
requirements: []
|
293
|
+
rubyforge_project:
|
294
|
+
rubygems_version: 1.8.24
|
295
|
+
signing_key:
|
296
|
+
specification_version: 3
|
297
|
+
summary: Kitchen Busser - Runs tests for projects in test-kitchen
|
298
|
+
test_files:
|
299
|
+
- features/step_definitions/kb_root_steps.rb
|
300
|
+
- features/suite_cleanup_command.feature
|
301
|
+
- features/suite_path_command.feature
|
302
|
+
- features/support/env.rb
|
303
|
+
- spec/kb/helpers_spec.rb
|
304
|
+
- spec/spec_helper.rb
|