Sha256: 22580fc727abf52505678271221b25e61668ce4d8c7f948bd1de9dd8157d16d4

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

module Pave
  class Files
    include Pave::Shell

    def self.exclusions
      " --exclude 'files/tmp' --exclude 'files/cache' "
    end

    def self.flags
      " -uazh ssh --progress "
    end

    def self.clear_cache
      sh "rm -rf ./files/tmp/*; rm -rf ./files/cache/*;"
    end

    def self.push(remote="live")
      server = Pave::Remote.server(remote)
      directory = Pave::Remote.directory(remote)
      sh "rsync #{flags} #{exclusions} ./files #{server}:#{directory}/files"
    end

    def self.pull(remote="live")
      server = Pave::Remote.server(remote)
      directory = Pave::Remote.directory(remote)
      sh "rsync #{flags} #{exclusions} #{server}:#{directory}/files ./files"
      clear_cache
    end

    def self.sync(remote="live")
      pull(remote)
      push(remote)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pave-0.12.0.rc1 lib/pave/files.rb