lib/nanoc/extra/deployers/fog.rb in nanoc-3.6.7 vs lib/nanoc/extra/deployers/fog.rb in nanoc-3.6.8
- old
+ new
@@ -22,30 +22,30 @@
# @see Nanoc::Extra::Deployer#run
def run
require 'fog'
# Get params, unsetting anything we don't want to pass through to fog.
- src = File.expand_path(self.source_path)
- bucket = self.config.delete(:bucket) || self.config.delete(:bucket_name)
- path = self.config.delete(:path)
+ src = File.expand_path(source_path)
+ bucket = config.delete(:bucket) || config.delete(:bucket_name)
+ path = config.delete(:path)
- self.config.delete(:kind)
+ config.delete(:kind)
# Validate params
- error 'The path requires no trailing slash' if path && path[-1,1] == '/'
+ error 'The path requires no trailing slash' if path && path[-1, 1] == '/'
# Mock if necessary
if self.dry_run?
::Fog.mock!
end
# Get connection
- puts "Connecting"
- connection = ::Fog::Storage.new(self.config)
+ puts 'Connecting'
+ connection = ::Fog::Storage.new(config)
# Get bucket
- puts "Getting bucket"
+ puts 'Getting bucket'
begin
directory = connection.directories.get(bucket, :prefix => path)
rescue ::Excon::Errors::NotFound
should_create_bucket = true
end
@@ -62,14 +62,14 @@
while truncated
set = directory.files.all(:marker => files.last.key)
truncated = set.is_truncated
files = files + set
end
- keys_to_destroy = files.all.map {|file| file.key}
+ keys_to_destroy = files.all.map { |file| file.key }
# Upload all the files in the output folder to the clouds
- puts "Uploading local files"
+ puts 'Uploading local files'
FileUtils.cd(src) do
files = Dir['**/*'].select { |f| File.file?(f) }
files.each do |file_path|
key = path ? File.join(path, file_path) : file_path
directory.files.create(
@@ -79,15 +79,15 @@
keys_to_destroy.delete(key)
end
end
# delete extraneous remote files
- puts "Removing remote files"
+ puts 'Removing remote files'
keys_to_destroy.each do |key|
directory.files.get(key).destroy
end
- puts "Done!"
+ puts 'Done!'
end
private
# Prints the given message on stderr and exits.