Sha256: 4207f901ded5043608af94bf94c62d985a7d25afc63bfc09c38ddf8bcde88842

Contents?: true

Size: 849 Bytes

Versions: 7

Compression:

Stored size: 849 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|
              puts "Uploading files to #{host}:#{environment.path_prefix}/#{name}/"
              files.each do |f|
                if File.exists?(f)
                  scp.upload!(f, "#{environment.path_prefix}/#{name}/", :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

7 entries across 7 versions & 1 rubygems

Version Path
pushwagner-0.0.1.6 lib/pushwagner/static.rb
pushwagner-0.0.1.5 lib/pushwagner/static.rb
pushwagner-0.0.1.4 lib/pushwagner/static.rb
pushwagner-0.0.1.3 lib/pushwagner/static.rb
pushwagner-0.0.1.2 lib/pushwagner/static.rb
pushwagner-0.0.1.1 lib/pushwagner/static.rb
pushwagner-0.0.1 lib/pushwagner/static.rb