Class: Deployinator::Deploy

Inherits:
Object
  • Object
show all
Includes:
Helpers, Helpers::PluginHelpers, Helpers::VersionHelpers
Defined in:
lib/deployinator/controller.rb

Overview

Public: this class represents the Deploy object with all the properties the different helper and stack methods need to do the deploy. It is basically an almost empty class and gets all of its functionality by the modules it includes/extends based on the stack we are deploying.

Constant Summary

Constants included from Helpers

Helpers::RUN_LOG_PATH

Instance Attribute Summary

Attributes included from Helpers::PluginHelpers

#plugins

Instance Method Summary collapse

Methods included from Helpers

#announce, #average_duration, #can_remove_stack_lock?, #clean, #deploy_host?, #dev_context?, #diff, #diff_url, #environments, #get_deploy_target_status, #get_from_cache, #get_log, #get_run_logs, #get_stack_select, #head_build, #http_host, #hyperlink, #init, #is_admin?, #link_stack_logfile, #lock_pushes, #log, #log_and_shout, #log_and_stream, #log_entries, #log_error, #log_string_to_file, #move_stack_logfile, #nice_time, #nicify_env, #not_dev?, #now, #push_lock_info, #push_lock_path, #pushes_locked?, #run_cmd, #run_cmd_with_retries, #run_log_path, #run_log_url, #runlog_filename, #runlog_thread_filename, #send_email, #stack, #strip_ws_to_nil, #timing_log, #unlock_pushes, #with_timeout, #write_file, #write_to_cache

Methods included from Helpers::VersionHelpers

curl_get_url, get_build, get_version, get_version_by_url

Methods included from Helpers::PluginHelpers

#notify_plugins, #raise_event, #register_plugins

Constructor Details

#initialize(args) ⇒ Deploy

Public: initialize the deploy class with instance variables that are needed by the deploy methods, runlog helpers and all that

Params:

args - hash which at least has the following fields:
       { :username => "name of the person that is deploying",
         :stack => "the name of the stack to deploy",
         :stage => "stage of the stack to deploy"
       }

Returns the runlog filename



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/deployinator/controller.rb', line 28

def initialize(args)
  @deploy_start_time = Time.now.to_i
  @start_time = Time.now.to_i
  @username = args[:username]
  @groups = args[:groups]
  @host     = `hostname -s`
  @stack = args[:stack]
  @method = args[:method]
  @filename = "#{@deploy_start_time}-#{@username}-#{args[:method]}.html"
  @deploy_time = Time.now.to_i

  # This gets the runlog output on the console; is used by log_and_stream
  @block = args[:block] || Proc.new do |output|
    $stdout.write output.gsub!(/(<[^>]*>)|\n|\t/m) {" "}
    $stdout.write "\n"
  end
end

Instance Method Details

#get_deploy_timeObject



50
51
52
# File 'lib/deployinator/controller.rb', line 50

def get_deploy_time
  @deploy_time
end

#get_filenameObject



46
47
48
# File 'lib/deployinator/controller.rb', line 46

def get_filename
  @filename
end