class Squarespace::Sync::Cli

Public Class Methods

source_root() click to toggle source
# File lib/squarespace/sync/cli.rb, line 50
def self.source_root
  File.dirname(__FILE__)
end

Public Instance Methods

pull(file=nil) click to toggle source
# File lib/squarespace/sync/cli.rb, line 39
def pull(file=nil)
  Connection.new do |sftp, options, instance|
    if file
      local_file = File.join(Squarespace::Sync.local_path, file)
      instance.pull_file( sftp, File.join(options[:directory], file), local_file )
    else
      instance.pull_tree( sftp, options[:directory] )
    end
  end
end
push(file=nil) click to toggle source
# File lib/squarespace/sync/cli.rb, line 27
def push(file=nil)
  Connection.new do |sftp, options, instance|
    if file
      local_file = File.join(Squarespace::Sync.local_path, file)
      instance.push_file( sftp, local_file, File.join(options[:directory], file) )
    else
      instance.push_tree( sftp, options[:directory] )
    end
  end
end
setup() click to toggle source
# File lib/squarespace/sync/cli.rb, line 12
def setup
  output_file = File.join(Squarespace::Sync.local_path, "squarespace.yaml")
  template_file = "squarespace.tt"
  options = {
    host: "dev.squarespace.com",
    username: "you@example.com",
    password: "\"\"",
    directory: "your-site",
    port: 2030,
    ignore: %w{.gitignore Gemfile Gemfile.lock}
  }
  template( template_file, output_file, options )
end
version() click to toggle source
# File lib/squarespace/sync/cli.rb, line 7
def version
  say Squarespace::Sync::VERSION
end