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
72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/ey_cli/commands/create_env.rb', line 72 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
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/ey_cli/commands/create_env.rb', line 85 def () opts = { :name => ([:env_name] || [:name]), :framework_env => [:framework_env], :stack => [:stack], :db_stack => [:db_stack], :ruby_version => [:ruby_version] } if opts[:stack] case opts[:stack].to_sym when :passenger then opts[:stack] = 'nginx_passenger3' when :unicorn then opts[:stack] = 'nginx_unicorn' when :trinidad then opts[:ruby_version] = 'JRuby' end end if opts[:db_stack] case opts[:db_stack].to_sym when :postgresql then opts[:db_stack] = 'postgres9_1' end end if [:app_instances] || [:db_instances] || [:solo] || [:app_size] || [:db_size] cluster_conf = .dup if [:solo] EYCli.term.say('~> creating solo environment') 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
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ey_cli/commands/create_env.rb', line 50 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|puma|thin|trinidad/ on :db_stack, true, :matches => /mysql|postgres/ 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 |