hobo-inviqa 0.0.2
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.
- data/Gemfile +4 -0
- data/Gemfile.lock +93 -0
- data/Guardfile +14 -0
- data/Hobofile +34 -0
- data/Rakefile +2 -0
- data/bin/hobo +23 -0
- data/features/deps.feature +43 -0
- data/features/hobo/basic.feature +30 -0
- data/features/hobo/help.feature +12 -0
- data/features/hobo/subcommands.feature +16 -0
- data/features/seed/plant.feature +64 -0
- data/features/step_definitions/seed.rb +11 -0
- data/features/support/env.rb +6 -0
- data/features/vm.feature +0 -0
- data/hobo.gemspec +37 -0
- data/lib/hobo.rb +44 -0
- data/lib/hobo/cli.rb +185 -0
- data/lib/hobo/config/file.rb +21 -0
- data/lib/hobo/error_handlers/debug.rb +9 -0
- data/lib/hobo/error_handlers/friendly.rb +52 -0
- data/lib/hobo/errors.rb +60 -0
- data/lib/hobo/help_formatter.rb +111 -0
- data/lib/hobo/helper/file_locator.rb +39 -0
- data/lib/hobo/helper/shell.rb +59 -0
- data/lib/hobo/lib/seed/project.rb +41 -0
- data/lib/hobo/lib/seed/replacer.rb +57 -0
- data/lib/hobo/lib/seed/seed.rb +43 -0
- data/lib/hobo/metadata.rb +28 -0
- data/lib/hobo/patches/rake.rb +56 -0
- data/lib/hobo/patches/slop.rb +22 -0
- data/lib/hobo/paths.rb +49 -0
- data/lib/hobo/tasks/debug.rb +22 -0
- data/lib/hobo/tasks/deps.rb +45 -0
- data/lib/hobo/tasks/seed.rb +43 -0
- data/lib/hobo/tasks/tools.rb +13 -0
- data/lib/hobo/tasks/vm.rb +49 -0
- data/lib/hobo/ui.rb +96 -0
- data/lib/hobo/util.rb +7 -0
- data/lib/hobo/version.rb +3 -0
- data/spec/hobo/cli_spec.rb +135 -0
- data/spec/hobo/config/file_spec.rb +48 -0
- data/spec/hobo/error_handlers/debug_spec.rb +10 -0
- data/spec/hobo/error_handlers/friendly_spec.rb +81 -0
- data/spec/hobo/error_spec.rb +0 -0
- data/spec/hobo/help_formatter_spec.rb +131 -0
- data/spec/hobo/helpers/file_locator_spec.rb +7 -0
- data/spec/hobo/helpers/shell_spec.rb +7 -0
- data/spec/hobo/lib/seed/project_spec.rb +83 -0
- data/spec/hobo/lib/seed/replacer_spec.rb +47 -0
- data/spec/hobo/lib/seed/seed_spec.rb +95 -0
- data/spec/hobo/metadata_spec.rb +46 -0
- data/spec/hobo/patches/rake_spec.rb +0 -0
- data/spec/hobo/paths_spec.rb +77 -0
- data/spec/hobo/ui_spec.rb +64 -0
- data/spec/spec_helper.rb +6 -0
- metadata +355 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hobo-inviqa (0.0.2)
|
5
|
+
bundler
|
6
|
+
highline
|
7
|
+
rake
|
8
|
+
rake-hooks
|
9
|
+
slop
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
aruba (0.5.4)
|
15
|
+
childprocess (>= 0.3.6)
|
16
|
+
cucumber (>= 1.1.1)
|
17
|
+
rspec-expectations (>= 2.7.0)
|
18
|
+
builder (3.2.2)
|
19
|
+
celluloid (0.15.2)
|
20
|
+
timers (~> 1.1.0)
|
21
|
+
childprocess (0.4.0)
|
22
|
+
ffi (~> 1.0, >= 1.0.11)
|
23
|
+
coderay (1.1.0)
|
24
|
+
cucumber (1.3.10)
|
25
|
+
builder (>= 2.1.2)
|
26
|
+
diff-lcs (>= 1.1.3)
|
27
|
+
gherkin (~> 2.12)
|
28
|
+
multi_json (>= 1.7.5, < 2.0)
|
29
|
+
multi_test (>= 0.0.2)
|
30
|
+
diff-lcs (1.2.5)
|
31
|
+
fakefs (0.5.0)
|
32
|
+
ffi (1.9.3)
|
33
|
+
formatador (0.2.4)
|
34
|
+
gherkin (2.12.2)
|
35
|
+
multi_json (~> 1.3)
|
36
|
+
guard (2.2.5)
|
37
|
+
formatador (>= 0.2.4)
|
38
|
+
listen (~> 2.1)
|
39
|
+
lumberjack (~> 1.0)
|
40
|
+
pry (>= 0.9.12)
|
41
|
+
thor (>= 0.18.1)
|
42
|
+
guard-cucumber (1.4.1)
|
43
|
+
cucumber (>= 1.2.0)
|
44
|
+
guard (>= 1.1.0)
|
45
|
+
guard-rspec (4.2.5)
|
46
|
+
guard (~> 2.1)
|
47
|
+
rspec (>= 2.14, < 4.0)
|
48
|
+
highline (1.6.20)
|
49
|
+
listen (2.4.0)
|
50
|
+
celluloid (>= 0.15.2)
|
51
|
+
rb-fsevent (>= 0.9.3)
|
52
|
+
rb-inotify (>= 0.9)
|
53
|
+
lumberjack (1.0.4)
|
54
|
+
method_source (0.8.2)
|
55
|
+
multi_json (1.8.4)
|
56
|
+
multi_test (0.0.3)
|
57
|
+
pry (0.9.12.6)
|
58
|
+
coderay (~> 1.0)
|
59
|
+
method_source (~> 0.8)
|
60
|
+
slop (~> 3.4)
|
61
|
+
rake (10.1.1)
|
62
|
+
rake-hooks (1.2.3)
|
63
|
+
rake
|
64
|
+
rb-fsevent (0.9.4)
|
65
|
+
rb-inotify (0.9.3)
|
66
|
+
ffi (>= 0.5.0)
|
67
|
+
rr (1.1.2)
|
68
|
+
rspec (2.14.1)
|
69
|
+
rspec-core (~> 2.14.0)
|
70
|
+
rspec-expectations (~> 2.14.0)
|
71
|
+
rspec-mocks (~> 2.14.0)
|
72
|
+
rspec-core (2.14.7)
|
73
|
+
rspec-expectations (2.14.4)
|
74
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
75
|
+
rspec-mocks (2.14.4)
|
76
|
+
slop (3.4.7)
|
77
|
+
thor (0.18.1)
|
78
|
+
timers (1.1.0)
|
79
|
+
|
80
|
+
PLATFORMS
|
81
|
+
ruby
|
82
|
+
|
83
|
+
DEPENDENCIES
|
84
|
+
aruba
|
85
|
+
bundler
|
86
|
+
fakefs
|
87
|
+
guard (~> 2.2.5)
|
88
|
+
guard-cucumber (~> 1.4.1)
|
89
|
+
guard-rspec (~> 4.2.4)
|
90
|
+
hobo-inviqa!
|
91
|
+
rake
|
92
|
+
rr
|
93
|
+
rspec
|
data/Guardfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :rspec do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
end
|
9
|
+
|
10
|
+
guard 'cucumber' do
|
11
|
+
watch(%r{^features/.+\.feature$})
|
12
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
13
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
14
|
+
end
|
data/Hobofile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
desc "lala"
|
4
|
+
task "top-level" do
|
5
|
+
Hobo.ui.info "top level"
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :test do
|
9
|
+
desc "Does non-interactive things"
|
10
|
+
task 'non-interactive' do
|
11
|
+
Hobo.ui.info Hobo.ui.ask "A question", default: "Used defaults"
|
12
|
+
end
|
13
|
+
|
14
|
+
task "subcommand" do
|
15
|
+
Hobo.ui.info "Subcommand test"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "description"
|
19
|
+
long_desc "long description"
|
20
|
+
option "-o", "--option", "Option description"
|
21
|
+
hidden true
|
22
|
+
task "metadata", [ :arg ] do
|
23
|
+
Hobo.ui.info "metadata"
|
24
|
+
end
|
25
|
+
|
26
|
+
option "--testing=", "description"
|
27
|
+
task 'option-test' do |task|
|
28
|
+
Hobo.ui.info task.opts[:testing]
|
29
|
+
end
|
30
|
+
|
31
|
+
task 'argument-test', [ :test ] do |task, args|
|
32
|
+
Hobo.ui.info args[:test]
|
33
|
+
end
|
34
|
+
end
|
data/Rakefile
ADDED
data/bin/hobo
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Hack to allow testing with Aruba (for now)
|
4
|
+
$:.push File.expand_path(File.join("..", "..", "lib"), __FILE__)
|
5
|
+
|
6
|
+
require 'hobo'
|
7
|
+
require 'slop'
|
8
|
+
|
9
|
+
error_handler = Hobo::ErrorHandlers::Friendly.new
|
10
|
+
Hobo.ui = Hobo::Ui.new
|
11
|
+
|
12
|
+
# Options parsed here will be hidden from the main app
|
13
|
+
slop = Slop.parse! do
|
14
|
+
on '--debug' do
|
15
|
+
error_handler = Hobo::ErrorHandlers::Debug.new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
begin
|
20
|
+
Hobo::Cli.new(slop: slop).start
|
21
|
+
rescue Exception => error
|
22
|
+
exit error_handler.handle(error)
|
23
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
Feature: Dependencies
|
2
|
+
|
3
|
+
Scenario: deps:gems should install Gemfile dependencies
|
4
|
+
Given a file named "Gemfile" with:
|
5
|
+
"""
|
6
|
+
source 'https://rubygems.org'
|
7
|
+
gem 'bundler'
|
8
|
+
"""
|
9
|
+
And an empty file named "Hobofile"
|
10
|
+
When I run `hobo deps gems`
|
11
|
+
Then the output should contain "Using bundler"
|
12
|
+
And a file named "Gemfile.lock" should exist
|
13
|
+
|
14
|
+
Scenario: deps:composer should install composer dependencies
|
15
|
+
Given a file named "composer.json" with:
|
16
|
+
"""
|
17
|
+
{
|
18
|
+
"require": {
|
19
|
+
"whatthejeff/fab": "*"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
"""
|
23
|
+
And an empty file named "Hobofile"
|
24
|
+
When I run `hobo deps composer`
|
25
|
+
Then the output should contain "Installing whatthejeff/fab"
|
26
|
+
And a file named "composer.lock" should exist
|
27
|
+
|
28
|
+
Scenario: deps:chef should install chef dependencies
|
29
|
+
Given a file named "Cheffile" with:
|
30
|
+
"""
|
31
|
+
site 'http://community.opscode.com/api/v1'
|
32
|
+
cookbook 'apache2'
|
33
|
+
"""
|
34
|
+
And an empty file named "Hobofile"
|
35
|
+
And a file named "Gemfile" with:
|
36
|
+
"""
|
37
|
+
source 'https://rubygems.org'
|
38
|
+
gem 'librarian-chef'
|
39
|
+
"""
|
40
|
+
When I run `bundle install`
|
41
|
+
And I run `hobo deps chef`
|
42
|
+
Then the output should contain "apache2"
|
43
|
+
And a file named "Cheffile.lock" should exist
|
@@ -0,0 +1,30 @@
|
|
1
|
+
Feature: Basics
|
2
|
+
Scenario: No arguments should show help
|
3
|
+
When I run `hobo`
|
4
|
+
Then the output should contain "Usage:"
|
5
|
+
|
6
|
+
Scenario: -v should show version
|
7
|
+
When I run `hobo -v`
|
8
|
+
Then the output should contain "Hobo version"
|
9
|
+
|
10
|
+
Scenario: --version should show version
|
11
|
+
When I run `hobo --version`
|
12
|
+
Then the output should contain "Hobo version"
|
13
|
+
|
14
|
+
Scenario: An invalid command should fail gracefully
|
15
|
+
When I run `hobo jibberjabber`
|
16
|
+
Then the output should contain "Invalid command or option"
|
17
|
+
And the exit status should be 4
|
18
|
+
|
19
|
+
Scenario: An invalid option should fail gracefully
|
20
|
+
When I run `hobo --jibberjabber`
|
21
|
+
Then the output should contain "Invalid command or option"
|
22
|
+
And the exit status should be 4
|
23
|
+
|
24
|
+
Scenario: --debug should display backtraces
|
25
|
+
When I run `hobo jibberjabber --debug`
|
26
|
+
Then the output should contain "Hobo::InvalidCommandOrOpt"
|
27
|
+
|
28
|
+
Scenario: --non-interactive should cause default options to be used
|
29
|
+
When I run `hobo test non-interactive --non-interactive`
|
30
|
+
Then the output should contain "Used defaults"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
Feature: Hobo help
|
2
|
+
Scenario: --help should show help
|
3
|
+
When I run `hobo --help`
|
4
|
+
Then the output should contain "Usage:"
|
5
|
+
And the output should contain "Global options:"
|
6
|
+
And the output should contain "Commands:"
|
7
|
+
|
8
|
+
Scenario: --h should show help
|
9
|
+
When I run `hobo --help`
|
10
|
+
Then the output should contain "Usage:"
|
11
|
+
And the output should contain "Global options:"
|
12
|
+
And the output should contain "Commands:"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Feature: Subcommands
|
2
|
+
|
3
|
+
Scenario: Subcommand with --help should show command help
|
4
|
+
When I run `hobo test non-interactive --help`
|
5
|
+
Then the output should contain "hobo test non-interactive [options]"
|
6
|
+
|
7
|
+
Scenario: Namespace should show subcommands
|
8
|
+
When I run `hobo test`
|
9
|
+
Then the output should contain "non-interactive"
|
10
|
+
And the output should contain "Does non-interactive things"
|
11
|
+
|
12
|
+
Scenario: Subcommand should execute
|
13
|
+
When I run `hobo test non-interactive` interactively
|
14
|
+
And I type "Testing"
|
15
|
+
Then the output should contain "Subcommand test"
|
16
|
+
And the output should contain "Testing"
|
@@ -0,0 +1,64 @@
|
|
1
|
+
Feature: Plant
|
2
|
+
|
3
|
+
Scenario: Plant without name should fail gracefully
|
4
|
+
When I run `hobo seed plant`
|
5
|
+
Then the output should contain "Not enough arguments for seed:plant"
|
6
|
+
|
7
|
+
Scenario: Plant with name should prompt for repository and seed
|
8
|
+
Given there is a seed called "testing" with:
|
9
|
+
"""
|
10
|
+
test
|
11
|
+
"""
|
12
|
+
And I run `hobo seed plant seed_plant_0` interactively
|
13
|
+
And I type "git://test_repo"
|
14
|
+
And I type "./testing"
|
15
|
+
And I run `sleep 0.5`
|
16
|
+
And I run `git --git-dir=seed_plant_0/.git remote show origin -n`
|
17
|
+
Then the output should contain "git://test_repo"
|
18
|
+
And the file "seed_plant_0/test" should contain "test"
|
19
|
+
|
20
|
+
Scenario: Plant with name and --git-url should prompt for seed
|
21
|
+
Given there is a seed called "testing" with:
|
22
|
+
"""
|
23
|
+
test
|
24
|
+
"""
|
25
|
+
When I run `hobo seed plant seed_plant_0 --git-url=git://test_repo` interactively
|
26
|
+
And I type "./testing"
|
27
|
+
And I run `sleep 0.5`
|
28
|
+
And I run `git --git-dir=seed_plant_0/.git remote show origin -n`
|
29
|
+
Then the output should contain "git://test_repo"
|
30
|
+
And the file "seed_plant_0/test" should contain "test"
|
31
|
+
|
32
|
+
Scenario: Plant with name, --git-url and --seed should not prompt
|
33
|
+
Given there is a seed called "testing" with:
|
34
|
+
"""
|
35
|
+
test
|
36
|
+
"""
|
37
|
+
When I run `hobo seed plant seed_plant_0 --git-url=git://test_repo --seed=./testing`
|
38
|
+
And I run `sleep 0.5`
|
39
|
+
And I run `git --git-dir=seed_plant_0/.git remote show origin -n`
|
40
|
+
Then the output should contain "git://test_repo"
|
41
|
+
And the file "seed_plant_0/test" should contain "test"
|
42
|
+
|
43
|
+
Scenario: Plant should replace placeholders
|
44
|
+
Given there is a seed called "testing" with:
|
45
|
+
"""
|
46
|
+
NAME:{{name}}
|
47
|
+
SEED:{{seed.name}}
|
48
|
+
"""
|
49
|
+
When I run `hobo seed plant seed_plant_0 --git-url=git://test_repo --seed=./testing`
|
50
|
+
Then the file "seed_plant_0/test" should contain "NAME:seed_plant_0"
|
51
|
+
And the file "seed_plant_0/test" should contain "SEED:testing"
|
52
|
+
|
53
|
+
Scenario: Plant should fail gracefully with invalid seed
|
54
|
+
When I run `hobo seed plant seed_plant_0 --git-url=git://test_repo --seed=./not-exist`
|
55
|
+
Then the output should contain "The following external command appears to have failed"
|
56
|
+
|
57
|
+
Scenario: Plant should fail gracefully if target directory exists
|
58
|
+
Given there is a seed called "testing" with:
|
59
|
+
"""
|
60
|
+
test
|
61
|
+
"""
|
62
|
+
And an empty file named "seed_plant_0"
|
63
|
+
When I run `hobo seed plant seed_plant_0 --git-url=git://test_repo --seed=./not-exist`
|
64
|
+
Then the output should contain "seed_plant_0 already exists"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
Given(/^there is a seed called "(.*?)" with:$/) do |seed, contents|
|
4
|
+
create_dir(seed)
|
5
|
+
cd(seed)
|
6
|
+
write_file("test", contents)
|
7
|
+
run_simple(unescape("git init"))
|
8
|
+
run_simple(unescape("git add *"))
|
9
|
+
run_simple(unescape("git commit -m 'init'"))
|
10
|
+
cd('..')
|
11
|
+
end
|
data/features/vm.feature
ADDED
File without changes
|
data/hobo.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'hobo/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "hobo-inviqa"
|
9
|
+
spec.version = Hobo::VERSION
|
10
|
+
spec.authors = ["Mike Simons"]
|
11
|
+
spec.email = ["msimons@inviqa.com"]
|
12
|
+
spec.description = %q{Inviqan toolbelt}
|
13
|
+
spec.summary = %q{Inviqan toolbelt}
|
14
|
+
spec.homepage = ""
|
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
|
+
# TODO pin
|
22
|
+
spec.add_dependency "slop"
|
23
|
+
spec.add_dependency "highline"
|
24
|
+
spec.add_dependency "rake"
|
25
|
+
spec.add_dependency "rake-hooks"
|
26
|
+
spec.add_dependency "bundler"
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler"
|
29
|
+
spec.add_development_dependency "rake"
|
30
|
+
spec.add_development_dependency "aruba"
|
31
|
+
spec.add_development_dependency "rspec"
|
32
|
+
spec.add_development_dependency "fakefs"
|
33
|
+
spec.add_development_dependency "rr"
|
34
|
+
spec.add_development_dependency "guard", "~> 2.2.5"
|
35
|
+
spec.add_development_dependency "guard-rspec", "~> 4.2.4"
|
36
|
+
spec.add_development_dependency "guard-cucumber", "~> 1.4.1"
|
37
|
+
end
|
data/lib/hobo.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# External deps
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/hooks'
|
4
|
+
require 'slop'
|
5
|
+
require 'highline'
|
6
|
+
require 'open3'
|
7
|
+
require 'tempfile'
|
8
|
+
require 'shellwords'
|
9
|
+
require 'find'
|
10
|
+
|
11
|
+
# DSL enhancements
|
12
|
+
require 'hobo/metadata'
|
13
|
+
require 'hobo/patches/rake'
|
14
|
+
require 'hobo/patches/slop'
|
15
|
+
|
16
|
+
# Task helpers
|
17
|
+
require 'hobo/helper/shell'
|
18
|
+
require 'hobo/helper/file_locator'
|
19
|
+
|
20
|
+
# Basics
|
21
|
+
require 'hobo/version'
|
22
|
+
require 'hobo/paths'
|
23
|
+
require 'hobo/errors'
|
24
|
+
require 'hobo/ui'
|
25
|
+
require 'hobo/util'
|
26
|
+
require 'hobo/help_formatter'
|
27
|
+
require 'hobo/error_handlers/debug'
|
28
|
+
require 'hobo/error_handlers/friendly'
|
29
|
+
require 'hobo/config/file'
|
30
|
+
|
31
|
+
# Libs
|
32
|
+
require 'hobo/lib/seed/project'
|
33
|
+
require 'hobo/lib/seed/replacer'
|
34
|
+
require 'hobo/lib/seed/seed'
|
35
|
+
|
36
|
+
# Built-in tasks
|
37
|
+
require 'hobo/tasks/debug'
|
38
|
+
require 'hobo/tasks/deps'
|
39
|
+
require 'hobo/tasks/seed'
|
40
|
+
require 'hobo/tasks/vm'
|
41
|
+
require 'hobo/tasks/tools'
|
42
|
+
|
43
|
+
# App
|
44
|
+
require 'hobo/cli'
|