Class: Webbynode::Commands::Push
- Inherits:
-
Webbynode::Command
- Object
- Webbynode::Command
- Webbynode::Commands::Push
- Includes:
- Updater
- Defined in:
- lib/webbynode/commands/push.rb
Constant Summary
Constants inherited from Webbynode::Command
Webbynode::Command::Aliases, Webbynode::Command::CommandError, Webbynode::Command::InvalidCommand, Webbynode::Command::InvalidOption, Webbynode::Command::Settings
Instance Attribute Summary collapse
-
#after_tasks ⇒ Object
Returns the value of attribute after_tasks.
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#before_tasks ⇒ Object
Returns the value of attribute before_tasks.
Instance Method Summary collapse
- #execute ⇒ Object
- #handle_semaphore ⇒ Object
-
#initialize(*args) ⇒ Push
constructor
A new instance of Push.
Methods included from Updater
Methods inherited from Webbynode::Command
add_alias, #api, class_for, command, command_class_name, description, for, #gemfile, #git, help, inherited, #io, #no?, #notify, option, #option, #options, options_help, #param, #param_values, parameter, #params, #params_hash, params_help, #pushand, #remote_executor, requires_initialization!, requires_options!, requires_pushed_application!, #run, #server, setting, #settings, summary, summary_help, usage, #validate_initialization, #validate_options, #yes?
Constructor Details
Instance Attribute Details
#after_tasks ⇒ Object
Returns the value of attribute after_tasks.
7 8 9 |
# File 'lib/webbynode/commands/push.rb', line 7 def after_tasks @after_tasks end |
#app_name ⇒ Object
Returns the value of attribute app_name.
7 8 9 |
# File 'lib/webbynode/commands/push.rb', line 7 def app_name @app_name end |
#before_tasks ⇒ Object
Returns the value of attribute before_tasks.
7 8 9 |
# File 'lib/webbynode/commands/push.rb', line 7 def before_tasks @before_tasks end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 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 52 53 54 55 56 57 |
# File 'lib/webbynode/commands/push.rb', line 21 def execute unless option(:dirty) raise CommandError, "Cannot push because you have pending changes. Do a git commit or add changes to .gitignore." unless git.clean? end @app_name = pushand.parse_remote_app_name # Ensures there are Task Files to read from before_tasks.ensure_tasks_folder # Reads out the "before push" tasks file to see if there are any tasks that must be performed # It will perform the "before push" tasks if there are any available before_tasks.read_tasks(Webbynode::Commands::Tasks::BeforePushTasksFile) perform_before_tasks if before_tasks.has_tasks? handle_semaphore # Logs a initialization message to the user io.log "Pushing #{app_name.color(:cyan)}", :start # Checks for server-side updates if check_for_updates io.log "Note: Rapp Engine updated".color(:yellow) io.log "" end # Pushes the application to Webbynode io.exec("git push webbynode +HEAD:master", false) # Reads out the "after push" tasks file to see if there are any tasks that must be performed # It will perform the "after push" tasks if there are any available after_tasks.read_tasks(Webbynode::Commands::Tasks::AfterPushTasksFile) perform_after_tasks if after_tasks.has_tasks? io.log "Finished pushing #{app_name.color(:cyan)}", :finish end |
#handle_semaphore ⇒ Object
59 60 61 62 |
# File 'lib/webbynode/commands/push.rb', line 59 def handle_semaphore return unless option(:'recreate-vhost') remote_executor.exec "mkdir -p /var/webbynode/semaphores && touch /var/webbynode/semaphores/recreate_#{app_name}" end |