Skip to content

Commit

Permalink
Reactivate deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-c committed Mar 14, 2013
1 parent ca8ef58 commit 67f714b
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
mv build/application.js "build/application-$timestamp.js"
mv build/application.css "build/application-$timestamp.css"
rm build/application.css
BASH

Expand All @@ -38,33 +37,33 @@
index.gsub! 'application.css', "application-#{ timestamp }.css"
File.open('build/index.html', 'w'){ |f| f.puts index }

# working_directory = Dir.pwd
# Dir.chdir 'build'
# to_upload = Dir['**/*'].reject{ |path| File.directory? path }
# to_upload.delete 'index.html'
# to_upload << 'index.html'
# total = to_upload.length
#
# to_upload.each.with_index do |file, index|
# content_type = case File.extname(file)
# when '.html'
# 'text/html'
# when '.js'
# 'application/javascript'
# when '.css'
# 'text/css'
# when '.gz'
# 'application/x-gzip'
# when '.ico'
# 'image/x-ico'
# else
# `file --mime-type -b #{ file }`.chomp
# end
#
# puts "#{ '%2d' % (index + 1) } / #{ '%2d' % total }: Uploading #{ file } as #{ content_type }"
# bucket.objects["#{file}"].write file: file, acl: :public_read, content_type: content_type
# end
#
# Dir.chdir working_directory
# `rm -rf build`
# puts 'Done!'
working_directory = Dir.pwd
Dir.chdir 'build'
to_upload = Dir['**/*'].reject{ |path| File.directory? path }
to_upload.delete 'index.html'
to_upload << 'index.html'
total = to_upload.length

to_upload.each.with_index do |file, index|
content_type = case File.extname(file)
when '.html'
'text/html'
when '.js'
'application/javascript'
when '.css'
'text/css'
when '.gz'
'application/x-gzip'
when '.ico'
'image/x-ico'
else
`file --mime-type -b #{ file }`.chomp
end

puts "#{ '%2d' % (index + 1) } / #{ '%2d' % total }: Uploading #{ file } as #{ content_type }"
bucket.objects["#{file}"].write file: file, acl: :public_read, content_type: content_type
end

Dir.chdir working_directory
`rm -rf build`
puts 'Done!'

0 comments on commit 67f714b

Please sign in to comment.