Module: Hobo

Defined in:
lib/hobo/ui.rb,
lib/hobo/cli.rb,
lib/hobo/null.rb,
lib/hobo/util.rb,
lib/hobo/paths.rb,
lib/hobo/config.rb,
lib/hobo/errors.rb,
lib/hobo/bundler.rb,
lib/hobo/logging.rb,
lib/hobo/version.rb,
lib/hobo/metadata.rb,
lib/hobo/config/file.rb,
lib/hobo/lib/s3/sync.rb,
lib/hobo/helper/shell.rb,
lib/hobo/lib/seed/seed.rb,
lib/hobo/help_formatter.rb,
lib/hobo/lib/host_check.rb,
lib/hobo/lib/vm/command.rb,
lib/hobo/asset_applicator.rb,
lib/hobo/lib/seed/project.rb,
lib/hobo/lib/vm/inspector.rb,
lib/hobo/helper/vm_command.rb,
lib/hobo/lib/s3/local/file.rb,
lib/hobo/lib/seed/replacer.rb,
lib/hobo/lib/host_check/git.rb,
lib/hobo/lib/s3/remote/file.rb,
lib/hobo/helper/file_locator.rb,
lib/hobo/lib/host_check/deps.rb,
lib/hobo/lib/host_check/hobo.rb,
lib/hobo/lib/host_check/ruby.rb,
lib/hobo/error_handlers/debug.rb,
lib/hobo/helper/http_download.rb,
lib/hobo/lib/host_check/vagrant.rb,
lib/hobo/lib/s3/local/iohandler.rb,
lib/hobo/error_handlers/friendly.rb,
lib/hobo/lib/s3/remote/iohandler.rb,
lib/hobo/error_handlers/exit_code_map.rb,
lib/hobo/lib/self_signed_cert_generator.rb

Defined Under Namespace

Modules: Bundler, Config, ErrorHandlers, Helper, Lib, Logging Classes: AssetApplicatorRegistry, Cli, Error, ExternalCommandError, Halt, HelpFormatter, HostCheckError, InvalidCommandOrOpt, Metadata, MissingArgumentsError, MissingDependencies, MissingDependency, NonInteractiveError, Null, ProjectOnlyError, RubyVersionError, Ui, UserError

Constant Summary collapse

VERSION =
'0.0.15'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.asset_applicatorsHobo::AssetApplicatorRegistry

Utility method to access (with initialization) the asset applicator registry. This allows you to register new asset applicator methods on a per-project basis. For example:

Hobo.asset_applicators.register /.*\.zip/ do |file|
  Dir.chdir File.dirname(file) do
    shell "unzip", file
  end
end

Returns:

See Also:



17
18
19
# File 'lib/hobo/asset_applicator.rb', line 17

def asset_applicators
  @asset_applicators
end

.cliObject

Returns the value of attribute cli.



4
5
6
# File 'lib/hobo/cli.rb', line 4

def cli
  @cli
end

.loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/hobo/logging.rb', line 3

def logger
  @logger
end

.project_bar_cacheObject

Returns the value of attribute project_bar_cache.



4
5
6
# File 'lib/hobo/util.rb', line 4

def project_bar_cache
  @project_bar_cache
end

.project_configObject

Returns the value of attribute project_config.



3
4
5
# File 'lib/hobo/config.rb', line 3

def project_config
  @project_config
end

.project_pathObject

Returns the value of attribute project_path.



3
4
5
# File 'lib/hobo/paths.rb', line 3

def project_path
  @project_path
end

.uiObject

Returns the value of attribute ui.



3
4
5
# File 'lib/hobo/ui.rb', line 3

def ui
  @ui
end

.user_configObject

Returns the value of attribute user_config.



3
4
5
# File 'lib/hobo/config.rb', line 3

def user_config
  @user_config
end

Class Method Details

.aws_credentialsObject



45
46
47
48
49
50
# File 'lib/hobo/util.rb', line 45

def aws_credentials
  {
    :access_key_id => maybe(Hobo.user_config.aws.access_key_id) || ENV['AWS_ACCESS_KEY_ID'],
    :secret_access_key => maybe(Hobo.user_config.aws.secret_access_key) || ENV['AWS_SECRET_ACCESS_KEY']
  }
end

.config_pathObject



5
6
7
# File 'lib/hobo/paths.rb', line 5

def config_path
  File.join(ENV['HOME'], '.hobo')
end

.hobofile_pathObject



43
44
45
46
# File 'lib/hobo/paths.rb', line 43

def hobofile_path
  return nil if !project_path
  File.join(project_path, 'Hobofile')
end

.in_project?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/hobo/util.rb', line 10

def in_project?
  !!Hobo.project_path
end

.progress(file, increment, total, type, opts = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/hobo/util.rb', line 14

def progress file, increment, total, type, opts = {}
  require 'ruby-progressbar'

  opts = {
    :title => File.basename(file),
    :total => total,
    :format => "%t [%B] %p%% %e"
  }.merge(opts)

  # Hack to stop newline spam on windows
  opts[:length] = 79 if Gem::win_platform?

  @progress_bar_cache ||= {}

  if type == :reset
    type = :update
    @progress_bar_cache.delete file
  end

  @progress_bar_cache[file] ||= ProgressBar.create(opts)

  case type
    when :update
      @progress_bar_cache[file].progress += increment
    when :finished
      @progress_bar_cache[file].finish
  end

  return @progress_bar_cache[file]
end

.project_bin_pathObject



38
39
40
41
# File 'lib/hobo/paths.rb', line 38

def project_bin_path
  return nil if !project_path
  File.join(project_path, 'bin')
end

.project_config_fileObject



48
49
50
51
# File 'lib/hobo/paths.rb', line 48

def project_config_file
  return nil if !project_path
  File.join(project_path, 'tools', 'hobo', 'config.yaml')
end

.relaunch!(env = {}) ⇒ Object



6
7
8
# File 'lib/hobo/util.rb', line 6

def relaunch! env = {}
  Kernel.exec(env, 'hobo', '--skip-host-checks', *$HOBO_ARGV)
end

.seed_cache_pathObject



9
10
11
# File 'lib/hobo/paths.rb', line 9

def seed_cache_path
  File.join(config_path, 'seeds')
end

.system_ruby?Boolean

Returns:

  • (Boolean)


57
58
59
60
# File 'lib/hobo/util.rb', line 57

def system_ruby?
  require 'rbconfig'
  File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"]).match(/\/rvm\/|\/\.rvm\/|\/\.rbenv/) != nil
end

.user_config_fileObject



53
54
55
# File 'lib/hobo/paths.rb', line 53

def user_config_file
  File.join(config_path, 'config.yaml')
end

.user_hobofile_pathObject



57
58
59
# File 'lib/hobo/paths.rb', line 57

def user_hobofile_path
  File.join(config_path, 'Hobofile')
end

.windows?Boolean

Returns:

  • (Boolean)


52
53
54
55
# File 'lib/hobo/util.rb', line 52

def windows?
  require 'rbconfig'
  !!(RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/)
end