Class: Deploy::Deployer
- Inherits:
-
Object
- Object
- Deploy::Deployer
- Includes:
- FileUtils
- Defined in:
- lib/deploy/deployer.rb
Constant Summary collapse
- DEPLOYED_DIR =
File.("~/.vendingmachine/control")
- PIDFILE =
File.("~/.vendingmachine/pid")
Instance Attribute Summary collapse
-
#current_pid ⇒ Object
readonly
Returns the value of attribute current_pid.
-
#executable ⇒ Object
readonly
Returns the value of attribute executable.
Instance Method Summary collapse
- #deploy(file_path) ⇒ Object
-
#initialize(executable) ⇒ Deployer
constructor
A new instance of Deployer.
- #kill ⇒ Object
- #run_log ⇒ Object
- #wait_for ⇒ Object
Constructor Details
#initialize(executable) ⇒ Deployer
Returns a new instance of Deployer.
14 15 16 17 18 |
# File 'lib/deploy/deployer.rb', line 14 def initialize(executable) @executable = executable @log = "" $: << DEPLOYED_DIR unless $:.include?(DEPLOYED_DIR) end |
Instance Attribute Details
#current_pid ⇒ Object (readonly)
Returns the value of attribute current_pid.
12 13 14 |
# File 'lib/deploy/deployer.rb', line 12 def current_pid @current_pid end |
#executable ⇒ Object (readonly)
Returns the value of attribute executable.
12 13 14 |
# File 'lib/deploy/deployer.rb', line 12 def executable @executable end |
Instance Method Details
#deploy(file_path) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/deploy/deployer.rb', line 24 def deploy(file_path) create_deployment_environment read_current_pid kill_running_process install_deployed_code(file_path) start_deployed_code end |
#kill ⇒ Object
32 33 34 35 36 |
# File 'lib/deploy/deployer.rb', line 32 def kill read_current_pid kill_running_process clear_current_pid end |
#run_log ⇒ Object
20 21 22 |
# File 'lib/deploy/deployer.rb', line 20 def run_log @log end |
#wait_for ⇒ Object
38 39 40 41 42 |
# File 'lib/deploy/deployer.rb', line 38 def wait_for Process.wait(read_current_pid) clear_current_pid self end |