Sha256: a235afa1ca7adea7c1807fa924b92690b21d2928770ee6f27ecddc949b313b8b

Contents?: true

Size: 809 Bytes

Versions: 9

Compression:

Stored size: 809 Bytes

Contents

module Pave
  class Files
    include Pave::Shell

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

    def self.push(remote="live")
      clear_cache
      server = Pave::Remote.server(remote)
      directory = Pave::Remote.directory(remote)
      sh "scp -r ./files #{server}:#{directory}/local_files;"
      sh "ssh #{server} 'cd #{directory};
          mv ./files ./old_files;
          mv ./local_files ./files && rm -rf ./old_files;'"
    end

    def self.pull(remote="live")
      server = Pave::Remote.server(remote)
      directory = Pave::Remote.directory(remote)
      sh "scp -r #{server}:#{directory}/files ./remote_files;
          mv ./files ./old_files;
          mv ./remote_files ./files && rm -rf ./old_files;"
      clear_cache
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pave-0.14.0 lib/pave/files.rb
pave-0.13.0 lib/pave/files.rb
pave-0.12.0 lib/pave/files.rb
pave-0.11.2 lib/pave/files.rb
pave-0.11.1 lib/pave/files.rb
pave-0.11.0 lib/pave/files.rb
pave-0.10.1 lib/pave/files.rb
pave-0.10.0 lib/pave/files.rb
pave-0.9.0 lib/pave/files.rb