Skip to content

Instantly share code, notes, and snippets.

@marksim
Last active December 11, 2015 20:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marksim/4658117 to your computer and use it in GitHub Desktop.
Save marksim/4658117 to your computer and use it in GitHub Desktop.
Rails 3.2 template for Dreamhost functioning with twitter bootstrap, simple_form, and sorcery
# To use, type:
# rails new <application> -m https://gist.github.com/raw/4658117
create_file ".rvmrc", "rvm use ruby-1.8.7-p358"
# Basic Gems
gem 'sorcery'
gem 'cancan'
gem 'mini_magick'
gem 'carrierwave'
gem 'haml-rails'
gem 'simple_form'
gem 'redcarpet'
gem 'turbolinks'
gem 'jquery-turbolinks'
# Asset Gems
gem_group :assets do
gem 'twitter-bootstrap-rails', '2.1.3'
gem 'therubyracer', '0.10.2', :platform => :ruby
end
gem_group :development, :test do
gem 'rspec-rails'
end
# Deployment Gems
gem 'capistrano'
run 'bundle install'
run 'bundle package'
get "http://rubygems.org/downloads/libv8-3.3.10.4-x86-linux.gem", "vendor/cache/libv8-3.3.10.4-x86-linux.gem"
rake 'db:create', :env => :development
rake 'db:create', :env => :test
generate 'boostrap:install less'
if yes?('Do you want a fixed layout')
generate 'bootstrap:layout application fixed'
else
generate 'bootstrap:layout application fluid'
end
remove_file 'app/views/layouts/application.html.erb'
generate 'rspec:install'
generate 'simple_form:install'
generate 'sorcery:install remember_me session_timeout'
generate 'cancan:ability'
generate 'controller Dashboard index'
generate 'controller Sessions new create destroy'
remove_file 'app/views/sessions/create.html.haml'
remove_file 'app/views/sessions/destroy.html.haml'
remove_file 'public/index.html'
route 'root :to => "dashboard#index"'
route 'get "logout" => "sessions#destroy", :as => "logout"'
route 'get "login" => "sessions#new", :as => "login"'
route 'resources :sessions'
capify!
domain = ask("What domain will your app be hosted at?")
username = ask("What is the dreamhost username?")
remove_file 'config/deploy.rb'
create_file 'config/deploy.rb' do
<<-eos
require 'bundler/capistrano'
set :default_environment, {
"PATH" => "~/.gems/bin:/usr/lib/ruby/gems/1.8/bin/:/usr/local/bin:/usr/bin:/bin:"
}
set :shell, "/bin/bash"
set :application, "#{domain}"
set :scm, :none
set :repository, "."
set :deploy_via, :copy
set :domain, "#{domain}"
set :user, "#{username}"
set :deploy_to, "/home/\#{user}/\#{application}/"
set :use_sudo, false
role :web, domain
role :app, domain
role :db, domain, :primary => true # This is where Rails migrations will run
# if you want to clean up old releases on each deploy uncomment this:
# after "deploy:restart", "deploy:cleanup"
# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "\#{try_sudo} touch \#{File.join(current_path,'tmp','restart.txt')}"
end
end
eos
end
git :init
git :add => "."
git :commit => "-a -m 'initial commit'"
say <<-eos
============================================================================
Your new Rails application is ready to go.
Don't forget to scroll up for important messages from installed generators.
You need to flesh out SessionsController and uncomment load/assets in Capfile
eos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment