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 =
"4.0.3"
- @@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
58 59 60 |
# File 'lib/middleman/s3_sync.rb', line 58 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
48 49 50 51 52 53 54 55 56 |
# File 'lib/middleman/s3_sync.rb', line 48 def bucket @@bucket_lock.synchronize do @bucket ||= begin bucket = connection.directories.get(.bucket, :prefix => .prefix) raise "Bucket #{.bucket} doesn't exist!" unless bucket bucket end end end |
.content_types ⇒ Object
70 71 72 |
# File 'lib/middleman/s3_sync.rb', line 70 def content_types @content_types || {} end |
.remote_only_paths ⇒ Object
62 63 64 |
# File 'lib/middleman/s3_sync.rb', line 62 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 |
# File 'lib/middleman/s3_sync.rb', line 27 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 |