github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

retr0h / dewey.ws

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: 9ed8259

click here to add a description

click here to add a homepage

  • Branches (1)
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Personal Site — Read more

  cancel

http://dewey.ws

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

renamed desc 
retr0h (author)
Fri Apr 03 00:16:49 -0700 2009
commit  9ed8259d8fa6b0f633d3d7f748d30c52ab9d9715
tree    01d88ba6b33b37df00e37f92e07356796d6bfe09
parent  d5a5cb88e6135a0f729cfced0e66323850f1f801
dewey.ws / lib / tasks / cloud.rake lib/tasks/cloud.rake
100644 43 lines (36 sloc) 1.481 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
namespace :cloud do
  SYNC_DIRECTORY = File.join(File.dirname(__FILE__), '..', '..', 'public')
 
  desc "Generate css/js bundles for cdn."
  task :sass => :environment do
    require 'action_controller/integration'
    app = ActionController::Integration::Session.new
 
    puts "INFO: creating asset bundles"
    app.get("/")
  end
 
  desc "Uploads public/images to s3."
  task :upload => [:environment, :sass] do
    require 'aws/s3'
 
    BUCKET = 'dewey.ws'
    DIRECTORIES = %w(images javascripts/cache stylesheets/cache)
    CONTENT_TYPES = {:jpg => 'image/jpeg',
                       :png => 'image/png',
                       :css => 'text/css',
                       :js => 'application/javascript'}
    KEYS = YAML.load(File.open(File.join(ENV['HOME'], '.amazon_keys.yml')))
 
    AWS::S3::Base.establish_connection!(
      :access_key_id => KEYS['AMAZON_ACCESS_KEY_ID'],
      :secret_access_key => KEYS['AMAZON_SECRET_ACCESS_KEY']
    )
 
    AWS::S3::Bucket.create(BUCKET)
    AWS::S3::Bucket.enable_logging_for(BUCKET)
    DIRECTORIES.each do |directory|
      Dir[File.join(SYNC_DIRECTORY, directory, '**', "*.{#{CONTENT_TYPES.keys.join(',')}}")].each do |file|
        file.match(%r{public/(.*)$})
        puts "INFO: uploading #{BUCKET}:#{$1}"
        AWS::S3::S3Object.store($1, open(file), BUCKET,
          :access => :public_read,
          :content_type => CONTENT_TYPES[file.split(/\./)[1].to_sym])
      end
    end
  end
end
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server