Class: EYCli::Command::CreateEnv::EnvParser
- Inherits:
-
Object
- Object
- EYCli::Command::CreateEnv::EnvParser
- Defined in:
- lib/ey_cli/commands/create_env.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.check_instance_size(size) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ey_cli/commands/create_env.rb', line 65 def self.check_instance_size(size) sizes_list = [ 'm1.small', 'm1.large', 'm1.xlarge', 'm2.xlarge', 'm2.2xlarge', 'm2.4xlarge', 'c1.medium', 'c1.xlarge' ] unless sizes_list.include?(size) EYCli.term.say("Unknown instance size: #{size}. Please, use one of the following list:") EYCli.term.say(sizes_list.inspect) exit 1 end end |
Instance Method Details
#fill_create_env_options(options) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ey_cli/commands/create_env.rb', line 78 def () opts = {:name => [:name], :framework_env => [:framework_env]} if [:stack] case [:stack].to_sym when :passenger then [:stack] = 'nginx_passenger3' when :unicorn then [:stack] = 'nginx_unicorn' when :trinidad then [:ruby_version] = 'JRuby' end end if [:app_instances] || [:db_instances] || [:solo] || [:app_size] || [:db_size] cluster_conf = .dup if [:solo] EYCli.term.say('~> creating solo environment, ignoring instance numbers') cluster_conf[:configuration] = 'single' else cluster_conf[:configuration] = 'custom' end opts[:cluster_configuration] = cluster_conf else opts[:cluster_configuration] = {:configuration => 'cluster'} end opts end |
#parse(args) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ey_cli/commands/create_env.rb', line 44 def parse(args) opts = Slop.parse(args, {:multiple_switches => false}) do on :app, true on :name, true on :framework_env, true on :url, true on :app_instances, true, :as => :integer on :db_instances, true, :as => :integer #on :util_instances, true, :as => :integer # FIXME: utils instances are handled differently on :solo, false, :default => false on :stack, true, :matches => /passenger|unicorn|trinidad/ on :app_size, true do |size| EnvParser.check_instance_size(size) end on :db_size, true do |size| EnvParser.check_instance_size(size) end end opts.to_hash end |