hobo-inviqa 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Mjg4YTBkMDdkMDk4N2Q4NDNmMTI2OGFkYjA1YTM2MzQ3ZmI3MTYzNQ==
5
- data.tar.gz: !binary |-
6
- OTE4ZGM4OTUxMjhlY2ExNjgwMjkyMDhhYTc5Y2MwNDUxMzU3YzYxNA==
2
+ SHA1:
3
+ metadata.gz: be7b49aeaf1ca940a8e4195b1d173f77a60ddb4c
4
+ data.tar.gz: dbf72ecfd2f6cbb66b4bdd1be1058377f9b6b3b6
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZGJhMDM3NGFmNGZiNGIxZDJiOGU5N2Q0NzI4ZWZmNTA0MmQyYTI3Y2QzZDY3
10
- ZjI1NWIzZDg0Mzg3MWJjNTJlOTI1YWVmNDNmYTFmM2I4OTEyZDg4M2Q0ZTdj
11
- NWZiZDlkM2M2NDIyMTcyNzUzOGE4Y2M4YTRlYjQxNjNmMzI3N2Q=
12
- data.tar.gz: !binary |-
13
- Njg3MTNiZTZlNzlkNWFkMTdhY2Q1NjRmYjE3NGQ0N2EzOWMwMTEzZTBmMzZm
14
- ZGViZmM4M2ExYWVjMWZlYTk4YmE3NWM2MTk5NTUwZDVlYjFlZWU1Yjc2MDg0
15
- NTY2NTU5YjY1MjQzMjhiOWE2NDYxNzMyMjQyY2NlYzU0OWQ1Mzc=
6
+ metadata.gz: a66d5fc46a6a655a53bcb3b7aa5bdb9e8a35a3b044cca992e13bed83fde56d956aeccc9bcfcf433a0f715b41039e097e042d023a4cdb294b6bd2f4626ffa39d6
7
+ data.tar.gz: 138f62a568f9ba19f71f60ab18517b11b9c9e0005f1c9794f9a398a0ff8305c0ab347596b4fe5f9ca37ea81d4c9744530d998dbd6dcfa14192e5c3c4d74c0251
@@ -0,0 +1,3 @@
1
+ pkg/
2
+ coverage/
3
+ tmp/
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hobo-inviqa (0.0.10)
4
+ hobo-inviqa (0.0.11)
5
5
  aws-sdk (~> 1.34.0)
6
6
  bundler (>= 1.5.2)
7
7
  deepstruct (~> 0.0.5)
@@ -24,12 +24,12 @@ GEM
24
24
  uuidtools (~> 2.1)
25
25
  blockenspiel (0.4.5)
26
26
  coderay (1.1.0)
27
- deepstruct (0.0.5)
28
- hashie (2.1.1)
27
+ deepstruct (0.0.7)
28
+ hashie (3.0.0)
29
29
  highline (1.6.21)
30
30
  json (1.8.1)
31
31
  method_source (0.8.2)
32
- mini_portile (0.5.3)
32
+ mini_portile (0.6.0)
33
33
  net-scp (1.1.2)
34
34
  net-ssh (>= 2.6.5)
35
35
  net-ssh (2.8.0)
@@ -38,8 +38,8 @@ GEM
38
38
  hashie (>= 1.1.0)
39
39
  net-scp (~> 1.1.0)
40
40
  net-ssh (~> 2.8.0)
41
- nokogiri (1.6.1)
42
- mini_portile (~> 0.5.0)
41
+ nokogiri (1.6.2.1)
42
+ mini_portile (= 0.6.0)
43
43
  pry (0.9.12.6)
44
44
  coderay (~> 1.0)
45
45
  method_source (~> 0.8)
data/Rakefile CHANGED
@@ -5,3 +5,19 @@ ENV['HOBO_BUILD'] = '1'
5
5
 
6
6
  desc "Build and install"
7
7
  task :build_install => [:build, :install]
8
+
9
+ desc "Install dev deps"
10
+ task :install_dev_deps do
11
+ sh 'rm -rf .bundle/config'
12
+ sh 'HOBO_ENV=dev bundle install'
13
+ end
14
+
15
+ namespace :test do
16
+ task :specs => [ 'install_dev_deps' ] do
17
+ sh 'HOBO_ENV=dev bundle exec rspec'
18
+ end
19
+
20
+ task :acceptance => [ 'install_dev_deps' ] do
21
+ sh 'HOBO_ENV=dev bundle exec cucumber'
22
+ end
23
+ end
data/bin/hobo CHANGED
@@ -4,7 +4,6 @@
4
4
  $:.push File.expand_path(File.join("..", "..", "lib"), __FILE__)
