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



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
  "\nIt takes its arguments(name, git repository and application type) from the base directory.\nUsage: ey_cli create_app\n\nOptions:\n --account name             Name of the account to add the application to.\n --name name                Name of the app.\n --git uri                  Git repository uri.\n --type type                Application type, either rack, rails2 or rails3.\n --env_name name            Name of the environment to create.\n --framework_env env        Type of the environment (production, staging...).\n --url url                  Domain name for the app. It accepts comma-separated values.\n --app_instances number     Number of application instances.\n --db_instances number      Number of database slaves.\n --solo                     A single instance for application and database.\n --stack                    App server stack, either passenger, unicorn or trinidad.\n --db_stack                 DB stack, valid options:\n                                mysql (for MySQL 5.0),\n                                mysql5_5 (for MySQL 5.5),\n                                postgresql or postgres9_1 (for PostgreSQL 9.1)\n --no_env                   Prevent to not create a default environment.\n --app_size                 Size of the app instances.\n --db_size                  Size of the db instances.\n"
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