Module: Dockage

Defined in:
lib/dockage.rb,
lib/dockage/cli.rb,
lib/dockage/ssh.rb,
lib/dockage/docker.rb,
lib/dockage/version.rb,
lib/dockage/settings.rb,
lib/dockage/docker/parse.rb,
lib/dockage/docker/shell.rb

Defined Under Namespace

Modules: Docker Classes: CLI, DockageConfigExists, DockageConfigNotFound, DockageError, InstallError, InvalidOptionError, ProvideError, SSH, SSHOptionsError, Settings

Constant Summary collapse

VERSION =
'0.1.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.debug_modeObject

Returns the value of attribute debug_mode.



19
20
21
# File 'lib/dockage.rb', line 19

def debug_mode
  @debug_mode
end

.force_modeObject

Returns the value of attribute force_mode.



22
23
24
# File 'lib/dockage.rb', line 22

def force_mode
  @force_mode
end

.quiet_modeObject

Returns the value of attribute quiet_mode.



21
22
23
# File 'lib/dockage.rb', line 21

def quiet_mode
  @quiet_mode
end

.verbose_modeObject

Returns the value of attribute verbose_mode.



20
21
22
# File 'lib/dockage.rb', line 20

def verbose_mode
  @verbose_mode
end

Class Method Details

.config_pathObject



28
29
30
# File 'lib/dockage.rb', line 28

def config_path
  File.join(root, 'dockage.yml')
end

.create_example_configObject



36
37
38
39
40
# File 'lib/dockage.rb', line 36

def create_example_config
  raise DockageConfigExists if File.exist? config_path
  FileUtils.cp(File.expand_path('../dockage/templates/dockage.yml', __FILE__), config_path)
  puts 'Created example config dockage.yml'
end

.debug(string) ⇒ Object



53
54
55
56
# File 'lib/dockage.rb', line 53

def debug(string)
  return unless string
  puts string.magenta if Dockage.debug_mode
end

.error(string = 'unknown error') ⇒ Object



68
69
70
71
# File 'lib/dockage.rb', line 68

def error(string = 'unknown error')
  puts string.red unless Dockage.quiet_mode
  exit 1
end

.logger(string) ⇒ Object



63
64
65
66
# File 'lib/dockage.rb', line 63

def logger(string)
  return unless string
  puts "> #{string}" unless Dockage.quiet_mode
end

.rootObject



24
25
26
# File 'lib/dockage.rb', line 24

def root
  @root ||= Dir.pwd
end

.settingsObject



32
33
34
# File 'lib/dockage.rb', line 32

def settings
  @settings ||= Settings.load(config_path)
end

.verbose(string) ⇒ Object



58
59
60
61
# File 'lib/dockage.rb', line 58

def verbose(string)
  return unless string
  puts string.blue if Dockage.verbose_mode
end

.which(executable) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/dockage.rb', line 42

def which(executable)
  if File.file?(executable) && File.executable?(executable)
    executable
  elsif ENV['PATH']
    path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p|
      File.executable?(File.join(p, executable))
    end
    path && File.expand_path(executable, path)
  end
end