Sha256: dd6eb740289b761595e4b417e1bfbeb307dab53e782c1aaafd86c63234446227

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

module Rsh
  module Drivers
    class Local < Abstract    
      def upload_file from_local_path, to_remote_path
        FileUtils.copy from_local_path, to_remote_path
      end
    
      def download_file from_remote_path, to_local_path
        FileUtils.copy from_remote_path, to_local_path
      end
    
      def exist? remote_file_path
        File.exist? remote_file_path
      end
    
      alias_method :directory_exist?, :exist?
      alias_method :file_exist?, :exist?
    
      def remove_file remote_file_path
        File.delete remote_file_path
      end    
    
      def create_directory path
        Dir.mkdir path
      end
    
      def remove_directory path
        FileUtils.rm_r path
      end
      
      def upload_directory from_local_path, to_remote_path
        FileUtils.cp_r from_local_path, to_remote_path
      end
      
      def download_directory from_remote_path, to_local_path
        FileUtils.cp_r from_remote_path, to_local_path
      end
    
      def exec command        
        code, stdout, stderr = Open3.popen3 command do |stdin, stdout, stderr, waitth|  
          [waitth.value.to_i, stdout.read, stderr.read]
        end
      
        return code, stdout, stderr
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
vos-0.0.4 lib/rsh/drivers/local.rb
vfs-0.0.4 lib/rsh/drivers/local.rb