5
5
 
6
6
  def init_hobo
7
- require 'hobo/init/bundler_context' unless $HOBO_BUNDLE_MODE
8
7
  require 'hobo'
9
8
 
10
9
  # Default main classes
@@ -47,7 +46,6 @@ def init_hobo
47
46
  Hobo.ui.interactive = !(opts[:'non-interactive'] == true)
48
47
 
49
48
  begin
50
- Hobo::Lib::HostCheck.check(:filter => /not_using_system_ruby/, :raise => true) unless opts[:'skip-host-checks']
51
49
  Hobo.cli = Hobo::Cli.new(slop: slop)
52
50
  Hobo.cli.start
53
51
  rescue Exception => error
@@ -57,23 +55,47 @@ def init_hobo
57
55
  end
58
56
  end
59
57
 
58
+ Gem.configuration.verbose = false
59
+
60
+ require 'hobo/util'
61
+
62
+ unless Hobo.windows?
63
+ if Process.uid == 0
64
+ puts
65
+ puts "Hobo must not be run as root"
66
+ puts
67
+ exit 147
68
+ end
69
+
70
+ require "hobo/util"
71
+
72
+ if Hobo.windows? and not Hobo.system_ruby?
73
+ puts
74
+ puts "Hobo is not compatible with system ruby installs"
75
+ puts
76
+ puts "Please see the installation instructions for hobo on the wiki at https://github.com/inviqa/hobo-gem/wiki"
77
+ puts "It is also recommended that you wipe system gems so as to avoid interference. You can achieve this with the following command:"
78
+ puts
79
+ puts " gem list --no-version | xargs sudo gem uninstall -aIx"
80
+ puts
81
+ exit 148
82
+ end
83
+ end
84
+
60
85
  require 'hobo/patches/rubygems'
86
+ require 'hobo/bundler'
61
87
  require 'bundler'
62
88
 
63
89
  # Suppress Net/SSH/Simple warning on windows
64
- # Note that $HOBO_ARGV is used as an indicator in the gemspec as to whether it needs to build a filelist
65
- # Removing it or moving it after the bundler setup will cause "fatal: Not a git repository" errors
66
90
  $SUPPRESS_32BIT_WARNING=1
67
91
  $HOBO_ARGV = ARGV
68
- # Bundler.environment tries to do Bundler.setup!
69
- # In the event that bundle is missing deps, the means BUNDLE_GEMFILE will not be set!
70
- $HOBO_BUNDLE_MODE = (!!ENV['BUNDLE_GEMFILE'] && Bundler.environment.specs.to_hash['hobo-inviqa'])
71
92
  $OLD_BUNDLE_GEMFILE = ENV['BUNDLE_GEMFILE']
93
+ $HOBO_BUNDLE_MODE = Hobo::Bundler.is_hobo_bundled?
72
94
 
73
95
  if $HOBO_BUNDLE_MODE
74
96
  init_hobo
75
97
  else
76
- Bundler.with_clean_env do
98
+ Hobo::Bundler.isolate do
77
99
  init_hobo
78
100
  end
79
101
  end
@@ -33,9 +33,6 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "net-ssh-simple", "~> 1.6.3"
34
34
  spec.add_dependency "pry", "~> 0.9.12"
35
35
 
36
- # Not actually a dep! gem insists on installing 1.6.2.rc2 however!
37
- #spec.add_dependency "nokogiri", "= 1.6.1"
38
-
39
36
  # This prevents Bundler.setup from complaining that rubygems did not install dev deps
40
37
  # If you want to run dev deps you need to ensure HOBO_ENV=dev is set for bundle install & bundle exec
41
38
  if ENV['HOBO_ENV'] == 'dev'
@@ -46,5 +43,6 @@ Gem::Specification.new do |spec|
46
43
  spec.add_development_dependency "guard", "~> 2.2.5"
47
44
  spec.add_development_dependency "guard-rspec", "~> 4.2.4"
48
45
  spec.add_development_dependency "guard-cucumber", "~> 1.4.1"
