hobo-inviqa 0.0.7.pre.rc3 → 0.0.7

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.
Files changed (56) hide show
  1. data/Gemfile.lock +4 -19
  2. data/Guardfile +2 -2
  3. data/Hobofile +1 -5
  4. data/bin/hobo +18 -12
  5. data/hobo.gemspec +0 -3
  6. data/lib/hobo.rb +1 -8
  7. data/lib/hobo/cli.rb +3 -14
  8. data/lib/hobo/error_handlers/debug.rb +2 -5
  9. data/lib/hobo/error_handlers/friendly.rb +8 -8
  10. data/lib/hobo/errors.rb +1 -11
  11. data/lib/hobo/helper/shell.rb +2 -3
  12. data/lib/hobo/helper/vm_command.rb +14 -164
  13. data/lib/hobo/lib/host_check.rb +6 -20
  14. data/lib/hobo/lib/host_check/deps.rb +4 -22
  15. data/lib/hobo/lib/host_check/git.rb +17 -41
  16. data/lib/hobo/lib/host_check/ruby.rb +20 -30
  17. data/lib/hobo/lib/host_check/vagrant.rb +6 -37
  18. data/lib/hobo/lib/s3sync.rb +44 -22
  19. data/lib/hobo/lib/seed/project.rb +4 -8
  20. data/lib/hobo/patches/slop.rb +2 -21
  21. data/lib/hobo/tasks/assets.rb +15 -12
  22. data/lib/hobo/tasks/deps.rb +6 -40
  23. data/lib/hobo/tasks/host.rb +19 -0
  24. data/lib/hobo/tasks/tools.rb +6 -10
  25. data/lib/hobo/tasks/vm.rb +11 -64
  26. data/lib/hobo/ui.rb +10 -27
  27. data/lib/hobo/util.rb +2 -36
  28. data/lib/hobo/version.rb +2 -2
  29. data/spec/hobo/asset_applicator_spec.rb +2 -2
  30. data/spec/hobo/cli_spec.rb +24 -35
  31. data/spec/hobo/config/file_spec.rb +3 -1
  32. data/spec/hobo/error_handlers/debug_spec.rb +5 -39
  33. data/spec/hobo/error_handlers/friendly_spec.rb +21 -38
  34. data/spec/hobo/help_formatter_spec.rb +3 -3
  35. data/spec/hobo/helpers/file_locator_spec.rb +2 -2
  36. data/spec/hobo/helpers/shell_spec.rb +2 -2
  37. data/spec/hobo/helpers/vm_command_spec.rb +24 -36
  38. data/spec/hobo/lib/s3sync_spec.rb +3 -6
  39. data/spec/hobo/lib/seed/project_spec.rb +3 -2
  40. data/spec/hobo/lib/seed/replacer_spec.rb +2 -1
  41. data/spec/hobo/lib/seed/seed_spec.rb +3 -2
  42. data/spec/hobo/logging_spec.rb +2 -2
  43. data/spec/hobo/metadata_spec.rb +2 -2
  44. data/spec/hobo/null_spec.rb +2 -2
  45. data/spec/hobo/paths_spec.rb +2 -1
  46. data/spec/hobo/ui_spec.rb +20 -104
  47. data/spec/spec_helper.rb +0 -1
  48. metadata +48 -57
  49. checksums.yaml +0 -15
  50. data/.editorconfig +0 -10
  51. data/lib/hobo/error_handlers/exit_code_map.rb +0 -16
  52. data/lib/hobo/helper/http_download.rb +0 -41
  53. data/lib/hobo/tasks/config.rb +0 -15
  54. data/lib/hobo/tasks/system.rb +0 -15
  55. data/lib/hobo/tasks/system/completions.rb +0 -76
  56. data/spec/hobo/util_spec.rb +0 -75
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MjQzZmFjY2Y1M2FjNGMyZTgzMWE4YmExMTI1YTliY2NkYzNiMWExYw==
5
- data.tar.gz: !binary |-
6
- YWVkNDBkOGJkN2ViYjBmY2Y0ZTE5NjQxYWY2NWI5ZGNjMWQ2MWNmOA==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- NjU2ZWQ2ZWU3ODAwMWFlMmMwYmZkYjFlZjgwYzdiOGMzYmI3NzM3MWQ0Yzc4
10
- YzNjMjk3NWYyNTQwY2JkYTZlNTI0NzNlODdhOTcwOTA2ODQ1ZDU4ZGI1YWZk
11
- ZjZjYjgyMzBiYjE4YWM1ZWY4ZjgwNzQ3MzVjMTlmZDQxYmZmYzY=
12
- data.tar.gz: !binary |-
13
- MGE4MTNlMDI0NTQ1MzdlNTU3M2QxMjk1MzgzZThiNGYyMDQ4MGJlZjc3YmZl
14
- ODJjMDhlNjUyMGNlZmY1NjE2YjgwNTM1NmY5NWJiZTY1ZWE0MWFmZjYzYWMw
15
- MTE3MTBiNGRiMDk3MjA5ODBhMTNlOTBlNDU2YmY4YzkxOWY2ODY=
data/.editorconfig DELETED
@@ -1,10 +0,0 @@
1
- ; EditorConfig is awesome: http://EditorConfig.org
2
- root = true ; top-most EditorConfig file
3
-
4
- [*]
5
- indent_style = space
6
- indent_size = 2
7
- end_of_line = lf
8
- charset = utf-8
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
@@ -1,16 +0,0 @@
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
@@ -1,41 +0,0 @@
1
- require 'net/http'
2
- require 'uri'
3
-
4
- module Hobo
5
- module Helper
6
- def http_download url, target_file, opts = {}
7
- opts = { :progress => Hobo.method(:progress) }.merge(opts)
8
- uri = URI.parse(url)
9
- size = 0
10
- http = Net::HTTP.new(uri.host, uri.port)
11
- http.use_ssl = uri.scheme == 'https'
12
-
13
- # TODO: May want to verify SSL validity...
14
- # http://notetoself.vrensk.com/2008/09/verified-https-in-ruby/#comment-22252
15
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
16
-
17
- http.start do
18
- begin
19
- file = open(target_file, 'wb+')
20
- http.request_get(uri.path) do |response|
21
- size = response.content_length
22
- response.read_body do |chunk|
23
- file.write(chunk)
24
- opts[:progress].call(
25
- target_file,
26
- chunk.length,
27
- size,
28
- :update
29
- ) if opts[:progress]
30
- end
31
- end
32
- ensure
33
- opts[:progress].call(target_file, 0, size, :finsh) if opts[:progress]
34
- file.close
35
- end
36
- end
37
- end
38
- end
39
- end
40
-
41
- include Hobo::Helper
@@ -1,15 +0,0 @@
1
- desc "Configure hobo"
2
- task :config do
3
- config = Hobo.user_config
4
-
5
- # Not required at present
6
- # config.full_name = Hobo.ui.ask("Full name", :default => config.full_name).to_s
7
- # config.email = Hobo.ui.ask("Email", :default => config.email).to_s
8
-
9
- config[:aws] ||= {}
10
- config.aws.access_key_id = Hobo.ui.ask("AWS access key ID", :default => config.aws.access_key_id).to_s
11
- config.aws.secret_access_key = Hobo.ui.ask("AWS secret access key", :default => config.aws.secret_access_key).to_s
12
-
13
- Hobo::Config::File.save(Hobo.user_config_file, config)
14
- File.chmod(0600, Hobo.user_config_file)
15
- end
@@ -1,15 +0,0 @@
1
- desc "System configuration related commands"
2
- namespace :system do
3
-
4
- desc "Check system configuration for potential problems"
5
- task :check do
6
- Hobo::Lib::HostCheck.check.each do |k,v|
7
- if v == :ok
8
- Hobo.ui.success "#{k}: OK"
9
- else
10
- Hobo.ui.error "#{k}: FAILED\n"
11
- Hobo.ui.warning v.advice.gsub(/^/, ' ')
12
- end
13
- end
14
- end
15
- end
@@ -1,76 +0,0 @@
1
- desc "System configuration related commands"
2
- namespace :system do
3
-
4
- desc "Shell completion related commands"
5
- namespace :completions do
6
-
7
- desc "Install shell completion helpers"
8
- option '-f', '--fish', 'Install completions for FISH'
9
- option '-b', '--bash', 'Install completions for Bash'
10
- option '-z', '--zsh', 'Install completions for ZSH'
11
- task "install" do |task|
12
- if task.opts[:fish]
13
- script = <<-EOF
14
- function __hobo_completion -d "Create hobo completions"
15
- set -l cache_dir "/tmp/fish_hobo_completion_cache"
16
- mkdir -p $cache_dir
17
- set -l hashed_pwd (ruby -r 'digest' -e 'puts Digest::MD5.hexdigest(`pwd`)')
18
- set -l hobo_cache_file "$cache_dir/$hashed_pwd"
19
-
20
- if not test -f "$hobo_cache_file"
21
- hobo system completions fish > "$hobo_cache_file"
22
- end
23
-
24
- cat "$hobo_cache_file"
25
- end
26
-
27
- function __hobo_scope_test -d "Hobo scoped completion test"
28
- set cmd (commandline -opc)
29
- if [ "$cmd" = "$argv" ]
30
- return 0
31
- end
32
- return 1
33
- end
34
-
35
- eval (__hobo_completion)
36
- EOF
37
- target = File.join(ENV['HOME'], '.config/fish/completions/hobo.fish')
38
- FileUtils.mkdir_p(File.dirname(target))
39
- File.write(target, script)
40
- end
41
-
42
- if task.opts[:bash]
43
- raise "Bash completions not yet implemented"
44
- end
45
-
46
- if task.opts[:zsh]
47
- raise "ZSH completions not yet implemented"
48
- end
49
- end
50
-
51
- desc "Display FISH shell completion commands"
52
- task :fish do
53
- Hobo.cli.slop.options.each do |option|
54
- short = option.short.nil? ? '' : "-s #{option.short}"
55
- long = option.long.nil? ? '' : "-l #{option.long}"
56
- arg = option.config[:argument] ? '' : '-x'
57
- puts "complete #{arg} -c hobo #{short} #{long} --description '#{option.description}';"
58
- end
59
-
60
- map = Hobo.cli.help_formatter.command_map
61
- map.each do |k, v|
62
- next if v.description.nil? || v.description.empty?
63
- k = k.split(':')
64
- k.unshift 'hobo'
65
- c = k.pop
66
- puts "complete -x -c hobo -n '__hobo_scope_test #{k.join(' ')}' -a #{c} --description '#{v.description}';"
67
- v.options.each do |option|
68
- short = option.short.nil? ? '' : "-s #{option.short}"
69
- long = option.long.nil? ? '' : "-l #{option.long}"
70
- arg = option.config[:argument] ? '' : '-x'
71
- puts "complete #{arg} -c hobo -n '__hobo_scope_test #{k.concat([c]).join(' ')}' #{short} #{long} --description '#{option.description}';"
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,75 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Hobo do
4
- describe "in_project?" do
5
- it "should return true if project path detected" do
6
- Hobo.project_path = "test"
7
- Hobo.in_project?.should be true
8
- end
9
-
10
- it "should return false if no project path detected" do
11
- Hobo.project_path = false
12
- Hobo.in_project?.should be false
13
- end
14
- end
15
-
16
- describe "progress" do
17
- def progress_mock file, increment, total, type
18
- out = double(StringIO.new).as_null_object
19
- out.stub(:tty?).and_return(true)
20
- Hobo.progress(file, increment, total, type, :throttle_rate => nil, :output => out)
21
- end
22
-
23
- before do
24
- Hobo.project_bar_cache = {}
25
- end
26
-
27
- it "should create new progress bar if one does not exist" do
28
- bar = progress_mock("test", 0, 10, :update)
29
- bar.to_s.should match /^test.*0%/
30
- end
31
-
32
- it "should force width to 79 if windows" do
33
- Gem.should_receive(:win_platform?).and_return(true)
34
- bar = progress_mock("test:79", 0, 10, :update)
35
- bar.to_s.length.should eq 79
36
- end
37
-
38
- it "should update progress bar if type :update" do
39
- bar = progress_mock("test:update", 0, 10, :update)
40
- bar.to_s.should match /^test:update.*0%/
41
-
42
- Hobo.progress("test:update", 1, 10, :update)
43
- bar.to_s.should match /^test.update.*10%/
44
- end
45
-
46
- it "should increment progress by specified amount if type :update" do
47
- bar = progress_mock("test:increment", 0, 10, :update)
48
- bar.to_s.should match /^test:increment.*0%/
49
-
50
- Hobo.progress("test:increment", 1, 10, :update)
51
- bar.to_s.should match /^test:increment.*10%/
52
-
53
- Hobo.progress("test:increment", 1, 10, :update)
54
- bar.to_s.should match /^test:increment.*20%/
55
- end
56
-
57
- it "should finalize progress bar if type :finish" do
58
- bar = progress_mock("test:finish", 0, 10, :update)
59
- bar.to_s.should match /^test:finish.*0%/
60
- Hobo.progress("test:finish", 10, 10, :update)
61
- Hobo.progress("test:finish", 10, 10, :finish)
62
- bar.to_s.should match /^test:finish.*100%.*Time/
63
- end
64
-
65
- it "should set fixed format" do
66
- bar = progress_mock("test:format", 1, 10, :update)
67
- bar.to_s.should match /^test:format \[=+\s+\]\s+10%\s+ETA: 00:00:00/
68
- end
69
-
70
- it "should use filename as title" do
71
- bar = progress_mock("some/path/to/filename.ext", 1, 10, :update)
72
- bar.to_s.should match /^filename\.ext/
73
- end
74
- end
75
- end