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
- VERSION =
"3.3.5"- @@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 end |
Class Method Details
.add_local_resource(mm_resource) ⇒ Object
61 62 63 |
# File 'lib/middleman/s3_sync.rb', line 61 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
51 52 53 54 55 56 57 58 59 |
# File 'lib/middleman/s3_sync.rb', line 51 def bucket @@bucket_lock.synchronize do @bucket ||= begin bucket = connection.directories.get(.bucket, :prefix => .prefix) raise "Bucket #{s3_sync_options.bucket} doesn't exist!" unless bucket bucket end end end |
.content_types ⇒ Object
74 75 76 |
# File 'lib/middleman/s3_sync.rb', line 74 def content_types @content_types || {} end |
.remote_only_paths ⇒ Object
65 66 67 |
# File 'lib/middleman/s3_sync.rb', line 65 def remote_only_paths paths - s3_sync_resources.keys end |
.sync ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/middleman/s3_sync.rb', line 27 def sync() 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 #{s3_sync_options.bucket}." update_bucket_versioning update_bucket_website ignore_resources create_resources update_resources delete_resources app.run_hook :after_s3_sync, ignored: files_to_ignore.map(&:path), created: files_to_create.map(&:path), updated: files_to_update.map(&:path), deleted: files_to_delete.map(&:path) end |