46
+ spec.add_development_dependency "simplecov", "~> 0.7.1"
49
47
  end
50
48
  end
@@ -1,15 +1,38 @@
1
+ # Built in applicators
1
2
  Hobo.asset_applicators.register /.*\.sql\.gz/ do |file|
2
3
  matches = file.match(/^([^\.]+).*\.sql\.gz/)
3
4
  db = File.basename(matches[1])
4
5
 
6
+ status = {
7
+ :db_exists => false,
8
+ :db_has_tables => false
9
+ }
10
+
5
11
  begin
6
- shell(vm_mysql(:mysql => 'mysqladmin', :append => " create #{db.shellescape}"))
7
- rescue Hobo::ExternalCommandError => e
12
+ result = shell(vm_mysql(:db => db) << 'SHOW TABLES; SELECT FOUND_ROWS();', :capture => true)
13
+ status[:db_exists] = true
14
+ status[:db_has_tables] = !(result.split("\n").last.strip == '0')
15
+ rescue Hobo::ExternalCommandError
16
+ # This will fail later with a more useful error message
17
+ end
18
+
19
+ if status[:db_exists] && status[:db_has_tables]
8
20
  Hobo.ui.warning "Already applied (#{file})"
9
- raise e if e.exit_code != 1
10
21
  next
11
22
  end
12
23
 
13
- Hobo.ui.title "Applying mysqldump (#{file})"
14
- shell(vm_mysql(:auto_echo => false, :db => db) < "zcat #{file.shellescape}")
15
- end
24
+ if status[:db_exists] && !status[:db_has_tables]
25
+ # Db exists but is empty
26
+ shell(vm_mysql(:mysql => 'mysqladmin', :append => " --force drop #{db.shellescape}"))
27
+ end
28
+
29
+ begin
30
+ Hobo.ui.title "Applying mysqldump (#{file})"
31
+ shell(vm_mysql(:mysql => 'mysqladmin', :append => " create #{db.shellescape}"))
32
+ shell(vm_mysql(:auto_echo => false, :db => db) < "zcat #{file.shellescape}")
33
+ rescue Hobo::ExternalCommandError => exception
34
+ Hobo.ui.error "Could not apply #{file} due to the following error:\n"
35
+ Hobo.ui.error File.read(exception.output.path).strip
36
+ raise exception
37
+ end
38
+ end
@@ -0,0 +1,72 @@
1
+ module Hobo
2
+ module Bundler
3
+ require 'rubygems/user_interaction'
4
+
5
+ class GemUi < Gem::SilentUI
6
+ def download_reporter(*args)
7
+ VerboseDownloadReporter.new(STDOUT, *args)
8
+ end
9
+ def progress_reporter(*args)
10
+ SilentProgressReporter.new(STDOUT, *args)
11
+ end
12
+ end
13
+
14
+ def self.install_missing_dependencies
15
+ require 'bundler'
16
+ require 'bundler/ui'
17
+ require 'bundler/cli'
18
+ require 'bundler/cli/install'
19
+
20
+ # Override Gem output handlers
21
+ Gem::DefaultUserInteraction.ui = GemUi.new
22
+ Gem.configuration.verbose = false
23
+
24
+ # Reset bundler & trigger install task
25
+ ::Bundler.definition true
26
+ bundler_install = ::Bundler::CLI::Install.new({})
27
+
28
+ begin
29
+ bundler_install.run
30
+ Kernel.exec('hobo', *$HOBO_ARGV)
31
+ rescue Exception => e
32
+ puts
33
+ puts "Failed to install dependencies. Hobo can not proceed."
34
+ puts "Please see the error below:"
35
+ puts
36
+ throw exception
37
+ end
38
+ end
39
+
40
+ def self.isolate
41
+ ::Bundler.with_clean_env do
42
+ # Override gemfile for bundler to use
43
+ ENV['BUNDLE_GEMFILE'] = File.expand_path('../../../Gemfile', __FILE__)
44
+
45
+ # Ensure Bundler is not caching anything
46
+ ::Bundler.instance_variable_set('@load', nil)
47
+ ::Bundler.definition true
48
+
49
+ begin
50
+ ::Bundler.setup(:default)
51
+ rescue ::Bundler::GemNotFound => exception
52
+ puts "Missing runtime dependencies: #{exception}"
53
+ puts "Installing..."
54
+
55
+ Hobo::Bundler.install_missing_dependencies
56
+ end
57
+ yield
58
+ end
59
+ end
60
+
61
+ def self.is_hobo_bundled?
62
+ begin
63
+ ::Bundler.root
64
+ ::Bundler.definition.dependencies.select do |dep|
65
+ dep.name == 'hobo-inviqa'
66
+ end.length > 0
67
+ rescue ::Bundler::GemfileNotFound
68
+ false
69
+ end
70
+ end
71
+ end
72
+ end
@@ -118,7 +118,8 @@ module Hobo
118
118
  def perform_host_checks
