Sha256: a29dd62943fb42b4cc4f5d264b447422b3affa30eb99ccf5e347829ce5f56ee8

Contents?: true

Size: 970 Bytes

Versions: 1

Compression:

Stored size: 970 Bytes

Contents

require 'fileutils'

module CapistranoExtensions
  module Files
    module Local

      def tail_f(file, n=10)
        unless defined? File::Tail::Logfile then gem 'file-tail'; require 'file/tail' end
        File::Tail::Logfile.tail(file, :backward=>n) do |line| puts line end
      rescue Interrupt
        logger.trace "interrupted (Ctrl-C)" if logger
      end

      def upload(from, to)
        cp(from, to)
      end

      def download(from, to)
        cp(from, to)
      end


      include FileUtils::Verbose

      public *FileUtils::Verbose.methods(false)
      private *%w(copy_entry copy_file copy_stream
                  remove_entry remove_entry_secure remove_file
                  compare_file compare_stream
                  uptodate?)

      class_eval(%w(exists? directory? executable?).map do |m|
        "def #{m}(f) File.#{m}(f) end"
      end.join("\n"))

    end
  end
end

Capistrano.plugin :local_files, CapistranoExtensions::Files::Local

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
joekhoobyar-capistrano-extensions-0.0.1 lib/capistrano_extensions/files/local.rb