closync 0.0.1 → 0.0.2
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/README.md +4 -4
- data/lib/closync/config.rb +6 -6
- data/lib/closync/sync.rb +10 -10
- data/lib/closync/version.rb +1 -1
- data/spec/lib/closync/version_spec.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -24,16 +24,16 @@ destination to perform a one-way synchronization.
|
|
24
24
|
**.closync.yml**
|
25
25
|
|
26
26
|
credentials:
|
27
|
-
google_storage_access_key_id: ENV['GOOGLE_STORAGE_ACCESS_KEY_ID']
|
28
|
-
google_storage_secret_access_key: ENV['GOOGLE_STORAGE_SECRET_ACCESS_KEY']
|
27
|
+
google_storage_access_key_id: <%= ENV['GOOGLE_STORAGE_ACCESS_KEY_ID'] %>
|
28
|
+
google_storage_secret_access_key: <%= ENV['GOOGLE_STORAGE_SECRET_ACCESS_KEY'] %>
|
29
29
|
storage:
|
30
30
|
local:
|
31
31
|
provider: 'Local'
|
32
|
-
directory: '
|
32
|
+
directory: 'relative/path'
|
33
33
|
remote:
|
34
34
|
provider: 'Google'
|
35
35
|
directory: 'bucket_name'
|
36
|
-
|
36
|
+
cache_control:
|
37
37
|
300:
|
38
38
|
- .htm
|
39
39
|
- .html
|
data/lib/closync/config.rb
CHANGED
@@ -88,7 +88,7 @@ module Closync
|
|
88
88
|
self.credentials = {}
|
89
89
|
@yml['credentials'].each do |key, val|
|
90
90
|
self.credentials[key.to_sym] = val
|
91
|
-
end
|
91
|
+
end if @yml['credentials']
|
92
92
|
end
|
93
93
|
|
94
94
|
def set_storage!
|
@@ -97,23 +97,23 @@ module Closync
|
|
97
97
|
self.storage[remote.to_sym] = {}
|
98
98
|
config.each do |key, val|
|
99
99
|
self.storage[remote.to_sym][key.to_sym] = val
|
100
|
-
end
|
101
|
-
end
|
100
|
+
end if config
|
101
|
+
end if @yml['storage']
|
102
102
|
end
|
103
103
|
|
104
104
|
def set_cache_control!
|
105
105
|
@yml['cache_control'].each do |max_age, extensions|
|
106
106
|
extensions.each do |extension|
|
107
107
|
set_max_age!(extension, max_age)
|
108
|
-
end
|
109
|
-
end
|
108
|
+
end if extensions
|
109
|
+
end if @yml['cache_control']
|
110
110
|
end
|
111
111
|
|
112
112
|
def set_branch!
|
113
113
|
self.branch = []
|
114
114
|
@yml['branch'].each do |branch|
|
115
115
|
self.branch << branch
|
116
|
-
end
|
116
|
+
end if @yml['branch']
|
117
117
|
end
|
118
118
|
|
119
119
|
end
|
data/lib/closync/sync.rb
CHANGED
@@ -31,16 +31,16 @@ module Closync
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def upload?(file)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
34
|
+
# TODO(wenzowski): check if file already exists
|
35
|
+
#
|
36
|
+
# upload = false
|
37
|
+
# if ( remote_file = @remote.directory.files.head(file.key) )
|
38
|
+
# # TODO(wenzowski): check etag to see if file has changed
|
39
|
+
# else
|
40
|
+
# upload = true
|
41
|
+
# end
|
42
|
+
# upload
|
43
|
+
true
|
44
44
|
end
|
45
45
|
|
46
46
|
# If file already exists on remote it will be overwritten.
|
data/lib/closync/version.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -71,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
71
|
version: '0'
|
72
72
|
segments:
|
73
73
|
- 0
|
74
|
-
hash:
|
74
|
+
hash: -569674058433925932
|
75
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
76
|
none: false
|
77
77
|
requirements:
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
segments:
|
82
82
|
- 0
|
83
|
-
hash:
|
83
|
+
hash: -569674058433925932
|
84
84
|
requirements: []
|
85
85
|
rubyforge_project:
|
86
86
|
rubygems_version: 1.8.24
|