119
119
  checks = [
120
120
  'vagrant.*',
121
- '.*present'
121
+ 'ssh_present',
122
+ 'git_present'
122
123
  ]
123
124
  checks.push 'latest_hobo_version' unless $HOBO_BUNDLE_MODE
124
125
 
@@ -9,7 +9,8 @@ module Hobo
9
9
  'Hobo::MissingArgumentsError' => 5,
10
10
  'Hobo::UserError' => 6,
11
11
  'Hobo::ProjectOnlyError' => 7,
12
- 'Hobo::HostCheckError' => 8
12
+ 'Hobo::HostCheckError' => 8,
13
+ 'Hobo::Error' => 9
13
14
  }
14
15
  end
15
16
  end
@@ -38,6 +38,8 @@ module Hobo
38
38
  when "Hobo::HostCheckError"
39
39
  Hobo.ui.error "\nHobo has detected a problem with your system configuration:\n"
40
40
  Hobo.ui.warning error.advice.gsub(/^/, ' ')
41
+ when "Hobo::Error"
42
+ Hobo.ui.error "\n#{error.message}\n"
41
43
  else
42
44
  File.write(log_file, "(#{error.class}) #{error.message}\n\n#{error.backtrace.join("\n")}")
43
45
  Hobo.ui.error <<-ERROR
@@ -14,8 +14,9 @@ You can install it with the following command:
14
14
  Once installed, run the following to set it as the default ruby and re-install hobo-inviqa:
15
15
  rbenv install 1.9.3-p448 && rbenv global 1.9.3-448 && gem install hobo-inviqa
16
16
  EOF
17
- which = shell "which ruby", :capture => true
18
- unless which =~ /\.rbenv|\.rvm/
17
+ require "rbconfig"
18
+ which = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"])
19
+ unless which =~ /\.rbenv|\.rvm|jruby/
19
20
  raise Hobo::HostCheckError.new("Hobo is running under a system ruby", advice)
20
21
  end
21
22
  end
@@ -14,9 +14,11 @@ module Hobo
14
14
  :max_retries => 15
15
15
  }.merge(opts)
16
16
 
17
- # AWS::S3 is flakey about actually raising this error when nil is provided
18
- [:access_key_id, :secret_access_key].each do |k|
19
- raise AWS::Errors::MissingCredentialsError if @opts[k].nil?
17
+ handle_s3_error do
18
+ # AWS::S3 is flakey about actually raising this error when nil is provided
19
+ [:access_key_id, :secret_access_key].each do |k|
20
+ raise AWS::Errors::MissingCredentialsError if @opts[k].nil?
21
+ end
20
22
  end
21
23
 
22
24
  logger.debug("s3sync: Options #{@opts}")
@@ -26,7 +28,10 @@ module Hobo
26
28
  delta = {:add => [], :remove => []}
27
29
 
28
30
  handle_s3_error do
29
- opts = { :progress => Hobo.method(:progress) }.merge(opts)
31
+ opts = {
32
+ :dry => false,
33
+ :progress => Hobo.method(:progress)
34
+ }.merge(opts)
30
35
 
31
36
  source_io = io_handler(source)
32
37
  destination_io = io_handler(dest)
@@ -42,6 +47,7 @@ module Hobo
42
47
 
43
48
  delta = delta(source_listing, destination_listing)
44
49
  logger.debug("s3sync: Delta #{delta}")
50
+ break if opts[:dry]
45
51
 
46
52
  delta[:add].each do |file|
47
53
  logger.debug("s3sync: Synchronizing #{file}")
@@ -54,7 +60,7 @@ module Hobo
54
60
  destination_file.write({ :size => source_file.size }) do |buffer, bytes|
