Sha256: 0aabdc1310bb7ec89b4613d41c1028e9996618d854dbf90123dd54510d7df528

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

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}/"
              puts "Uploading files to #{host}:#{dest}/"
              files.each do |f|
                if File.exists?(f)
                  scp.upload!(f, dest, :recursive => File.directory?(f))
                else
                  puts "Warning: File #{f} does not exist"
                end
              end
            end
          end
        end
      end
      # EOC
    end
    # EOM
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pushwagner-0.0.1.8 lib/pushwagner/static.rb
pushwagner-0.0.1.7 lib/pushwagner/static.rb