Module: Closync

Defined in:
lib/closync.rb,
lib/closync/sync.rb,
lib/closync/config.rb,
lib/closync/storage.rb,
lib/closync/version.rb

Overview

The three supported object storage providers are Amazon S3, Google Coloud Storage, and Rackspace Cloudfiles.

In addition to loading configuration via yml file (see README.md), Closync can also be used programmatically:

require 'closync'

config = Closync::Config.new({
  credentials: {
    # aws_access_key_id:                  ENV['AWS_ACCESS_KEY_ID'],
    # aws_secret_access_key:              ENV['AWS_SECRET_ACCESS_KEY'],
    # google_storage_access_key_id:       ENV['GOOGLE_STORAGE_ACCESS_KEY_ID'],
    # google_storage_secret_access_key:   ENV['GOOGLE_STORAGE_SECRET_ACCESS_KEY'],
    rackspace_username:                 ENV['RACKSPACE_USERNAME'],
    rackspace_api_key:                  ENV['RACKSPACE_API_KEY']
  },
  working_dir: '/path/from/root', # defaults to Dir.pwd
  storage: {
    local: {
      provider:   'Local',
      directory:  'relative/path' # relative to working_dir
    },
    remote: {
      provider:   'Rackspace',    # || 'AWS' || 'Google'
      directory:  'bucket_name'
    }
  },
  cache_control: {
    'default'  => (60*60*24*365),
    '.html'    => (60*5),
    '.htm'     => (60*5)
  }
})

Closync::Sync.new(config).push!

Defined Under Namespace

Classes: Config, Storage, Sync

Constant Summary collapse

VERSION =
'0.1.2'

Class Method Summary collapse

Class Method Details

.configObject



49
50
51
52
# File 'lib/closync.rb', line 49

def config
  @config ||= Config.new
  @config
end

.config=(data) ⇒ Object



45
46
47
# File 'lib/closync.rb', line 45

def config=(data)
  @config = data
end

.configure {|@config| ... } ⇒ Object

Yields:



54
55
56
57
# File 'lib/closync.rb', line 54

def configure(&proc)
  @config ||= Config.new
  yield @config
end

.push!Object



59
60
61
# File 'lib/closync.rb', line 59

def push!
  Sync.new(config).push!
end