55
61
  chunk = source_file.read(bytes)
56
62
  buffer.write(chunk)
57
- opts[:progress].call(file, chunk.length, size, :update)
63
+ opts[:progress].call(file, (chunk || '').length, size, :update)
58
64
  end
59
65
 
60
66
  destination_file.close
@@ -79,19 +85,24 @@ module Hobo
79
85
  end
80
86
 
81
87
  def handle_s3_error
88
+ exception = Hobo::Error.new("Could not sync assets")
82
89
  begin
83
90
  yield
84
91
  rescue Errno::ENETUNREACH
85
92
  Hobo.ui.error " Could not contact Amazon servers."
86
93
  Hobo.ui.error " This can sometimes be caused by missing AWS credentials"
94
+ raise exception
87
95
  rescue AWS::S3::Errors::NoSuchBucket
88
96
  Hobo.ui.error " Asset bucket #{Hobo.project_config.asset_bucket} does not exist!"
97
+ # We allow this one to be skipped as there are obviously no assets to sync
89
98
  rescue AWS::S3::Errors::AccessDenied
90
99
  Hobo.ui.error " Your AWS key does not have access to the #{Hobo.project_config.asset_bucket} S3 bucket!"
91
100
  Hobo.ui.error " Please request access to this bucket from your TTL or via an internal support request"
101
+ raise exception
92
102
  rescue AWS::Errors::MissingCredentialsError
93
103
  Hobo.ui.warning " AWS credentials not set!"
94
- Hobo.ui.warning " Either set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env vars or run `hobo config` to set them jsut for hobo."
104
+ Hobo.ui.warning " Please request credentials from internalsupport@inivqa.com or in #devops and configure them with `hobo config`"
105
+ raise exception
95
106
  end
96
107
  end
97
108
 
@@ -1,4 +1,3 @@
1
-
2
1
  # No sensible way to silence gem warnings
3
2
  class Gem::Specification
4
3
  def self.warn m
@@ -1,40 +1,74 @@
1
1
  desc "Project asset commands"
2
2
  project_only
3
3
  namespace :assets do
4
+ def render_delta delta, type
5
+ if delta[:add] and delta[:add].length > 0
6
+ x = type == 'download' ? 'download from S3' : 'upload to S3'
7
+ Hobo.ui.section " Files to #{x}:" do
8
+ delta[:add].each do |f|
9
+ Hobo.ui.success " #{f}"
10
+ end
11
+ end
12
+ end
4
13
 
5
- desc "Download project assets"
6
- option "-e=", "--env=", "Environment"
7
- task :download do |task, args|
8
- Hobo.ui.success "Synchronizing assets (download)"
14
+ if delta[:remove] and delta[:remove].length > 0
15
+ x = type == 'download' ? 'locally' : 'from S3'
16
+ puts Hobo.ui.color " Files to delete #{x}:", :error
17
+ delta[:remove].each do |f|
18
+ puts Hobo.ui.color " #{f}", :error
19
+ end
20
+ Hobo.ui.separator
21
+ end
22
+ end
9
23
 
24
+ def do_sync src, dst, env, type
10
25
  unless Hobo.project_config.asset_bucket.nil?
11
- env = task.opts[:env] || args[:env] || 'development'
12
- s3_uri = "s3://#{Hobo.project_config.asset_bucket}/#{env}/"
13
26
  sync = Hobo::Lib::S3::Sync.new(Hobo.aws_credentials)
14
- changes = sync.sync(s3_uri, "tools/assets/#{env}")
15
- Hobo.ui.warning " No changes required" if (changes[:add] + changes[:remove]).length == 0
27
+ changes = sync.sync(src, dst, :dry => true)
28
+
29
+ if (changes[:add] + changes[:remove]).length > 0
30
+ answer = if type == 'download' && changes[:remove].length == 0
31
+ 'y'
32
+ else
33
+ render_delta changes, type
34
+ Hobo.ui.ask "Proceed? (Y/N)", :default => 'Y'
35
+ end
36
+
37
+ if answer.downcase == 'y'
38
+ sync.sync(src, dst)
39
+ else
40
+ raise Hobo::Error.new "Asset sync aborted"
41
+ end
42
+ else
43
+ Hobo.ui.warning " No changes required"
44
+ end
16
45
  else
17
46
  Hobo.ui.warning " No asset bucket configured. Skipping..."
