Sha256: dd409e8d99cc7e22491a51f8c7a8a6b98ab32e7bb803c80def7726b50d792ebe
Contents?: true
Size: 1.92 KB
Versions: 5
Compression:
Stored size: 1.92 KB
Contents
require 'trollop' module Stackster module CLI def self.start @opts = Trollop::options do version Stackster::VERSION 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 Attributes are specified as '=' seperated key value pairs. Multiple can be specified. For example: stackster create -n test-stack -t ~/my-template.json -a arg1=val1 -a arg2=vol2 EOS opt :help, "Display Help" opt :attributes, "= seperated attribute and it's value", :type => :string, :multi => true 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 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 StackLister.new.all else puts "Unkown command '#{@cmd}'" end end private def self.attributes attrs = [] read_attributes.each do |attribs| a = attribs.split('=') attrs << { a.first.gsub(/\s+/, "") => a.last } end attrs end def self.read_attributes @opts[:attributes].nil? ? [] : @opts[:attributes] end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
stackster-0.2.7 | lib/stackster/cli.rb |
stackster-0.2.6 | lib/stackster/cli.rb |
stackster-0.2.5 | lib/stackster/cli.rb |
stackster-0.2.4 | lib/stackster/cli.rb |
stackster-0.2.3 | lib/stackster/cli.rb |