Class: Vagabund::Settler::Sources::Local

Inherits:
Object
  • Object
show all
Defined in:
lib/vagabund/settler/sources/local.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#originObject (readonly)

Returns the value of attribute origin.



5
6
7
# File 'lib/vagabund/settler/sources/local.rb', line 5

def origin
  @origin
end

Instance Method Details

#upload(machine, target_path) ⇒ Object Also known as: pull



7
8
9
10
11
12
13
14
15
16
# File 'lib/vagabund/settler/sources/local.rb', line 7

def upload(machine, target_path)
  machine.ui.detail "Uploading #{origin} to #{target_path}..."
  unless machine.communicate.test "[ -d #{File.dirname(target_path)} ]"
    machine.communicate.sudo "mkdir -p #{File.dirname(target_path)}"
    machine.communicate.sudo "chown -R #{machine.ssh_info[:username]} #{File.dirname(target_path)}"
    machine.communicate.sudo "chgrp -R #{machine.ssh_info[:username]} #{File.dirname(target_path)}"
  end
  machine.communicate.upload origin, target_path
  target_path
end