Class: EYCli::Command::CreateApp

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

Defined Under Namespace

Classes: AppParser

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#run

Constructor Details

#initializeCreateApp

Returns a new instance of CreateApp.



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

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

Instance Method Details

#helpObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ey_cli/commands/create_app.rb', line 25

def help
  <<-EOF

It takes its arguments(name, git repository and application type) from the base directory.
Usage: ey_cli create_app

Options:
 --account name             Name of the account to add the application to.
 --name name                Name of the app.
 --git uri                  Git repository uri.
 --type type                Application type, either rack, rails2 or rails3.
 --env_name name            Name of the environment to create.
 --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)
 --no_env                   Prevent to not create a default environment.
 --app_size                 Size of the app instances.
 --db_size                  Size of the db instances.
EOF
end

#invokeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ey_cli/commands/create_app.rb', line 10

def invoke
   = @accounts.(options.delete(:account))
  app = @apps.create(, Dir.pwd, options)
  if app
    env_parser = CreateEnv::EnvParser.new.fill_create_env_options(options)
    if options[:no_env]
      EYCli.term.say("Skipping creation of environment...")
    else
      environment = @envs.create(app, env_parser)
      EYCli.term.say("You can run now 'ey_cli show #{app.name}' to know the status of the application")
    end
  end
  app
end

#options_parserObject



53
54
55
# File 'lib/ey_cli/commands/create_app.rb', line 53

def options_parser
  AppParser.new
end