18
47
  end
19
- Hobo.ui.separator
48
+ end
49
+
50
+ desc "Download project assets"
51
+ option "-e=", "--env=", "Environment"
52
+ task :download do |task, args|
53
+ Hobo.ui.section "Synchronizing assets (download)" do
54
+ env = task.opts[:env] || args[:env] || 'development'
55
+ src = "s3://#{Hobo.project_config.asset_bucket}/#{env}/"
56
+ dst = "tools/assets/#{env}"
57
+ do_sync src, dst, env, "download"
58
+ end
20
59
  end
21
60
 
22
61
  desc "Upload project assets"
23
62
  option "-e=", "--env=", "Environment"
24
63
  task :upload do |task, args|
25
- Hobo.ui.success "Synchronizing assets (upload)"
26
-
27
- unless Hobo.project_config.asset_bucket.nil?
64
+ Hobo.ui.section "Synchronizing assets (upload)" do
28
65
  env = task.opts[:env] || args[:env] || 'development'
29
- s3_uri = "s3://#{Hobo.project_config.asset_bucket}/#{env}/"
30
- sync = Hobo::Lib::S3::Sync.new(Hobo.aws_credentials)
31
- changes = sync.sync("tools/assets/#{env}", s3_uri)
32
- Hobo.ui.warning " No changes required" if (changes[:add] + changes[:remove]).length == 0
33
- else
34
- Hobo.ui.warning " No asset bucket configured. Skipping..."
66
+ dst = "s3://#{Hobo.project_config.asset_bucket}/#{env}/"
67
+ src = "tools/assets/#{env}"
68
+ Hobo.ui.warning "Please note that asset uploads can be destructive and will affect the whole team!"
69
+ Hobo.ui.warning "Only upload if you're sure your assets are free from errors and will not impact other team members"
70
+ do_sync src, dst, env, "upload"
35
71
  end
36
-
37
- Hobo.ui.separator
38
72
  end
39
73
 
40
74
  desc "Apply project assets"
@@ -24,14 +24,16 @@ namespace :deps do
24
24
  args = [ "php bin/composer.phar install #{ansi} --prefer-dist", { realtime: true, indent: 2 } ]
25
25
  complete = false
26
26
 
27
- check = Hobo::Lib::HostCheck.check(:filter => /php_present/)
27
+ if maybe(Hobo.project_config.tasks.deps.composer.disable_host_run)
28
+ check = Hobo::Lib::HostCheck.check(:filter => /php_present/)
28
29
 
29
- if check[:php_present] == :ok
30
- begin
31
- shell *args
32
- complete = true
33
- rescue Hobo::ExternalCommandError
34
- Hobo.ui.warning "Installing composer dependencies locally failed!"
30
+ if check[:php_present] == :ok
31
+ begin
32
+ shell *args
33
+ complete = true
34
+ rescue Hobo::ExternalCommandError
35
+ Hobo.ui.warning "Installing composer dependencies locally failed!"
36
+ end
35
37
  end
36
38
  end
37
39
 
@@ -76,7 +78,13 @@ namespace :deps do
76
78
  locate "*Berksfile" do
77
79
  Hobo.ui.title "Installing chef dependencies via berkshelf"
78
80
  bundle_shell "berks", "install", :realtime => true, :indent => 2
79
- bundle_shell "berks", "install", "--path", "cookbooks"
81
+ version = bundle_shell "berks", "-v", :capture => true
82
+ if version =~ /^[3-9]/
83
+ shell "rm -rf cookbooks"
84
+ bundle_shell "berks", "vendor", "cookbooks"
85
+ else
86
+ bundle_shell "berks", "install", "--path", "cookbooks"
87
+ end
80
88
  Hobo.ui.separator
81
89
  end
82
90
  end
@@ -53,5 +53,10 @@ module Hobo
53
53
  require 'rbconfig'
54
54
  !!(RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/)
55
55
  end
56
+
57
+ def system_ruby?
58
+ require 'rbconfig'
59
+ File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"]).match(/\/rvm\/|\/\.rvm\/|\/\.rbenv/) != nil
60
+ end
56
61
  end
57
62
  end
@@ -1,3 +1,3 @@
1
1
  module Hobo
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
3
3
  end
