class Prepd::Command
Public Class Methods
build(name = ARGV.shift)
click to toggle source
# File lib/prepd/cli/commands.rb, line 24 def self.build(name = ARGV.shift) cr = Machine.new(name: name) return cr.errors.full_messages.join("\n") unless cr.valid? cr.create nil end
config()
click to toggle source
# File lib/prepd/cli/commands.rb, line 5 def self.config; Prepd.config; end
list(type = ARGV.shift)
click to toggle source
# File lib/prepd/cli/commands.rb, line 7 def self.list(type = ARGV.shift) return 'invalid type' unless %w(clusters projects machines).include? type "Prepd::#{type.classify}".constantize.new.in_component_root { Dir.glob('*') } end
new(type = ARGV.shift, name = ARGV.shift, *args)
click to toggle source
# File lib/prepd/cli/commands.rb, line 12 def self.new(type = ARGV.shift, name = ARGV.shift, *args) cr = Creator.new(type: type) # TODO: this should display the appropriate help if name is not supplied return cr.errors.full_messages.join("\n") unless cr.valid? # return 'Must supply type' unless type # return 'Must supply APP_PATH' unless name obj = cr.klass.new(name: name) return obj.errors.full_messages.join("\n") unless obj.valid? obj.create nil end
rm(name = nil)
click to toggle source
# File lib/prepd/cli/commands.rb, line 41 def self.rm(name = nil) name ||= ARGV[0] || Dir.pwd.split('/').last return unless obj = klass.find_by(name: name) obj.destroy ? nil : obj.errors.full_messages.join('. ') end
setup()
click to toggle source
Setup
a new installation of prepd on a workstation
# File lib/prepd/cli/commands.rb, line 50 def self.setup obj = Setup.new return obj.errors.full_messages.join("\n") unless obj.valid? obj.create end
show(name = nil)
click to toggle source
# File lib/prepd/cli/commands.rb, line 31 def self.show(name = nil) name ||= ARGV[0] || Dir.pwd.split('/').last return unless obj = klass.find_by(name: name) YAML.load(obj.to_yaml) end
up(name = ARGV.shift)
click to toggle source
# File lib/prepd/cli/commands.rb, line 37 def self.up(name = ARGV.shift) Cluster.new(name: name).up end