Created
December 3, 2011 20:40
-
-
Save pheuter/1428087 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'fileutils' | |
require 'open-uri' | |
def folders | |
FileUtils.mkdir_p %w(public/css public/js public/img views).map {|f| "#{ARGV[0]}/#{f}" } | |
end | |
def files | |
open("#{ARGV[0]}/Procfile",'w') { |f| f.write "web: bundle exec ruby web.rb -p $PORT" } | |
open("#{ARGV[0]}/Gemfile",'w') { |f| f.write "source :rubygems\n\ngem 'sinatra'\ngem 'coffee-script'" } | |
open("#{ARGV[0]}/web.rb",'w') { |f| f.write "require 'sinatra'\nrequire 'coffee-script'\n\nget '/' do\n\terb :index\nend\n\nget '/js/app.js' do\n\tcoffee :app\nend" } | |
open("#{ARGV[0]}/views/index.erb",'w') { |f| f.write open("http://dl.dropbox.com/u/1803181/boilerplate/index.html").read } | |
open("#{ARGV[0]}/public/css/reset.css",'w') { |f| f.write open("http://dl.dropbox.com/u/1803181/boilerplate/style.css").read } | |
open("#{ARGV[0]}/public/js/jquery.js",'w') { |f| f.write open("http://code.jquery.com/jquery-1.7.1.min.js").read } | |
open("#{ARGV[0]}/views/app.coffee",'w') { |f| f.write "$ ->\n\talert 'DOM loaded'" } | |
FileUtils.touch ["#{ARGV[0]}/public/css/style.css"] | |
end | |
def deploy | |
`cd "#{ARGV[0]}" && bundle install && git init && git add . && git commit -m 'init' && heroku create "#{ARGV[0]}" --stack cedar && git push heroku master` | |
end | |
folders | |
files | |
deploy if ARGV[1] == "-d" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment