Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Philip Dorrell
56 lines (40 sloc) 1.655 kb
require 'based'
require 'synqa'
require 'digest/sha2'
STDOUT.sync = true
include Synqa
BASE_DIR = File.dirname(__FILE__)
SRC_DIR = File.join(BASE_DIR, "src")
UPLOAD_DIR = Based::BaseDirectory.new(SRC_DIR,
:fileExclude => lambda{|file| file.name.end_with?("~")})
SYNQA_DIR = File.join(BASE_DIR, "output", "synqa")
task :default => [:uploaddry] do |t|
end
REMOTE_HOST = SshContentHost.new("yourusername@yourhostname.example.com",
Sha256Command.new())
REMOTE_SITE = RemoteContentLocation.new(REMOTE_HOST,
"/home/username/public",
File.join(SYNQA_DIR, "nearlyContent.txt"))
LOCAL_SITE = LocalContentLocation.new(UPLOAD_DIR,
Digest::SHA256,
File.join(SYNQA_DIR, "localContent.txt"))
# Ensure that directory for cached content files exists
task :init do |t|
ensureDirectoryExists(SYNQA_DIR)
end
# Delete the cached content files
task :clean => [:init] do |t|
SyncOperation.new(LOCAL_SITE, REMOTE_SITE).clearCachedContentFiles()
end
# List the files and directories in the remote directory
task :list do |t|
REMOTE_SITE.listFiles()
end
# Dry run for uploading (i.e. syncing) files to remote site
task :uploaddry => [:init] do |t|
SyncOperation.new(LOCAL_SITE, REMOTE_SITE).doSync(:dryRun => true)
end
# Upload (i.e. sync) files to remote site
task :upload => [:init] do |t|
SyncOperation.new(LOCAL_SITE, REMOTE_SITE).doSync()
end
Jump to Line
Something went wrong with that request. Please try again.