class Mogwai
Constants
- CONFIG_PATHS
Public Class Methods
deploy(bucket = nil)
click to toggle source
# File lib/mogwai.rb, line 22 def self.deploy bucket = nil config = Mogwai::Config.new config.read bucket ||= config[:BUCKET] # Deploy built assets to s3 STDOUT.sync = true AWS::S3::Base.establish_connection!( :access_key_id => config[:AWS_ACCESS_KEY_ID], :secret_access_key => config[:AWS_SECRET_ACCESS_KEY] ) build_dir = config[:BUILD_DIR].gsub(/([^\/])$/, '\1/') build_glob = build_dir + "**/*" Dir.glob(build_glob).each do |file| if File.file?(file) remote_file = file.gsub(build_dir, "") AWS::S3::S3Object.store( remote_file, open(file), bucket, :access => :public_read ) end end STDOUT.sync = false puts "Mogwai successfully deployed to " + bucket return true end