Class: Railshoster::InitCommand
- Includes:
- GeneralCapistranoHelpers, InitCapistranoHelpers, InitDatabaseHelpers, InitGemHelpers, InitSshHelpers, InitValidationHelpers
- Defined in:
- lib/railshoster/init_command.rb
Overview
This action class helps to setup a new rails applicaton
Design Contraints
-
The workflow of this class should be easy to read. Hence helper methods are sourced out to helper modules.
-
All modifications of the @app_hash must be done within this file not in a helper module. This helps to easily grasp the app_hash structure with all changed made to it.
Constant Summary
Constants included from InitDatabaseHelpers
Railshoster::InitDatabaseHelpers::DB_GEM_TO_DB_ADAPTER
Constants included from InitGemHelpers
Railshoster::InitGemHelpers::SUPPORTED_DATABASE_GEMS, Railshoster::InitGemHelpers::UNSUPPORTED_DATABASE_GEMS
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(project_dir, application_hash_as_json_string) ⇒ InitCommand
constructor
A new instance of InitCommand.
-
#start ⇒ Object
Instance Methods.
Methods included from GeneralCapistranoHelpers
#capistrano_greater_than_2?, #installed_capistrano_version
Constructor Details
#initialize(project_dir, application_hash_as_json_string) ⇒ InitCommand
Returns a new instance of InitCommand.
31 32 33 34 |
# File 'lib/railshoster/init_command.rb', line 31 def initialize(project_dir, application_hash_as_json_string) super(project_dir) @application_hash_as_json_string = application_hash_as_json_string end |
Class Method Details
.run_by_application_token(project_dir, application_token) ⇒ Object
Static
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/railshoster/init_command.rb', line 47 def self.run_by_application_token(project_dir, application_token) decoded_token = decode_token(application_token) begin new(project_dir, decoded_token).start rescue BadApplicationJSONHashError => e msg = "Please verify your application_token. It did not decode to a valid application hash.\n" + "This is how your application token looked like:\n\n#{application_token.inspect}\n\n" + "Please compare your application token char by char with your account information mail and try again!\n" + "Here is what the application hash parser said:\n\n" raise BadApplicationTokenError.new(msg + e.) end end |
Instance Method Details
#start ⇒ Object
Instance Methods
37 38 39 40 41 42 43 |
# File 'lib/railshoster/init_command.rb', line 37 def start check_system_requirements check_project_requirements @app_hash = parse_application_json_hash(@application_hash_as_json_string) process_application_hash end |