Skip to content

Instantly share code, notes, and snippets.

@tscolari
Created August 15, 2012 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tscolari/3363770 to your computer and use it in GitHub Desktop.
Save tscolari/3363770 to your computer and use it in GitHub Desktop.
Octopress S3 Deploy Method
# ....
gem 'aws-s3'
# ....
# Configuration
aws_access_id = "11111"
aws_secret_key = "111111"
aws_s3_bucket_name = "my.bucket.com"
deploy_default = "aws_s3"
# ...
desc "Deploy website via S3"
task :aws_s3 do
puts "## Deploying website via AWS S3"
require 'aws/s3'
AWS::S3::Base.establish_connection!(
access_key_id: aws_access_id,
secret_access_key: aws_secret_key
)
AWS::S3::Bucket.find aws_s3_bucket_name
ok_failed(Dir["#{public_dir}/**/*"].each do |file|
# Exclude directories from copy
unless File.directory?(file)
print "Uploading #{file}..."
AWS::S3::S3Object.store(file.gsub(/^public\//,''), open(file), aws_s3_bucket_name)
puts " ok"
end
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment