Sha256: 2ec5d4f30859f1babfc7e8b10d0eb8544f74c18529a2b4828216cbd560dae509
Contents?: true
Size: 1.3 KB
Versions: 7
Compression:
Stored size: 1.3 KB
Contents
require 'net/ssh' require 'net/scp' module Pushwagner module Static class Deployer attr_reader :environment def initialize(environment, opts = {}) @environment = environment end def deploy environment.static.each do |name, files| environment.hosts.each do |host| Net::SCP.start(host, environment.user) do |scp| dest = name.start_with?('/') ? name : "#{environment.path_prefix}/#{name}/" Pushwagner.begin_info "Uploading files to #{host}:#{dest}" files.each do |f| # Define globbing for strings containing an asterisk: '*' if f.include?('*') puts Dir.glob(f).each do |g| puts "Uploading #{g} #{'(dir)' if File.directory?(g)} to #{dest}" scp.upload!(g, dest, recursive: File.directory?(g)) end elsif File.exists?(f) scp.upload!(f, dest, recursive: File.directory?(f)) else puts Pushwagner.warning "Local file #{f} does not exist" puts end end Pushwagner.ok end end end end # EOC end # EOM end end
Version data entries
7 entries across 7 versions & 1 rubygems