Class: Bard::DeployStrategy::SSH

Inherits:
Bard::DeployStrategy show all
Defined in:
lib/bard/plugins/deploy/ssh_strategy.rb

Instance Attribute Summary

Attributes inherited from Bard::DeployStrategy

#target

Instance Method Summary collapse

Methods inherited from Bard::DeployStrategy

[], inherited, #initialize, #run, #run!, #system!

Constructor Details

This class inherits a constructor from Bard::DeployStrategy

Instance Method Details

#deploy(clone: nil, branch: nil, force: false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bard/plugins/deploy/ssh_strategy.rb', line 8

def deploy(clone: nil, branch: nil, force: false)
  target.require_capability!(:ssh)

  if clone
    target.run! "git clone git@github.com:botandrosedesign/#{clone} #{target.path}", home: true
    Bard::Copy.file "config/master.key", from: target.config[:local], to: target
  elsif force
    target.run! "git fetch origin #{branch}"
    target.run! "git checkout -f origin/#{branch}"
  else
    branch ||= target.instance_variable_get(:@branch) || "master"
    target.run! "git pull --ff-only origin #{branch}"
  end

  target.run! "bin/setup"
  target.run! "bard setup" if clone
end