Module: Asset

Extended by:
Asset
Included in:
Asset
Defined in:
lib/capistrano-db-tasks/asset.rb

Instance Method Summary collapse

Instance Method Details

#local_to_remote(cap) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/capistrano-db-tasks/asset.rb', line 12

def local_to_remote(cap)
  servers = cap.find_servers :roles => :app
  port = cap.port rescue 22
  [cap.assets_dir].flatten.each do |dir|
    system("rsync -a --del -L -K -vv --progress --rsh='ssh -p #{port}' ./#{dir} #{cap.user}@#{servers.first}:#{cap.current_path}/#{cap.local_assets_dir}")
  end
end

#remote_to_local(cap) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/capistrano-db-tasks/asset.rb', line 4

def remote_to_local(cap)
  servers = cap.find_servers :roles => :app
  port = cap.port rescue 22
  [cap.assets_dir].flatten.each do |dir|
    system("rsync -a --del -L -K -vv --progress --rsh='ssh -p #{port}' #{cap.user}@#{servers.first}:#{cap.current_path}/#{dir} #{cap.local_assets_dir}")
  end
end

#to_string(cap) ⇒ Object



20
21
22
# File 'lib/capistrano-db-tasks/asset.rb', line 20

def to_string(cap)
  [cap.assets_dir].flatten.join(" ")
end