Class: Dandelion::Deployer

Inherits:
Object
  • Object
show all
Defined in:
lib/dandelion/deployer.rb

Instance Method Summary collapse

Constructor Details

#initialize(adapter, options = {}) ⇒ Deployer

Returns a new instance of Deployer.



3
4
5
6
# File 'lib/dandelion/deployer.rb', line 3

def initialize(adapter, options = {})
  @adapter = adapter
  @options = options
end

Instance Method Details

#deploy_changeset!(changeset) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/dandelion/deployer.rb', line 8

def deploy_changeset!(changeset)
  changeset.each do |change|
    if exclude?(change.path)
      log.debug("Skipping file: #{change.path}")
    else
      deploy_change!(change)
    end
  end
end

#deploy_files!(files) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dandelion/deployer.rb', line 18

def deploy_files!(files)
  files.each do |path|
    local_path = remote_path = path

    if path.is_a?(Hash)
      local_path, remote_path = path.first
    end

    if File.directory?(local_path)
      paths = expand_paths(local_path, remote_path)
    else
      paths = [[local_path, remote_path]]
    end

    paths.each do |local_path, remote_path|
      deploy_file!(local_path, remote_path)
    end
  end
end