class Deck::CommandLine
Public Instance Methods
design(name)
click to toggle source
# File lib/deck/command_line.rb, line 11 def design(name) reload_local_config ensure_user_config helper = ContainerHelper.new name, options system helper.build_command system helper.update_latest_tag end
Private Instance Methods
config_list()
click to toggle source
# File lib/deck/command_line.rb, line 50 def config_list maximum_length = Deck::Config.keys.reduce(0) { |memo,k| k.length > memo ? k.length : memo} Deck::Config.keys.each do |key| printf " %#{maximum_length}s : %s\n", key, Deck::Config[key] end end
reload_local_config()
click to toggle source
desc ‘load NAME’, ‘running a docker container from image’ option :value, aliases: [:V], banner: ‘KEY=VALUE’, desc: ‘override variable. format: key=value,key=value’ def load(name)
reload_local_config helper = ContainerHelper.new name, options puts helper.run_command
end
desc ‘config [NAME [VALUE]]’, ‘get/set configuration value’ def config(name = nil, value = nil)
reload_local_config return config_list if name.nil? and value.nil? return if value.nil? and !Deck::Config.keys.include? name return puts(Deck::Config[name.to_sym]) if value.nil? write_config name, value
end
# File lib/deck/command_line.rb, line 44 def reload_local_config dir = options[:dir] Deck::Config.source "#{dir}/config.yml" Deck::Config.reload! end
write_config(name, value)
click to toggle source
# File lib/deck/command_line.rb, line 57 def write_config(name, value) hash = YAML.load(ERB.new(File.read "#{options[:dir]}/config.yml").result) hash = {} if hash.nil? or hash.empty? hash[name] = value File.open("#{options[:dir]}/config.yml", 'w') do |f| f.write(YAML.dump(hash)) end end