hobo-inviqa 0.0.7 → 0.0.8
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.
- checksums.yaml +15 -0
- data/.editorconfig +10 -0
- data/Gemfile.lock +19 -4
- data/Guardfile +2 -2
- data/Hobofile +5 -1
- data/README.md +8 -32
- data/bin/hobo +12 -18
- data/hobo.gemspec +3 -0
- data/lib/hobo.rb +8 -1
- data/lib/hobo/cli.rb +14 -3
- data/lib/hobo/error_handlers/debug.rb +5 -2
- data/lib/hobo/error_handlers/exit_code_map.rb +16 -0
- data/lib/hobo/error_handlers/friendly.rb +8 -8
- data/lib/hobo/errors.rb +11 -1
- data/lib/hobo/helper/http_download.rb +41 -0
- data/lib/hobo/helper/shell.rb +3 -2
- data/lib/hobo/helper/vm_command.rb +235 -14
- data/lib/hobo/lib/host_check.rb +20 -6
- data/lib/hobo/lib/host_check/deps.rb +22 -4
- data/lib/hobo/lib/host_check/git.rb +41 -17
- data/lib/hobo/lib/host_check/ruby.rb +30 -20
- data/lib/hobo/lib/host_check/vagrant.rb +37 -6
- data/lib/hobo/lib/s3sync.rb +22 -44
- data/lib/hobo/lib/seed/project.rb +10 -6
- data/lib/hobo/patches/slop.rb +21 -2
- data/lib/hobo/tasks/assets.rb +12 -15
- data/lib/hobo/tasks/config.rb +15 -0
- data/lib/hobo/tasks/deps.rb +37 -6
- data/lib/hobo/tasks/system.rb +15 -0
- data/lib/hobo/tasks/system/completions.rb +76 -0
- data/lib/hobo/tasks/tools.rb +10 -6
- data/lib/hobo/tasks/vm.rb +64 -11
- data/lib/hobo/ui.rb +27 -10
- data/lib/hobo/util.rb +36 -2
- data/lib/hobo/version.rb +2 -2
- data/spec/hobo/asset_applicator_spec.rb +2 -2
- data/spec/hobo/cli_spec.rb +40 -24
- data/spec/hobo/config/file_spec.rb +1 -3
- data/spec/hobo/error_handlers/debug_spec.rb +39 -5
- data/spec/hobo/error_handlers/friendly_spec.rb +38 -21
- data/spec/hobo/help_formatter_spec.rb +3 -3
- data/spec/hobo/helpers/file_locator_spec.rb +2 -2
- data/spec/hobo/helpers/shell_spec.rb +2 -2
- data/spec/hobo/helpers/vm_command_spec.rb +54 -21
- data/spec/hobo/lib/s3sync_spec.rb +6 -3
- data/spec/hobo/lib/seed/project_spec.rb +2 -3
- data/spec/hobo/lib/seed/replacer_spec.rb +1 -2
- data/spec/hobo/lib/seed/seed_spec.rb +2 -3
- data/spec/hobo/logging_spec.rb +2 -2
- data/spec/hobo/metadata_spec.rb +2 -2
- data/spec/hobo/null_spec.rb +2 -2
- data/spec/hobo/paths_spec.rb +1 -2
- data/spec/hobo/ui_spec.rb +104 -20
- data/spec/hobo/util_spec.rb +75 -0
- data/spec/spec_helper.rb +1 -0
- metadata +55 -46
- data/lib/hobo/tasks/host.rb +0 -19
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YzNjNzgyZWUyNWI1NmQzYWI5NmU0YTM5MzFhNTcwMDQ2ZThiZTdlMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YWVjNTQ0NjIwYzI2MjhmNGQ3MTgwMzM1ZDJhMmNjOGY4NjQ2MDA1Mw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZjVmZDJkM2Q1ZDUyMDQ2NWMxMTNlZTMxNTZkMmQ2MmIxMGZjNmY0MzcyN2Iy
|
10
|
+
N2IxMDljOGUyMzQ1MDZlMmQ3ZWNkOTRlYjlmN2M3ZWZlYjlmZTQ3M2Y1ZTZl
|
11
|
+
ZTM3ZGJkYjU1NTE5OWFlNmNkNjc3ZjZlMDA3MGQ2MGZlOTU4YmI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODU5OWJiNjczZGZlOTJmNmQyNmI0Njc5OTU1YTBjMDJkN2I3MDlmYTEwNmE3
|
14
|
+
Yzg0YjYwYTViODA5ODc0M2Y0ODE1ZmEwZGJkZjE1NGMzM2QxZWE5NDdiOTk4
|
15
|
+
YzhjY2UxNzU3MzgyMTkyMTA0MmUyYjgyNGM4YzcwOWFmMWY0Njc=
|
data/.editorconfig
ADDED
data/Gemfile.lock
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hobo-inviqa (0.0.
|
4
|
+
hobo-inviqa (0.0.8)
|
5
5
|
aws-sdk (~> 1.34.0)
|
6
6
|
bundler (~> 1.5.2)
|
7
7
|
deepstruct (~> 0.0.5)
|
8
8
|
highline (~> 1.6.20)
|
9
|
+
net-ssh-simple (~> 1.6.3)
|
10
|
+
os (~> 0.9.6)
|
9
11
|
rake (~> 10.1.1)
|
10
12
|
rake-hooks (~> 1.2.3)
|
11
13
|
ruby-progressbar (~> 1.4.1)
|
12
14
|
semantic (~> 1.3.0)
|
13
15
|
slop (~> 3.4.7)
|
16
|
+
teerb (~> 0.0.1)
|
14
17
|
|
15
18
|
GEM
|
16
19
|
remote: https://rubygems.org/
|
@@ -19,10 +22,11 @@ GEM
|
|
19
22
|
childprocess (>= 0.3.6)
|
20
23
|
cucumber (>= 1.1.1)
|
21
24
|
rspec-expectations (>= 2.7.0)
|
22
|
-
aws-sdk (1.34.
|
25
|
+
aws-sdk (1.34.1)
|
23
26
|
json (~> 1.4)
|
24
27
|
nokogiri (>= 1.4.4)
|
25
28
|
uuidtools (~> 2.1)
|
29
|
+
blockenspiel (0.4.5)
|
26
30
|
builder (3.2.2)
|
27
31
|
celluloid (0.15.2)
|
28
32
|
timers (~> 1.1.0)
|
@@ -57,7 +61,8 @@ GEM
|
|
57
61
|
guard-rspec (4.2.6)
|
58
62
|
guard (~> 2.1)
|
59
63
|
rspec (>= 2.14, < 4.0)
|
60
|
-
|
64
|
+
hashie (2.0.5)
|
65
|
+
highline (1.6.21)
|
61
66
|
json (1.8.1)
|
62
67
|
listen (2.5.0)
|
63
68
|
celluloid (>= 0.15.2)
|
@@ -69,9 +74,18 @@ GEM
|
|
69
74
|
mini_portile (0.5.2)
|
70
75
|
multi_json (1.8.4)
|
71
76
|
multi_test (0.0.3)
|
77
|
+
net-scp (1.1.2)
|
78
|
+
net-ssh (>= 2.6.5)
|
79
|
+
net-ssh (2.7.0)
|
80
|
+
net-ssh-simple (1.6.3)
|
81
|
+
blockenspiel (~> 0.4.3)
|
82
|
+
hashie (>= 1.1.0)
|
83
|
+
net-scp (~> 1.1.0)
|
84
|
+
net-ssh (~> 2.7.0)
|
72
85
|
nio4r (1.0.0)
|
73
86
|
nokogiri (1.6.1)
|
74
87
|
mini_portile (~> 0.5.0)
|
88
|
+
os (0.9.6)
|
75
89
|
pry (0.9.12.6)
|
76
90
|
coderay (~> 1.0)
|
77
91
|
method_source (~> 0.8)
|
@@ -91,9 +105,10 @@ GEM
|
|
91
105
|
rspec-expectations (2.14.5)
|
92
106
|
diff-lcs (>= 1.1.3, < 2.0)
|
93
107
|
rspec-mocks (2.14.5)
|
94
|
-
ruby-progressbar (1.4.
|
108
|
+
ruby-progressbar (1.4.2)
|
95
109
|
semantic (1.3.0)
|
96
110
|
slop (3.4.7)
|
111
|
+
teerb (0.0.1)
|
97
112
|
thor (0.18.1)
|
98
113
|
timers (1.1.0)
|
99
114
|
uuidtools (2.1.4)
|
data/Guardfile
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
guard :rspec do
|
5
5
|
watch(%r{^spec/.+_spec\.rb$})
|
6
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
7
|
watch('spec/spec_helper.rb') { "spec" }
|
8
8
|
end
|
9
9
|
|
@@ -11,4 +11,4 @@ guard 'cucumber' do
|
|
11
11
|
watch(%r{^features/.+\.feature$})
|
12
12
|
watch(%r{^features/support/.+$}) { 'features' }
|
13
13
|
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
14
|
-
end
|
14
|
+
end
|
data/Hobofile
CHANGED
data/README.md
CHANGED
@@ -8,49 +8,25 @@ Some highlights of functionality include:
|
|
8
8
|
|
9
9
|
Many more features are planned including assisting with host machine configuration, automatically pulling assets for the VM and providing commonly rewritten tasks as general utility libraries for use in Hobofiles.
|
10
10
|
|
11
|
-
#
|
12
|
-
Hobo is a thin wrapper over our commonly used tools. As such, those tools still need to be present on your machine.
|
13
|
-
Hobo requires the following tools to be available on your path; if you can't execute these commands from a terminal you will need to install them before using hobo:
|
11
|
+
# Installing & using
|
14
12
|
|
15
|
-
-
|
16
|
-
- ruby
|
17
|
-
- rubygems
|
18
|
-
- bundler (rubygem)
|
19
|
-
- vagrant
|
13
|
+
Full instructions for installing and using hobo are available on the wiki at [https://github.com/inviqa/hobo-gem/wiki/User-guide]. For information on the task DSL, see [https://github.com/inviqa/hobo-gem/wiki/Hobofile-DSL].
|
20
14
|
|
21
|
-
|
22
|
-
Simply execute the following command:
|
23
|
-
```
|
24
|
-
gem install hobo-inviqa
|
25
|
-
```
|
15
|
+
If you have a working development configuration (and are using OSX / linux), you may skip reading those instructions and go straight to installing the gem:
|
26
16
|
|
27
|
-
# Usage
|
28
|
-
Hobo is installed as a gem with a globally available binary called "hobo". Hobo allows you to get help for any command by specifying the --help option.
|
29
17
|
```
|
30
|
-
hobo
|
18
|
+
gem install hobo-inviqa
|
31
19
|
```
|
32
20
|
|
33
|
-
|
34
|
-
You can define project specific commands by creating a file in the root of the project called 'Hobofile'. Since hobo is based on Rake, you can use the normal Rake DSL to specify commands. Hobo also includes enhancements to this DSL that will be detailed later.
|
21
|
+
Please ensure that you run the following command after installing and that it does not raise any issues:
|
35
22
|
|
36
|
-
A task to download some specific files might look like:
|
37
23
|
```
|
38
|
-
|
39
|
-
namespace "my-project" do
|
40
|
-
desc "Download images"
|
41
|
-
task "download-images" do
|
42
|
-
Net::HTTP.get("my-domain.com", "/my-file.jpg")
|
43
|
-
end
|
44
|
-
end
|
24
|
+
hobo system check
|
45
25
|
```
|
46
26
|
|
47
|
-
|
48
|
-
```
|
49
|
-
hobo my-project download-files
|
50
|
-
```
|
27
|
+
# Getting help
|
51
28
|
|
52
|
-
#
|
53
|
-
Please see https://github.com/inviqa/hobo-gem/wiki/Hobofile-DSL for comprehensive examples.
|
29
|
+
If you need any help with hobo or you encounter any issues, please join the #hobo slack channel.
|
54
30
|
|
55
31
|
# Contributing
|
56
32
|
If you wish to contribute to hobo:
|
data/bin/hobo
CHANGED
@@ -5,29 +5,21 @@ $:.push File.expand_path(File.join("..", "..", "lib"), __FILE__)
|
|
5
5
|
|
6
6
|
require 'hobo'
|
7
7
|
require 'slop'
|
8
|
+
require 'teerb'
|
9
|
+
require 'tmpdir'
|
8
10
|
|
9
11
|
error_handler = Hobo::ErrorHandlers::Friendly.new
|
12
|
+
|
10
13
|
Hobo.ui = Hobo::Ui.new
|
11
14
|
Hobo.logger = Logger.new(STDOUT)
|
12
15
|
Hobo.logger.level = Logger::WARN
|
13
|
-
Hobo.logger.formatter = proc do |severity, datetime, progname, msg|
|
14
|
-
"#{datetime.strftime("%Y-%m-%d %H:%M:%S")}: #{severity}: #{msg}\n"
|
15
|
-
end
|
16
|
-
|
17
|
-
# win32console unfortunately has issues with Open3
|
18
|
-
# Simply disabling color for now; --ansi can be explicitly passed if required
|
19
|
-
# We also take the opportunity to disable ansi for pipes
|
20
|
-
Hobo.ui.use_color false if Gem.win_platform? || !STDOUT.tty?
|
21
|
-
|
22
|
-
# win32console unfortunately has issues with Open3
|
23
|
-
# Simply disabling color for now; --ansi can be explicitly passed if required
|
24
|
-
# We also take the opportunity to disable ansi for pipes
|
25
|
-
Hobo.ui.use_color false if Gem.win_platform? || !STDOUT.tty?
|
26
16
|
|
27
17
|
# Options parsed here will be hidden from the main app
|
28
18
|
slop = Slop.parse! do
|
29
19
|
on '--debug', 'Enable debugging' do
|
30
20
|
error_handler = Hobo::ErrorHandlers::Debug.new
|
21
|
+
debug_log = File.open(File.join(Dir.tmpdir, 'hobo_debug.log'), 'w+')
|
22
|
+
Hobo.logger = Logger.new(TeeRb::IODelegate.new(STDOUT, debug_log))
|
31
23
|
Hobo.logger.level = Logger::DEBUG
|
32
24
|
end
|
33
25
|
|
@@ -39,14 +31,16 @@ slop = Slop.parse! do
|
|
39
31
|
level = self.to_hash[:'log-level'].upcase
|
40
32
|
Hobo.logger.level = Logger.const_get(level) if [ 'DEBUG', 'INFO' ].include? level
|
41
33
|
end
|
34
|
+
end
|
42
35
|
|
43
|
-
|
44
|
-
|
45
|
-
end
|
36
|
+
Hobo.logger.formatter = proc do |severity, datetime, progname, msg|
|
37
|
+
"#{datetime.strftime("%Y-%m-%d %H:%M:%S")}: #{severity}: #{msg}\n"
|
46
38
|
end
|
47
39
|
|
48
40
|
begin
|
49
|
-
Hobo::
|
41
|
+
Hobo::Lib::HostCheck.check(:filter => /not_using_system_ruby/)
|
42
|
+
Hobo.cli = Hobo::Cli.new(slop: slop)
|
43
|
+
Hobo.cli.start
|
50
44
|
rescue Exception => error
|
51
45
|
exit error_handler.handle(error)
|
52
|
-
end
|
46
|
+
end
|
data/hobo.gemspec
CHANGED
@@ -27,6 +27,9 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency "semantic", "~> 1.3.0"
|
28
28
|
spec.add_dependency "aws-sdk", "~> 1.34.0"
|
29
29
|
spec.add_dependency "ruby-progressbar", "~> 1.4.1"
|
30
|
+
spec.add_dependency "teerb", "~> 0.0.1"
|
31
|
+
spec.add_dependency "os", "~> 0.9.6"
|
32
|
+
spec.add_dependency "net-ssh-simple", "~> 1.6.3"
|
30
33
|
|
31
34
|
spec.add_development_dependency "aruba", "~> 0.5.4"
|
32
35
|
spec.add_development_dependency "rspec", "~> 2.14.1"
|
data/lib/hobo.rb
CHANGED
@@ -4,6 +4,7 @@ require 'rake/hooks'
|
|
4
4
|
require 'tempfile'
|
5
5
|
require 'shellwords'
|
6
6
|
require 'deepstruct'
|
7
|
+
require 'os'
|
7
8
|
|
8
9
|
# DSL enhancements
|
9
10
|
require 'hobo/metadata'
|
@@ -16,9 +17,11 @@ require 'hobo/version'
|
|
16
17
|
require 'hobo/null'
|
17
18
|
require 'hobo/paths'
|
18
19
|
require 'hobo/errors'
|
20
|
+
require 'hobo/logging'
|
19
21
|
require 'hobo/ui'
|
20
22
|
require 'hobo/util'
|
21
23
|
require 'hobo/help_formatter'
|
24
|
+
require 'hobo/error_handlers/exit_code_map'
|
22
25
|
require 'hobo/error_handlers/debug'
|
23
26
|
require 'hobo/error_handlers/friendly'
|
24
27
|
require 'hobo/config/file'
|
@@ -26,10 +29,14 @@ require 'hobo/logging'
|
|
26
29
|
require 'hobo/config'
|
27
30
|
require 'hobo/asset_applicator'
|
28
31
|
|
32
|
+
# Asset sync
|
33
|
+
require 'hobo/lib/s3sync'
|
34
|
+
|
29
35
|
# Task helpers
|
30
36
|
require 'hobo/helper/shell'
|
31
37
|
require 'hobo/helper/file_locator'
|
32
38
|
require 'hobo/helper/vm_command'
|
39
|
+
require 'hobo/helper/http_download'
|
33
40
|
|
34
41
|
# Libs
|
35
42
|
require 'hobo/lib/seed/project'
|
@@ -44,4 +51,4 @@ require 'hobo/lib/host_check/deps'
|
|
44
51
|
require 'hobo/lib/host_check'
|
45
52
|
|
46
53
|
# App
|
47
|
-
require 'hobo/cli'
|
54
|
+
require 'hobo/cli'
|
data/lib/hobo/cli.rb
CHANGED
@@ -3,6 +3,10 @@ require 'deepstruct'
|
|
3
3
|
|
4
4
|
module Hobo
|
5
5
|
|
6
|
+
class << self
|
7
|
+
attr_accessor :cli
|
8
|
+
end
|
9
|
+
|
6
10
|
class Halt < Error
|
7
11
|
end
|
8
12
|
|
@@ -19,6 +23,7 @@ module Hobo
|
|
19
23
|
end
|
20
24
|
|
21
25
|
def start args = ARGV
|
26
|
+
|
22
27
|
load_user_config
|
23
28
|
load_builtin_tasks
|
24
29
|
load_hobofiles
|
@@ -31,6 +36,9 @@ module Hobo
|
|
31
36
|
# Parse out global args first
|
32
37
|
@slop.parse! args
|
33
38
|
opts = @slop.to_hash
|
39
|
+
|
40
|
+
Hobo::Lib::HostCheck.check(:filter => /vagrant.*|.*present/, :raise => true) unless opts[:'skip-host-checks']
|
41
|
+
|
34
42
|
@help_opts[:all] = opts[:all]
|
35
43
|
Hobo.ui.interactive = !(opts[:'non-interactive'] == true)
|
36
44
|
|
@@ -63,9 +71,11 @@ module Hobo
|
|
63
71
|
|
64
72
|
def load_builtin_tasks
|
65
73
|
require 'hobo/tasks/assets'
|
74
|
+
require 'hobo/tasks/config'
|
66
75
|
require 'hobo/tasks/debug'
|
67
76
|
require 'hobo/tasks/deps'
|
68
|
-
require 'hobo/tasks/
|
77
|
+
require 'hobo/tasks/system'
|
78
|
+
require 'hobo/tasks/system/completions'
|
69
79
|
require 'hobo/tasks/seed'
|
70
80
|
require 'hobo/tasks/vm'
|
71
81
|
require 'hobo/tasks/tools'
|
@@ -99,6 +109,7 @@ module Hobo
|
|
99
109
|
slop.on '-a', '--all', 'Show hidden commands'
|
100
110
|
slop.on '-h', '--help', 'Display help'
|
101
111
|
slop.on '--non-interactive', 'Run non-interactively. Defaults will be automatically used where possible.'
|
112
|
+
slop.on '--skip-host-checks', 'Skip host checks'
|
102
113
|
|
103
114
|
slop.on '-v', '--version', 'Print version information' do
|
104
115
|
Hobo.ui.info "Hobo version #{Hobo::VERSION}"
|
@@ -178,7 +189,7 @@ module Hobo
|
|
178
189
|
run do |opts, args|
|
179
190
|
Dir.chdir Hobo.project_path if Hobo.in_project?
|
180
191
|
raise ::Hobo::ProjectOnlyError.new if opts.project_only && !Hobo.in_project?
|
181
|
-
task.opts = opts.to_hash
|
192
|
+
task.opts = opts.to_hash.merge({:_unparsed => hobo.slop.unparsed})
|
182
193
|
raise ::Hobo::MissingArgumentsError.new(name, args, hobo) if args && task.arg_names.length > args.length
|
183
194
|
task.invoke *args
|
184
195
|
args.pop(task.arg_names.size)
|
@@ -204,4 +215,4 @@ module Hobo
|
|
204
215
|
out
|
205
216
|
end
|
206
217
|
end
|
207
|
-
end
|
218
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module Hobo
|
2
2
|
module ErrorHandlers
|
3
3
|
class Debug
|
4
|
+
include Hobo::ErrorHandlers::ExitCodeMap
|
5
|
+
|
4
6
|
def handle error
|
5
|
-
|
7
|
+
Hobo.ui.error "\n(#{error.class}) #{error.message}\n\n#{(error.backtrace || []).join("\n")}"
|
8
|
+
return EXIT_CODES[error.class.to_s] || DEFAULT_EXIT_CODE
|
6
9
|
end
|
7
10
|
end
|
8
11
|
end
|
9
|
-
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Hobo
|
2
|
+
module ErrorHandlers
|
3
|
+
module ExitCodeMap
|
4
|
+
DEFAULT_EXIT_CODE = 128
|
5
|
+
EXIT_CODES = {
|
6
|
+
'Interrupt' => 1,
|
7
|
+
'Hobo::ExternalCommandError' => 3,
|
8
|
+
'Hobo::InvalidCommandOrOpt' => 4,
|
9
|
+
'Hobo::MissingArgumentsError' => 5,
|
10
|
+
'Hobo::UserError' => 6,
|
11
|
+
'Hobo::ProjectOnlyError' => 7,
|
12
|
+
'Hobo::HostCheckError' => 8
|
13
|
+
}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -3,6 +3,8 @@ require 'tmpdir' # Needed for Dir.tmpdir
|
|
3
3
|
module Hobo
|
4
4
|
module ErrorHandlers
|
5
5
|
class Friendly
|
6
|
+
include Hobo::ErrorHandlers::ExitCodeMap
|
7
|
+
|
6
8
|
def handle error
|
7
9
|
log_file = File.join(Dir.tmpdir, 'hobo_error.log')
|
8
10
|
|
@@ -10,7 +12,6 @@ module Hobo
|
|
10
12
|
case error.class.to_s
|
11
13
|
when "Interrupt"
|
12
14
|
Hobo.ui.warning "\n\nCaught Interrupt. Aborting\n"
|
13
|
-
return 1
|
14
15
|
when "Hobo::ExternalCommandError"
|
15
16
|
FileUtils.cp error.output.path, log_file
|
16
17
|
|
@@ -25,21 +26,19 @@ module Hobo
|
|
25
26
|
|
26
27
|
The output of the command has been logged to #{log_file}
|
27
28
|
ERROR
|
28
|
-
return 3
|
29
29
|
when "Hobo::InvalidCommandOrOpt"
|
30
30
|
Hobo.ui.error "\n#{error.message}"
|
31
31
|
Hobo.ui.info error.cli.help_formatter.help if error.cli
|
32
|
-
return 4
|
33
32
|
when "Hobo::MissingArgumentsError"
|
34
33
|
Hobo.ui.error "\n#{error.message}"
|
35
34
|
Hobo.ui.info error.cli.help_formatter.help(target: error.command) if error.cli
|
36
|
-
return 5
|
37
35
|
when "Hobo::UserError"
|
38
36
|
Hobo.ui.error "\n#{error.message}\n"
|
39
|
-
return 6
|
40
37
|
when "Hobo::ProjectOnlyError"
|
41
38
|
Hobo.ui.error "\nHobo requires you to be in a project directory for this command!\n"
|
42
|
-
|
39
|
+
when "Hobo::HostCheckError"
|
40
|
+
Hobo.ui.error "\nHobo has detected a problem with your system configuration:\n"
|
41
|
+
Hobo.ui.warning error.advice.gsub(/^/, ' ')
|
43
42
|
else
|
44
43
|
File.write(log_file, "(#{error.class}) #{error.message}\n\n#{error.backtrace.join("\n")}")
|
45
44
|
Hobo.ui.error <<-ERROR
|
@@ -49,9 +48,10 @@ module Hobo
|
|
49
48
|
|
50
49
|
The backtrace has been logged to #{log_file}
|
51
50
|
ERROR
|
52
|
-
return 128
|
53
51
|
end
|
52
|
+
|
53
|
+
return EXIT_CODES[error.class.to_s] || DEFAULT_EXIT_CODE
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
|
-
end
|
57
|
+
end
|