Skip to content

Repository files navigation

S3deploy

Rake tasks for pushing stuff to S3. Heavily cribbed from Mixbook's S3 Deployer. Unlike Mixbook's thing, this does no versioning or fancy revisiony stuff.

Installation

Add this line to your application's Gemfile:

gem 's3deploy', git: 'https://github.com/ryanmark/s3deploy-ruby.git'

And then execute:

$ bundle install

Rake usage

Your Rakefile should look something like this:

require'rubygems'require'bundler'Bundler.setuprequire's3deploy/tasks'S3deploy.configuredobucket"my-staging-bucket"app_path"devastator"# dir in the S3 bucket to deploy todist_dir"dist"# local dir to deploy fromgzip[/\.js$/,/\.css$/,/\.json$/,/\.html$/,/\.csv$/]# or just use 'true' to gzip everythingbefore_deploy->do# Some custom code to execute before deployendafter_deploy->do# Some custom code to execute after deployend# You also can specify environment-specific settings, the default environment is 'production'environment(:production)dobucket"my-production-bucket"endaccess_key_idENV['AWS_ACCESS_KEY_ID']secret_access_keyENV['AWS_SECRET_ACCESS_KEY']end

To actually deploy:

$ rake s3:deploy

To deploy to production:

$ ENV=production rake s3:deploy

API Usage

You can also use the deployer in your own code as a plain old object.

require's3deploy/deployer'deployer=S3deploy::Deployer.new(# requireddist_dir: 'upload',bucket: 'my-bucket',# optionalaccess_key_id: 'AWS access key id',secret_access_key: 'AWS access key',app_path: 'graphics/foo',gzip: [/\.js$/,/\.css$/,/\.html?$/],logger: Rails.logger)

Contributing

  1. Fork it ( https://github.com/ryanmark/s3deploy/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

Little library for deploying to S3

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages