Module: Middleman::S3Sync
- Extended by:
- CachingPolicy, Status
- Defined in:
- lib/middleman/s3_sync.rb,
lib/middleman/s3_sync/status.rb,
lib/middleman/s3_sync/options.rb,
lib/middleman/s3_sync/version.rb,
lib/middleman/s3_sync/resource.rb,
lib/middleman/s3_sync/caching_policy.rb
Defined Under Namespace
Modules: CachingPolicy, Status Classes: BrowserCachePolicy, Options, Resource
Constant Summary collapse
- THREADS_COUNT =
8
- VERSION =
"4.5.0"
- @@bucket_lock =
Mutex.new
- @@bucket_files_lock =
Mutex.new
Class Attribute Summary collapse
-
.app ⇒ Object
Returns the value of attribute app.
-
.mm_resources ⇒ Object
Returns the value of attribute mm_resources.
-
.s3_sync_options ⇒ Object
Returns the value of attribute s3_sync_options.
Class Method Summary collapse
- .add_local_resource(mm_resource) ⇒ Object
- .bucket ⇒ Object
- .content_types ⇒ Object
- .remote_only_paths ⇒ Object
- .sync ⇒ Object
Methods included from CachingPolicy
add_caching_policy, caching_policies, caching_policy_for, default_caching_policy
Methods included from Status
Class Attribute Details
.app ⇒ Object
Returns the value of attribute app.
25 26 27 |
# File 'lib/middleman/s3_sync.rb', line 25 def app @app end |
.mm_resources ⇒ Object
Returns the value of attribute mm_resources.
24 25 26 |
# File 'lib/middleman/s3_sync.rb', line 24 def mm_resources @mm_resources end |
.s3_sync_options ⇒ Object
Returns the value of attribute s3_sync_options.
23 24 25 |
# File 'lib/middleman/s3_sync.rb', line 23 def @s3_sync_options end |
Class Method Details
.add_local_resource(mm_resource) ⇒ Object
60 61 62 |
# File 'lib/middleman/s3_sync.rb', line 60 def add_local_resource(mm_resource) s3_sync_resources[mm_resource.destination_path] = S3Sync::Resource.new(mm_resource, remote_resource_for_path(mm_resource.destination_path)).tap(&:status) end |
.bucket ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/middleman/s3_sync.rb', line 50 def bucket @@bucket_lock.synchronize do @bucket ||= begin bucket = s3_resource.bucket(.bucket) raise "Bucket #{.bucket} doesn't exist!" unless bucket.exists? bucket end end end |
.content_types ⇒ Object
72 73 74 |
# File 'lib/middleman/s3_sync.rb', line 72 def content_types @content_types || {} end |
.remote_only_paths ⇒ Object
64 65 66 |
# File 'lib/middleman/s3_sync.rb', line 64 def remote_only_paths paths - s3_sync_resources.keys end |
.sync ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/middleman/s3_sync.rb', line 29 def sync() @app ||= ::Middleman::Application.new say_status "Let's see if there's work to be done..." unless work_to_be_done? say_status "All S3 files are up to date." return end say_status "Ready to apply updates to #{.bucket}." update_bucket_versioning update_bucket_website ignore_resources create_resources update_resources delete_resources end |