-
-
Save tinomen/641804 to your computer and use it in GitHub Desktop.
git init
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
hoptoad_key = ask("\r\n\r\nWant to use your Hoptoad Account?\n\r\n\rEnter your API Key, or press Enter to skip") | |
plugin 'hoptoad_notifier', :git => "git://github.com/thoughtbot/hoptoad_notifier.git" | |
unless hoptoad_key=="" | |
initializer 'hoptoad.rb', <<-FILE | |
HoptoadNotifier.configure do |config| | |
config.api_key = '#{hoptoad_key}' | |
end | |
FILE | |
end |
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
#---------------------------------------------------------------------------- | |
# Bundle the Bundler | |
#---------------------------------------------------------------------------- | |
run "mkdir gems && mkdir gems/bundler" | |
inside 'gems/bundler' do | |
run 'git init' | |
run 'git pull --depth 1 git://github.com/wycats/bundler.git' | |
run 'rm -rf .git .gitignore' | |
end |
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
#---------------------------------------------------------------------------- | |
# Capistrano | |
#---------------------------------------------------------------------------- | |
if yes?('Install Capistrano on your local system? (yes/no)') | |
run "sudo gem install capistrano" | |
capify! | |
file 'Capfile', <<-FILE | |
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | |
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } | |
load 'config/deploy' | |
FILE | |
end |
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
#---------------------------------------------------------------------------- | |
# Remove unnecessary Rails files | |
#---------------------------------------------------------------------------- | |
run 'rm README' | |
run 'rm config/database.yml.example' | |
run 'rm config/database.yml' | |
run 'rm public/index.html' | |
run 'rm public/favicon.ico' | |
run 'rm public/images/rails.png' | |
run 'touch README' |
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
#---------------------------------------------------------------------------- | |
# Compass | |
#---------------------------------------------------------------------------- | |
file 'config/compass.rb', <<-CODE | |
# Require any additional compass plugins here. | |
project_type = :rails | |
project_path = RAILS_ROOT if defined?(RAILS_ROOT) | |
# Set this to the root of your project when deployed: | |
http_path = "/" | |
css_dir = "public/stylesheets/" | |
sass_dir = "app/stylesheets" | |
images_dir = "public/images" | |
javascripts_dir = "public/javascripts" | |
# To enable relative paths to assets via compass helper functions. Uncomment: | |
# relative_assets = true | |
http_images_path = "/images" | |
http_stylesheets_path = "/stylesheets" | |
http_javascripts_path = "/javascripts" | |
output_style = :compact | |
CODE | |
file 'config/initializers/compass.rb', <<-CODE | |
require 'compass' | |
# If you have any compass plugins, require them here. | |
Compass.configuration.parse(File.join(RAILS_ROOT, "config", "compass.config")) | |
Compass.configuration.environment = RAILS_ENV.to_sym | |
Compass.configure_sass_plugin! | |
CODE |
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
#---------------------------------------------------------------------------- | |
# Git Setup | |
#---------------------------------------------------------------------------- | |
file '.gitignore', <<-FILE | |
.DS_Store | |
log/*.log | |
tmp/**/* | |
config/database.yml | |
db/*.sqlite3 | |
public/uploads/* | |
gems/* | |
!gems/cache | |
!gems/bundler | |
FILE | |
git :init | |
git :submodule => "init" | |
git :add => '.' | |
git :commit => "-a -m 'Initial commit'" |
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
#---------------------------------------------------------------------------- | |
# Choose Javascript Framework | |
#---------------------------------------------------------------------------- | |
run 'mkdir public/uploads && chmod 777 public/uploads' | |
run 'mkdir public/ui' | |
ask_js = ask("\r\n\r\nWhat javascript framework do you want to use?\r\n\r\n(1) Prototype\r\n(2) jQuery\r\n(3) MooTools\r\n(4) RightJS") | |
if ["1", "2", "3", "4"].include?(ask_db_type) | |
@prototype = (ask_db_type=="1") | |
@jquery = (ask_db_type=="2") | |
@mootools = (ask_db_type=="3") | |
@rightjs = (ask_db_type=="4") | |
else | |
puts "Woops! You must enter a number between 1 and 4" | |
ask_js | |
end | |
js_framework = [:all,"jquery","mootools","rightjs"][ask_db_type.to_i - 1] | |
if !@prototype | |
run 'rm public/javascripts/controls.js' | |
run 'rm public/javascripts/dragdrop.js' | |
run 'rm public/javascripts/effects.js' | |
run 'rm public/javascripts/prototype.js' | |
end | |
if @jquery | |
run "curl -L http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js > public/javascripts/jquery.js" | |
end | |
if @mootools | |
run "curl -L http://mootools.net/download/get/mootools-1.2.4-core-yc.js > public/javascripts/mootools.js" | |
end | |
if @rightjs | |
run "curl -L http://rightjs.org/builds/current/right-min.js > public/javascripts/right.js" | |
run "curl -L http://rightjs.org/builds/current/right-olds-min.js > public/javascripts/right-olds.js" | |
end | |
#---------------------------------------------------------------------------- | |
# Generate Application Layout | |
# (Assumes you have Haml and Lovely Layouts installed) | |
#---------------------------------------------------------------------------- | |
file 'app/views/layouts/application.html.haml', <<-CODE | |
!!! | |
%html | |
%head | |
= title_tag "optional default title here", :prefix => "optional prefix text", :suffix => "optional suffix text" | |
= description_tag "optional default meta description here" | |
= keywords_tag "optional default meta keywords here" | |
= copyright_tag "optional default meta copyright notice here" | |
= stylesheet_link_tag 'screen.css', :media => 'screen, projection' | |
= stylesheet_link_tag 'print.css', :media => 'print' | |
= stylesheet_link_tag 'ie.css', :media => 'screen, projection' | |
= javascript_include_tag #{js_framework} | |
- body do | |
#wrap | |
#header | |
#logo Logo | |
%ul#nav | |
%li= link_to "Home", root_url | |
#page | |
= yield | |
CODE | |
#---------------------------------------------------------------------------- | |
# Create Default Static Pages | |
#---------------------------------------------------------------------------- | |
route "map.root :controller => 'pages', :action => 'index'" | |
generate :controller, "pages index" | |
file 'app/views/pages/index.html.haml', <<-END | |
%h1 Home Page | |
%p | |
:textile | |
Edit me in *app/views/pages/index.html.haml* | |
END |
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
#---------------------------------------------------------------------------- | |
# Rotate log files (50 files max at 1MB each) | |
#---------------------------------------------------------------------------- | |
log_path = '#{Rails.root}/log/#{Rails.env}.log' | |
gsub_file 'config/application.rb', /(< Rails::Application.*)/ , "\\1\n config.logger = | |
Logger.new(\"#{log_path}\", 50, 1048576)" |
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
#---------------------------------------------------------------------------- | |
# Database | |
#---------------------------------------------------------------------------- | |
ask_db_type = ask("\r\n\r\nWhich database type would you like to use?\r\n\r\n(1) SQLite\r\n(2) MySQL\r\n(3) PostgreSQL\r\n(4) MongoDB") | |
if ["1", "2", "3", "4"].include?(ask_db_type) | |
sqlite = (ask_db_type=="1") | |
mysql = (ask_db_type=="2") | |
postgres = (ask_db_type=="3") | |
mongodb = (ask_db_type=="4") | |
else | |
puts "Woops! You must enter a number between 1 and 4" | |
ask_db_type | |
end | |
db_type = ["sqlite3","mysql","postgresql","mongodb"][ask_db_type.to_i - 1] | |
#---------------------------------------------------------------------------- | |
# ORM | |
#---------------------------------------------------------------------------- | |
ask_orm_type = ask("\r\n\r\nWhich ORM would you like to use?\n\r\n\r(1) ActiveRecord\n\r(2) MongoMapper") | |
if %w(1 2).include?(ask_orm_type) | |
activerecord = (ask_orm_type==1) | |
mongomapper = (ask_orm_type==2) | |
else | |
puts "Woops! You must enter a number between 1 and 2" | |
ask_orm_type | |
end | |
db_name = ask("\r\n\r\nWhat should I call the database?\r\n\r\n(Leave blank to use application name)") | |
if sqlite | |
file 'config/database.yml', <<-CODE | |
development: | |
adapter: sqlite3 | |
host: localhost | |
database: db/development.sqlite3 | |
pool: 5 | |
timeout: 5000 | |
test: &TEST | |
adapter: #{db_type} | |
host: localhost | |
database: db/test.sqlite3 | |
pool: 5 | |
timeout: 5000 | |
production: | |
adapter: #{db_type} | |
host: localhost | |
database: db/production.sqlite3 | |
pool: 5 | |
timeout: 5000 | |
cucumber: | |
<<: *TEST | |
CODE | |
else | |
file 'config/database.yml', <<-CODE | |
development: | |
adapter: #{db_type} | |
host: localhost | |
database: #{db_name}_development | |
test: &TEST | |
adapter: #{db_type} | |
host: localhost | |
database: #{db_name}_test | |
production: | |
adapter: #{db_type} | |
host: localhost | |
database: #{db_name}_production | |
cucumber: | |
<<: *TEST | |
CODE | |
if mongomapper | |
#---------------------------------------------------------------------------- | |
# MongoMapper Configuration | |
#---------------------------------------------------------------------------- | |
plugin "git://github.com/compressed/mongo_session_store.git" | |
file "config/initializers/mongo.rb", <<-CODE | |
db_config = YAML::load(File.read(RAILS_ROOT + "/config/database.yml")) if db_config[Rails.env] && db_config[Rails.env]['adapter'] == 'mongodb' | |
mongo = db_config[Rails.env] | |
MongoMapper.connection = Mongo::Connection.new(mongo['localhost']) | |
MongoMapper.database = mongo['#{db_name}'] | |
end | |
CODE | |
#---------------------------------------------------------------------------- | |
# Setup root.rb | |
#---------------------------------------------------------------------------- | |
run "rm config/root.rb" | |
environment = '#{environment}' | |
vendor_rails = '#{vendor_rails}' | |
file "Gemfile", <<-END | |
gem "mongo_mapper", :git => "git://github.com/jnunemaker/mongomapper.git" | |
END | |
file "config/root.rb", <<-FILE | |
# Use Bundler (preferred) | |
environment = File.expand_path('../../vendor/gems/environment', __FILE__) | |
if File.exist?("#{environment}.rb") | |
require environment | |
# Use 2.x style vendor/rails and RubyGems | |
else | |
vendor_rails = File.expand_path('../../vendor/rails', __FILE__) | |
if File.exist?(vendor_rails) | |
Dir["#{vendor_rails}/*/lib"].each { |path| $:.unshift(path) } | |
end | |
require 'rubygems' | |
end | |
#require 'rails/all' | |
# To pick the frameworks you want, remove 'require "rails/all"' | |
# and list the framework railties that you want: | |
# | |
require "active_model/railtie" | |
#require "active_record/railtie" | |
require "action_controller/railtie" | |
require "action_view/railtie" | |
require "action_mailer/railtie" | |
require "active_resource/railtie" | |
FILE | |
end | |
end | |
#---------------------------------------------------------------------------- | |
# Sessions | |
#---------------------------------------------------------------------------- | |
if activerecord | |
file 'session_store.rb', <<-END | |
ActionController::Base.session_store = :active_record_store | |
END | |
end | |
if mongomapper | |
file 'session_store.rb', <<-END | |
require 'mongo_session_store' | |
ActionController::Base.session_store = MongoMapper::SessionStore | |
END | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment