Class: Nanoc::Deploying::Deployers::Fog Private
- Inherits:
-
Nanoc::Deploying::Deployer
- Object
- Nanoc::Deploying::Deployer
- Nanoc::Deploying::Deployers::Fog
- Defined in:
- lib/nanoc/deploying/deployers/fog.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A deployer that deploys a site using [fog](github.com/fog/fog).
Defined Under Namespace
Classes: FogWrapper
Instance Attribute Summary
Attributes inherited from Nanoc::Deploying::Deployer
#config, #dry_run, #source_path
Instance Method Summary collapse
- #run ⇒ Object private
Methods inherited from Nanoc::Deploying::Deployer
Constructor Details
This class inherits a constructor from Nanoc::Deploying::Deployer
Instance Method Details
#run ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/nanoc/deploying/deployers/fog.rb', line 86 def run require 'fog/core' src = File.(source_path) bucket = config[:bucket] || config[:bucket_name] path = config[:path] cdn_id = config[:cdn_id] if path&.end_with?('/') raise "The path `#{path}` is not supposed to have a trailing slash" end connection = connect directory = get_or_create_bucket(connection, bucket, path) wrapper = FogWrapper.new(directory, dry_run?) remote_files = list_remote_files(directory) = (remote_files) modified_keys, retained_keys = upload_all(src, path, , wrapper) removed_keys = remote_files.map(&:key) - retained_keys - modified_keys wrapper.remove(removed_keys) if cdn_id cdn = ::Fog::CDN.new(config_for_fog) distribution = cdn.get_distribution(cdn_id) wrapper.invalidate(modified_keys + removed_keys, cdn, distribution) end end |