class Rocketwheel::Command::CLI::Deploy::Task
Public Instance Methods
upload()
click to toggle source
# File lib/rocketwheel/command/cli/deploy.rb, line 23 def upload files_to_upload.each do |file| upload_file(file) if File.file?(file) end end
Private Instance Methods
aws_key()
click to toggle source
# File lib/rocketwheel/command/cli/deploy.rb, line 59 def aws_key config.key end
aws_secret()
click to toggle source
# File lib/rocketwheel/command/cli/deploy.rb, line 63 def aws_secret config.secret end
bucket()
click to toggle source
# File lib/rocketwheel/command/cli/deploy.rb, line 43 def bucket @bucket ||= s3.directories.get(bucket_name, :prefix => prefix) end
bucket_name()
click to toggle source
# File lib/rocketwheel/command/cli/deploy.rb, line 67 def bucket_name config.bucket end
files_to_upload()
click to toggle source
# File lib/rocketwheel/command/cli/deploy.rb, line 55 def files_to_upload Dir["#{source}/**/**"] end
prefix()
click to toggle source
# File lib/rocketwheel/command/cli/deploy.rb, line 71 def prefix config.path end
s3()
click to toggle source
# File lib/rocketwheel/command/cli/deploy.rb, line 47 def s3 @s3 ||= Fog::Storage.new( :provider => 'AWS', :aws_access_key_id => aws_key, :aws_secret_access_key => aws_secret ) end
upload_file(file)
click to toggle source
# File lib/rocketwheel/command/cli/deploy.rb, line 31 def upload_file(file) key = File.join(prefix, file.sub(/#{source}\/?/, '')) mime = MIME::Types.type_for(file).first say_status :uploading, key, :green bucket.files.create( :key => key, :body => File.read(file), :public => true, :content_type => mime ) end