Class: EYCli::Command::CreateEnv

Inherits:
Base
  • Object
show all
Defined in:
lib/ey_cli/commands/create_env.rb

Defined Under Namespace

Classes: EnvParser

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#run

Constructor Details

#initializeCreateEnv

Returns a new instance of CreateEnv.



4
5
6
7
8
# File 'lib/ey_cli/commands/create_env.rb', line 4

def initialize
  @accounts     = EYCli::Controller::Accounts.new
  @apps         = EYCli::Controller::Apps.new
  @environments = EYCli::Controller::Environments.new
end

Instance Method Details

#helpObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ey_cli/commands/create_env.rb', line 18

def help
  <<-EOF

It takes the information from the current directory. It will guide you if it cannot reach all that information.
Usage: ey_cli create_env

Options:
 --app name                 Name of the app to create the environment for.
 --name name                Name of the environment.
 --framework_env env        Type of the environment (production, staging...).
 --url url                  Domain name for the app. It accepts comma-separated values.
 --app_instances number     Number of application instances.
 --db_instances number      Number of database slaves.
 --solo                     A single instance for application and database.
 --stack                    App server stack, either passenger, unicorn or trinidad.
 --db_stack                 DB stack, valid options:
                                mysql (for MySQL 5.0),
                                mysql5_5 (for MySQL 5.5),
                                postgresql or postgres9_1 (for PostgreSQL 9.1)
 --app_size                 Size of the app instances.
 --db_size                  Size of the db instances.
EOF
end

#invokeObject



10
11
12
13
14
15
16
# File 'lib/ey_cli/commands/create_env.rb', line 10

def invoke
       = @accounts.(options[:account]) if options[:account]
  app         = @apps.fetch_app(, {:app_name => options[:app]})
  env_options = options_parser.fill_create_env_options(options)
  
  @environments.create(app, env_options)
end

#options_parserObject



42
43
44
# File 'lib/ey_cli/commands/create_env.rb', line 42

def options_parser
  EnvParser.new
end