module Kapten::Helpers

Constants

TYPES

Public Class Methods

get_image(type) click to toggle source

Get Docker image by environment type

# File lib/kapten/helpers.rb, line 43
def self.get_image(type)

  return Kapten::Helpers::TYPES[ type ]

end
get_types() click to toggle source

Get all available environment types

# File lib/kapten/helpers.rb, line 51
def self.get_types

  return Kapten::Helpers::TYPES.keys

end
remove(name) click to toggle source

Remove all traces of Kapten (stop and destory container, delete config file)

# File lib/kapten/helpers.rb, line 59
def self.remove(name)

  Kapten::DockerApi::destroy( name )

  File.delete( Kapten::Config::CONFIG_FILE )

end
validate_install() click to toggle source

Validate that Kapten is initalized and Docker is installed

# File lib/kapten/helpers.rb, line 19
def self.validate_install

  config = Kapten::Config::get

  # Make sure a config exists (Kapten has been initialized)
  unless config
    puts 'Kapten not initalized'.red
    puts 'Run "kapten init" to get started'.red
    return false
  end

  # Make sure Docker is instsalled
  unless Kapten::DockerApi::has_docker?
    puts 'Kapten requires Docker'.red
    puts 'Install and then try running command again: https://www.docker.com'.red
    return false
  end

  return config

end