Sha256: af20e058ce0c04be7fa101dca0d789560eff89af616364df154e0404f2f5b336

Contents?: true

Size: 982 Bytes

Versions: 3

Compression:

Stored size: 982 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}/"
              Pushwagner.begin_info "Uploading files to #{host}:#{dest}"

              files.each do |f|
                if 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

3 entries across 3 versions & 1 rubygems

Version Path
pushwagner-0.0.1.12 lib/pushwagner/static.rb
pushwagner-0.0.1.11 lib/pushwagner/static.rb
pushwagner-0.0.1.10 lib/pushwagner/static.rb