Class: Nanoc::Extra::Deployers::Fog Private
- Inherits:
-
Nanoc::Extra::Deployer
- Object
- Nanoc::Extra::Deployer
- Nanoc::Extra::Deployers::Fog
- Defined in:
- lib/nanoc/extra/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/geemus/fog).
Defined Under Namespace
Classes: FogWrapper
Instance Attribute Summary
Attributes inherited from Nanoc::Extra::Deployer
#config, #dry_run, #source_path
Instance Method Summary collapse
- #run ⇒ Object private
Methods inherited from Nanoc::Extra::Deployer
Methods included from Int::PluginRegistry::PluginMethods
#all, #identifier, #identifiers, #named, #register
Constructor Details
This class inherits a constructor from Nanoc::Extra::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.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/nanoc/extra/deployers/fog.rb', line 79 def run require 'fog' src = File.(source_path) bucket = config[:bucket] || config[:bucket_name] path = config[:path] cdn_id = config[:cdn_id] # FIXME: confusing error message raise 'The path requires no trailing slash' if path && path[-1, 1] == '/' 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 |