module Dockage

Constants

VERSION

Attributes

debug_mode[RW]
force_mode[RW]
quiet_mode[RW]
verbose_mode[RW]

Public Class Methods

config_path() click to toggle source
# File lib/dockage.rb, line 28
def config_path
  File.join(root, 'dockage.yml')
end
create_example_config() click to toggle source
# 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) click to toggle source
# File lib/dockage.rb, line 53
def debug(string)
  return unless string
  puts string.magenta if Dockage.debug_mode
end
error(string = 'unknown error') click to toggle source
# File lib/dockage.rb, line 68
def error(string = 'unknown error')
  puts string.red unless Dockage.quiet_mode
  exit 1
end
logger(string) click to toggle source
# File lib/dockage.rb, line 63
def logger(string)
  return unless string
  puts "> #{string}" unless Dockage.quiet_mode
end
root() click to toggle source
# File lib/dockage.rb, line 24
def root
  @root ||= Dir.pwd
end
settings() click to toggle source
# File lib/dockage.rb, line 32
def settings
  @settings ||= Settings.load(config_path)
end
verbose(string) click to toggle source
# File lib/dockage.rb, line 58
def verbose(string)
  return unless string
  puts string.blue if Dockage.verbose_mode
end
which(executable) click to toggle source
# 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