middleman-s3_sync 3.0.42 → 3.0.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -0
- data/README.md +1 -1
- data/lib/middleman/s3_sync.rb +23 -13
- data/lib/middleman/s3_sync/version.rb +1 -1
- data/middleman-s3_sync.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec063de98b5edc03b6fee93905f98ff7369db7ec
|
4
|
+
data.tar.gz: 53b08ef2bbe4e17dec2f5166417e33747d525108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d550c40f73ed73b13f238ab93b3bd66c3aab1f1df6b0a02c9fb32aa8716c03098b1a0d421381742fa62541641cec5d76144d8af0500191b14525f3d31998fbde
|
7
|
+
data.tar.gz: b453c3dbbf7405a0e062adf09a5ca73c57cefc3f5104d74b700b653afc23612591d64c7fe3410913186958f23f35a00103aa8bf22622370c8b60f62ae0e00db0
|
data/.travis.yml
CHANGED
@@ -6,6 +6,14 @@ rvm:
|
|
6
6
|
- 2.1.5
|
7
7
|
- 2.2.1
|
8
8
|
|
9
|
+
notifications:
|
10
|
+
webhooks:
|
11
|
+
urls:
|
12
|
+
- https://webhooks.gitter.im/e/e47a30963be3bcbe2df9
|
13
|
+
on_success: change # options: [always|never|change] default: always
|
14
|
+
on_failure: always # options: [always|never|change] default: always
|
15
|
+
on_start: false # default: false
|
16
|
+
|
9
17
|
env:
|
10
18
|
global:
|
11
19
|
- secure: ! 'dQ/vYDmUZEW9LD8IyTRFoRFo24w2yJTYQHuAS24vfKToDZ0BO2/Tpq5lh0vb
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Middleman::S3Sync
|
2
2
|
|
3
|
-
[![Code Climate](https://codeclimate.com/github/fredjean/middleman-s3_sync.png)](https://codeclimate.com/github/fredjean/middleman-s3_sync) [![Build Status](https://travis-ci.org/fredjean/middleman-s3_sync.png?branch=master)](https://travis-ci.org/fredjean/middleman-s3_sync)
|
3
|
+
[![Join the chat at https://gitter.im/fredjean/middleman-s3_sync](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/fredjean/middleman-s3_sync?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Code Climate](https://codeclimate.com/github/fredjean/middleman-s3_sync.png)](https://codeclimate.com/github/fredjean/middleman-s3_sync) [![Build Status](https://travis-ci.org/fredjean/middleman-s3_sync.png?branch=master)](https://travis-ci.org/fredjean/middleman-s3_sync)
|
4
4
|
|
5
5
|
This gem determines which files need to be added, updated and optionally deleted
|
6
6
|
and only transfer these files up. This reduces the impact of an update
|
data/lib/middleman/s3_sync.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'fog'
|
1
|
+
require 'fog/aws/storage'
|
2
2
|
require 'pmap'
|
3
3
|
require 'digest/md5'
|
4
4
|
require 'middleman/s3_sync/version'
|
@@ -8,11 +8,14 @@ require 'middleman/s3_sync/status'
|
|
8
8
|
require 'middleman/s3_sync/resource'
|
9
9
|
require 'middleman-s3_sync/extension'
|
10
10
|
require 'ruby-progressbar'
|
11
|
+
require 'thread'
|
11
12
|
|
12
13
|
module Middleman
|
13
14
|
module S3Sync
|
14
15
|
class << self
|
15
16
|
include Status
|
17
|
+
@@bucket_lock = Mutex.new
|
18
|
+
@@bucket_files_lock = Mutex.new
|
16
19
|
|
17
20
|
def sync(options)
|
18
21
|
@app = ::Middleman::Application.server.inst
|
@@ -40,11 +43,13 @@ module Middleman
|
|
40
43
|
end
|
41
44
|
|
42
45
|
def bucket
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
46
|
+
@@bucket_lock.synchronize do
|
47
|
+
@bucket ||= begin
|
48
|
+
bucket = connection.directories.get(s3_sync_options.bucket, :prefix => s3_sync_options.prefix)
|
49
|
+
raise "Bucket #{s3_sync_options.bucket} doesn't exist!" unless bucket
|
50
|
+
bucket
|
51
|
+
end
|
52
|
+
end
|
48
53
|
end
|
49
54
|
|
50
55
|
protected
|
@@ -53,8 +58,7 @@ module Middleman
|
|
53
58
|
end
|
54
59
|
|
55
60
|
def connection
|
56
|
-
@connection ||= Fog::Storage.new({
|
57
|
-
:provider => 'AWS',
|
61
|
+
@connection ||= Fog::Storage::AWS.new({
|
58
62
|
:aws_access_key_id => s3_sync_options.aws_access_key_id,
|
59
63
|
:aws_secret_access_key => s3_sync_options.aws_secret_access_key,
|
60
64
|
:region => s3_sync_options.region,
|
@@ -94,15 +98,21 @@ module Middleman
|
|
94
98
|
end
|
95
99
|
|
96
100
|
def remote_paths
|
97
|
-
@remote_paths ||=
|
101
|
+
@remote_paths ||= if s3_sync_options.delete
|
102
|
+
bucket_files.map(&:key)
|
103
|
+
else
|
104
|
+
[]
|
105
|
+
end
|
98
106
|
end
|
99
107
|
|
100
108
|
def bucket_files
|
101
|
-
|
102
|
-
|
103
|
-
files
|
109
|
+
@@bucket_files_lock.synchronize do
|
110
|
+
@bucket_files ||= [].tap { |files|
|
111
|
+
bucket.files.each { |f|
|
112
|
+
files << f
|
113
|
+
}
|
104
114
|
}
|
105
|
-
|
115
|
+
end
|
106
116
|
end
|
107
117
|
|
108
118
|
def create_resources
|
data/middleman-s3_sync.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_runtime_dependency 'middleman-core', '>= 3.0.0'
|
22
22
|
gem.add_runtime_dependency 'unf'
|
23
|
-
gem.add_runtime_dependency 'fog', '>= 1.
|
23
|
+
gem.add_runtime_dependency 'fog-aws', '>= 0.1.1'
|
24
24
|
gem.add_runtime_dependency 'map'
|
25
25
|
gem.add_runtime_dependency 'pmap'
|
26
26
|
gem.add_runtime_dependency 'ruby-progressbar'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-s3_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederic Jean
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-03-
|
12
|
+
date: 2015-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|
@@ -40,19 +40,19 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name: fog
|
43
|
+
name: fog-aws
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.
|
48
|
+
version: 0.1.1
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
55
|
+
version: 0.1.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: map
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|