Sha256: 4854c9ae9c7fa40c6e1e3088a1467b241f040ddd99c0bc0afc22f184a8604083
Contents?: true
Size: 1.65 KB
Versions: 4
Compression:
Stored size: 1.65 KB
Contents
require 'trollop' module Stackster module CLI def self.start @opts = Trollop::options do banner <<-EOS I build and manage AWS Cloud Formation Stacks stackster list stackster create -n STACK_NAME -a ATTRIBUTES -t TEMPLATE_PATH stackster update -n STACK_NAME -a ATTRIBUTES stackster show -n STACK_NAME stackster destroy -n STACK_NAME EOS opt :help, "Display Help" opt :attributes, "CSV list of = seperated attributes to set", :type => :string opt :name, "Stack name to manage", :type => :string opt :template, "Path to the template file", :type => :string end @cmd = ARGV.shift case @cmd when 'create', 'destroy', 'delete', 'list', 'update', 'show' @s = Stack.new :name => @opts[:name], :config => nil end read_attributes case @cmd when 'create' @s.create :attributes => attributes, :template => @opts[:template] puts "#{@opts[:name]} created." when 'update' @s.update :attributes => attributes puts "#{@opts[:name]} updated." when 'destroy', 'delete' @s.destroy puts "#{@opts[:name]} destroyed." when 'show' puts @s.display.to_yaml when 'list' puts Stack.list(:config => nil) else puts "Unkown command '#{@cmd}'" end end def self.attributes attrs = [] read_attributes.each do |attribs| a = attribs.split('=') attrs << { a.first => a.last } end attrs end def self.read_attributes @opts[:attributes].nil? ? [] : @opts[:attributes].split(',') end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
stackster-0.1.0 | lib/stackster/cli.rb |
stackster-0.0.5 | lib/stackster/cli.rb |
stackster-0.0.4 | lib/stackster/cli.rb |
stackster-0.0.3 | lib/stackster/cli.rb |