@@ -1,6 +1,11 @@
1
+ require 'simplecov'
2
+
3
+ SimpleCov.start do
4
+ add_filter "spec/"
5
+ end
6
+
1
7
  require 'hobo'
2
8
  require 'fakefs/safe'
3
- #require 'rr'
4
9
 
5
10
  RSpec.configure do |c|
6
11
  c.treat_symbols_as_metadata_keys_with_true_values = true
metadata CHANGED
@@ -1,181 +1,181 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobo-inviqa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Simons
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-23 00:00:00.000000000 Z
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.4.7
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.4.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: highline
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.6.20
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.6.20
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 10.1.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 10.1.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake-hooks
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.2.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.2.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.5.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.5.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: deepstruct
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.0.5
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.0.5
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: semantic
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 1.3.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 1.3.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: aws-sdk
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 1.34.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.34.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: ruby-progressbar
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 1.4.1
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 1.4.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: teerb
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: 0.0.1
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 0.0.1
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: net-ssh-simple
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: 1.6.3
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ~>
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: 1.6.3
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: pry
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ~>
171
+ - - "~>"
172
172
  - !ruby/object:Gem::Version
173
173
  version: 0.9.12
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ~>
178
+ - - "~>"
179
179
  - !ruby/object:Gem::Version
180
180
  version: 0.9.12
181
181
  description: Inviqan toolbelt
@@ -186,7 +186,8 @@ executables:
186
186
  extensions: []
187
187
  extra_rdoc_files: []
188
188
  files:
189
- - .editorconfig
189
+ - ".editorconfig"
190
+ - ".gitignore"
190
191
  - Gemfile
191
192
  - Gemfile.lock
192
193
  - Guardfile
@@ -207,6 +208,7 @@ files:
207
208
  - lib/hobo/asset_applicator.rb
208
209
  - lib/hobo/asset_applicators/files.rb
209
210
  - lib/hobo/asset_applicators/sqldump.rb
211
+ - lib/hobo/bundler.rb
210
212
  - lib/hobo/cli.rb
211
213
  - lib/hobo/config.rb
212
214
  - lib/hobo/config/file.rb
@@ -219,7 +221,6 @@ files:
219
221
  - lib/hobo/helper/http_download.rb
220
222
  - lib/hobo/helper/shell.rb
221
223
  - lib/hobo/helper/vm_command.rb
222
- - lib/hobo/init/bundler_context.rb
223
224
  - lib/hobo/lib/host_check.rb
224
225
  - lib/hobo/lib/host_check/deps.rb
225
226
  - lib/hobo/lib/host_check/git.rb
@@ -289,12 +290,12 @@ require_paths:
289
290
  - lib
290
291
  required_ruby_version: !ruby/object:Gem::Requirement
291
292
  requirements:
292
- - - ! '>='
293
+ - - ">="
293
294
  - !ruby/object:Gem::Version
294
295
  version: '0'
295
296
  required_rubygems_version: !ruby/object:Gem::Requirement
296
297
  requirements:
297
- - - ! '>='
298
+ - - ">="
298
299
  - !ruby/object:Gem::Version
299
300
  version: '0'
300
301
  requirements: []
@@ -1,41 +0,0 @@
1
- # Hack to override Gemfile to that of hobo (otherwise it'll use project specific one!)
2
- ENV['BUNDLE_GEMFILE'] = File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- require 'shellwords'
5
-
6
- begin
7
- Bundler.setup(:default)
8
- rescue Bundler::GemNotFound => exception
9
- puts exception
10
- puts
11
- puts 'Missing dependencies detected!'
12
- print 'These will automatically be installed now, please wait'
13
- rval = nil
14
-
15
- fake_progress = Thread.new do
16
- while true
17
- print '.'
18
- sleep 10
19
- end
20
- end
21
-
22
- IO::popen("bundle install --gemfile=#{ENV['BUNDLE_GEMFILE'].shellescape}") do |io|
23
- while line = io.gets
24
- print '.'
25
- end
26
- fake_progress.exit
27
- puts ' done'
28
- io.close
29
- rval = $?.to_i
30
- end
31
-
32
- if rval == 0
33
- Kernel.exec('hobo', *$HOBO_ARGV)
34
- else
35
- puts
36
- puts "Failed to install dependencies. Hobo can not proceed."
37
- puts "Please see the error below:"
38
- puts
39
- throw e
40
- end
41
- end