closync 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog.md +4 -0
- data/Gemfile +6 -1
- data/Guardfile +1 -1
- data/README.md +2 -0
- data/closync.gemspec +3 -3
- data/lib/closync/config.rb +8 -6
- data/lib/closync/storage.rb +5 -3
- data/lib/closync/version.rb +1 -1
- data/lib/closync.rb +37 -0
- data/spec/lib/closync/version_spec.rb +1 -1
- metadata +8 -7
data/Changelog.md
CHANGED
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# A sample Guardfile
|
2
2
|
# More info at https://github.com/guard/guard#readme
|
3
3
|
|
4
|
-
guard 'rspec'
|
4
|
+
guard 'rspec' do
|
5
5
|
watch(%r{^spec/.+_spec\.rb$})
|
6
6
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
7
|
watch('spec/spec_helper.rb') { "spec" }
|
data/README.md
CHANGED
data/closync.gemspec
CHANGED
@@ -6,9 +6,9 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["alexander@wenzowski.com"]
|
7
7
|
gem.summary = 'A tool for synchronizing cloud storage buckets.'
|
8
8
|
gem.description = <<-EOF
|
9
|
-
|
10
|
-
|
11
|
-
to interact with both local and remote storage.
|
9
|
+
A tool for deploying complete HTML Apps to S3-compatible object
|
10
|
+
storage. Cache-Control max-age headers are set based on file type.
|
11
|
+
Closync uses the fog gem to interact with both local and remote storage.
|
12
12
|
EOF
|
13
13
|
gem.homepage = "http://github.com/wenzowski/closync"
|
14
14
|
|
data/lib/closync/config.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Closync
|
2
2
|
class Config
|
3
3
|
|
4
|
+
attr_accessor :working_dir
|
5
|
+
|
4
6
|
# Fog config
|
5
7
|
attr_accessor :credentials
|
6
8
|
attr_accessor :storage
|
@@ -9,14 +11,14 @@ module Closync
|
|
9
11
|
# Git
|
10
12
|
attr_accessor :branch
|
11
13
|
|
12
|
-
|
13
14
|
def initialize(opts={})
|
14
|
-
self.credentials = {}
|
15
|
-
self.storage = {}
|
16
|
-
self.cache_control = {}
|
17
|
-
self.branch = []
|
15
|
+
self.credentials = ( opts[:credentials] || {} )
|
16
|
+
self.storage = ( opts[:storage] || {} )
|
17
|
+
self.cache_control = ( opts[:cache_control] || {} )
|
18
|
+
self.branch = ( opts[:branch] || [] )
|
19
|
+
self.working_dir = ( opts[:working_dir] || Dir.pwd)
|
18
20
|
|
19
|
-
@yml_path = ( opts[:yml_path] || "#{
|
21
|
+
@yml_path = ( opts[:yml_path] || "#{self.working_dir}/.closync.yml" )
|
20
22
|
|
21
23
|
if self.yml_exists?
|
22
24
|
load_yml!
|
data/lib/closync/storage.rb
CHANGED
@@ -4,15 +4,17 @@ module Closync
|
|
4
4
|
class Storage
|
5
5
|
attr_accessor :directory
|
6
6
|
|
7
|
+
##
|
7
8
|
# * config (<~object) Closync::Config
|
8
|
-
# *
|
9
|
+
# * bucket_config (<~hash) Options to initialize fog connection.
|
9
10
|
# * :provider (<~string): Options are ['Local', 'AWS', 'Google', 'Rackspace']
|
10
11
|
# * :directory (<~string) Bucket or local directory.
|
11
|
-
def initialize(config,
|
12
|
+
def initialize(config, bucket_config={})
|
13
|
+
opts = bucket_config.clone
|
12
14
|
dir = opts.delete(:directory)
|
13
15
|
case opts[:provider]
|
14
16
|
when 'Local'
|
15
|
-
opts[:local_root] =
|
17
|
+
opts[:local_root] = config.working_dir
|
16
18
|
@storage = Fog::Storage.new(opts)
|
17
19
|
when 'AWS'
|
18
20
|
opts[:aws_access_key_id] =
|
data/lib/closync/version.rb
CHANGED
data/lib/closync.rb
CHANGED
@@ -3,6 +3,43 @@ require 'closync/config'
|
|
3
3
|
require 'closync/storage'
|
4
4
|
require 'closync/sync'
|
5
5
|
|
6
|
+
##
|
7
|
+
# The three supported object storage providers are
|
8
|
+
# Amazon S3, Google Coloud Storage, and Rackspace Cloudfiles.
|
9
|
+
#
|
10
|
+
# In addition to loading configuration via yml file (see README.md), Closync
|
11
|
+
# can also be used programmatically:
|
12
|
+
#
|
13
|
+
# require 'closync'
|
14
|
+
#
|
15
|
+
# config = Closync::Config.new({
|
16
|
+
# credentials: {
|
17
|
+
# # aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
|
18
|
+
# # aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
|
19
|
+
# # google_storage_access_key_id: ENV['GOOGLE_STORAGE_ACCESS_KEY_ID'],
|
20
|
+
# # google_storage_secret_access_key: ENV['GOOGLE_STORAGE_SECRET_ACCESS_KEY'],
|
21
|
+
# rackspace_username: ENV['RACKSPACE_USERNAME'],
|
22
|
+
# rackspace_api_key: ENV['RACKSPACE_API_KEY']
|
23
|
+
# },
|
24
|
+
# working_dir: '/path/from/root', # defaults to Dir.pwd
|
25
|
+
# storage: {
|
26
|
+
# local: {
|
27
|
+
# provider: 'Local',
|
28
|
+
# directory: 'relative/path' # relative to working_dir
|
29
|
+
# },
|
30
|
+
# remote: {
|
31
|
+
# provider: 'Rackspace', # || 'AWS' || 'Google'
|
32
|
+
# directory: 'bucket_name'
|
33
|
+
# }
|
34
|
+
# },
|
35
|
+
# cache_control: {
|
36
|
+
# 'default' => (60*60*24*365),
|
37
|
+
# '.html' => (60*5),
|
38
|
+
# '.htm' => (60*5)
|
39
|
+
# }
|
40
|
+
# })
|
41
|
+
#
|
42
|
+
# Closync::Sync.new(config).push!
|
6
43
|
module Closync
|
7
44
|
class << self
|
8
45
|
def config=(data)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: closync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -27,9 +27,9 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
description: ! "
|
31
|
-
\
|
32
|
-
with both local and remote storage.\n"
|
30
|
+
description: ! " A tool for deploying complete HTML Apps to S3-compatible object\n
|
31
|
+
\ storage. Cache-Control max-age headers are set based on file type.\n Closync
|
32
|
+
uses the fog gem to interact with both local and remote storage.\n"
|
33
33
|
email:
|
34
34
|
- alexander@wenzowski.com
|
35
35
|
executables: []
|
@@ -72,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
72
|
version: '0'
|
73
73
|
segments:
|
74
74
|
- 0
|
75
|
-
hash:
|
75
|
+
hash: 1824680898520444066
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
77
|
none: false
|
78
78
|
requirements:
|
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
segments:
|
83
83
|
- 0
|
84
|
-
hash:
|
84
|
+
hash: 1824680898520444066
|
85
85
|
requirements: []
|
86
86
|
rubyforge_project:
|
87
87
|
rubygems_version: 1.8.24
|
@@ -96,3 +96,4 @@ test_files:
|
|
96
96
|
- spec/lib/closync_spec.rb
|
97
97
|
- spec/spec_helper.rb
|
98
98
|
- spec/support/closync.yml
|
99
|
+
has_rdoc:
|