Sha256: f490805c4e814d64fb35b257831731b1a57cd01caf40e6df3e61d68d511e2a42
Contents?: true
Size: 887 Bytes
Versions: 10
Compression:
Stored size: 887 Bytes
Contents
module Rake module DSL def cloud_cp(dir, options) # Done here to allow fog to be an optional dependency require 'fog' connection = Fog::Storage.new(options[:credentials]) cd dir do upload_sub_dir(connection, '.', options[:bucket], options[:public] || false) end end def upload_sub_dir(connection, dir, bucket, is_public) is_public ||= false Dir["#{dir}/*"].each do |file| if File.directory? file upload_sub_dir(connection, file, bucket, is_public) else file_name = file.gsub("./", '') puts "Uploading: '#{file_name}'" directory = connection.directories.get(bucket) file = directory.files.create( :key => file_name, :body => IO.read(file), :public => is_public ) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems