Class: Bard::DeployStrategy::SSH

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

Instance Method Summary collapse

Instance Method Details

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



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

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

  if clone
    target.run! "git clone --branch #{branch} 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
    target.run! "git pull --ff-only origin #{branch}"
  end

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