syncassets_r2
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.document
.gitignore
Gemfile
Gemfile.lock
LICENSE.txt
README.rdoc
Rakefile
VERSION
init.rb
syncassets_r2.gemspec

README.rdoc

This rake task will update (delete and copy) all the files under the public directory to S3, by default is the public directory but you can pass as argument the path to the folder inside the public directory.

The rake task will verify if the local file exist on s3 and if the local file have been modified since the upload to s3.

** Rails 2.3.4 **

In your Gemfile

gem 'syncassets_r2'

In your Rakefile

Dir["#{Gem.searcher.find('syncassets_r2').full_gem_path}/lib/tasks/**/*.rake"].each { |ext| load ext }

In your config/aws.yml

development:
  access_key_id:     'YOUR_ACCESS_KEY'
  secret_access_key: 'YOUR_SECRET_ACCESS_KEY'
  bucket:            'YOUR_BUCKET_NAME'
test:
  access_key_id:     'YOUR_ACCESS_KEY'
  secret_access_key: 'YOUR_SECRET_ACCESS_KEY'
  bucket:            'YOUR_BUCKET_NAME'
production:
  access_key_id:     'YOUR_ACCESS_KEY'
  secret_access_key: 'YOUR_SECRET_ACCESS_KEY'
  bucket:            'YOUR_BUCKET_NAME'

Running the task

rake syncassets:sync_s3_public_assets
# this will sync all the folders and files under the /public directory of your app

rake syncassets:sync_s3_public_assets[javascripts]
# this will sync all the folders and files under the /public/javascripts directory of your app

rake syncassets:sync_s3_public_assets[javascripts/some_folder]
# this will sync all the folders and files under the /public/javascripts/some_folder directory of your app