Last active
August 29, 2015 14:14
-
-
Save kskb/e6a9c6d61c8b2ea7eee6 to your computer and use it in GitHub Desktop.
Rails4 Template
This file contains hidden or 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
return unless yes?('Use Template?') | |
# clean file | |
run 'rm README.rdoc' | |
gem 'kaminari' # Pagenation | |
gem 'slim-rails' | |
gem 'simple_form' | |
gem 'puma' | |
gem 'rails-config' | |
gem 'therubyracer' | |
use_devise = false | |
if yes?('Use Devise?') | |
gem 'devise' | |
use_devise = true | |
end | |
if yes?('Use Grape?(API Server)') | |
gem 'grape' | |
end | |
gem_group :development do | |
# capistrano3関連 | |
gem 'capistrano', '~> 3.2.0' | |
gem 'capistrano-rails' | |
gem 'capistrano-bundler' | |
gem 'capistrano-rbenv' | |
gem 'capistrano3-puma' | |
# others | |
gem 'better_errors' | |
gem 'binding_of_caller' | |
gem 'rack-mini-profiler' | |
end | |
gem_group :development, :test do | |
gem 'spring' # コマンド高速化 | |
# テスト用途 | |
gem 'factory_girl_rails' | |
gem 'rspec-rails', '~> 3.0' | |
# rails c 時の表示関連 | |
gem 'pry-rails' | |
gem 'pry-coolline' | |
gem 'pry-byebug' | |
gem 'awesome_print' | |
# rails c でのSQL表示整形 | |
gem 'hirb' | |
gem 'hirb-unicode' | |
gem 'bullet' | |
end | |
# http://bootswatch.com/ | |
bootswatch_name = ask('What Use BootWatch? ["cerulean", "cosmo", "flatly", "cyborg" ... etc] blank: no use') | |
if bootswatch_name | |
# TODO @import "bootswatch/bootswatch.less"; @import "bootswatch/variables.less"; -> bootstrap_and_overrides.css.less | |
run 'mkdir vendor/assets/stylesheets/bootswatch' | |
run "wget -P vendor/assets/stylesheets/bootswatch http://bootswatch.com/#{bootswatch_name}/variables.less" | |
run "wget -P vendor/assets/stylesheets/bootswatch http://bootswatch.com/#{bootswatch_name}/bootswatch.less" | |
#gem 'twitter-bootswatch-rails' | |
#gem 'twitter-bootswatch-rails-helpers' | |
#else | |
gem 'twitter-bootstrap-rails' | |
gem 'less-rails' | |
#bootswatch_name = "static" | |
end | |
run 'bundle install' | |
# Twitter Bootstrap | |
after_bundle do | |
run 'rbenv rehash' | |
generate 'bootstrap:install less' | |
remove_file './app/views/layouts/application.html.erb' | |
generate 'bootstrap:layout application' | |
#if bootswatch_name | |
# generate "bootswatch:install #{bootswatch_name}" | |
# generate "bootswatch:import #{bootswatch_name}" | |
# generate "bootswatch:layout #{bootswatch_name}" | |
# generate 'bootswatch:layout application' | |
#end | |
generate 'simple_form:install --bootstrap' | |
# Rspec | |
generate 'rspec:install' | |
# rails_config | |
generate 'rails_config:install' | |
run "echo '--color -f d' > .rspec" | |
if use_devise | |
generate 'devise:install' | |
devise_model_name = ask('What Devise Model Name?') | |
if devise_model_name.present? | |
generate "devise #{devise_model_name.pluralize}" | |
run 'bundle exec rake db:create db:migrate' | |
generate "devise:views #{devise_model_name.pluralize}" | |
generate "devise:controllers #{devise_model_name.pluralize}" | |
# sign in | |
#generate "generate devise:controllers #{devise_model_name.pluralize}/sessions" | |
# sing up | |
#generate "generate devise:controllers #{devise_model_name.pluralize}/registrations" | |
end | |
end | |
# .gitignore | |
remove_file '.gitignore' | |
gitignore_url = 'https://raw.githubusercontent.com/github/gitignore/master/Rails.gitignore' | |
get gitignore_url, '.gitignore' | |
git :init | |
git :add => '.' | |
git :commit => '-am "Initial commit"' | |
end | |
# set config/application.rb | |
application do | |
%q{ | |
# Set timezone | |
config.time_zone = 'Tokyo' | |
config.active_record.default_timezone = :local | |
# generatorの設定 | |
config.generators do |g| | |
g.orm :active_record | |
g.template_engine :slim | |
g.test_framework :rspec, :fixture => true | |
g.fixture_replacement :factory_girl, :dir => "spec/factories" | |
g.view_specs false | |
g.controller_specs true | |
g.routing_specs false | |
g.helper_specs false | |
g.request_specs false | |
g.assets false | |
g.helper false | |
end | |
} | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ mkdir hoge
$ cd hoge
$ bundle init
$ vi Gemfile
$ bundle install --path vendor/bundle
$ bundle exec rails new . -m https://gist.githubusercontent.com/kskb/e6a9c6d61c8b2ea7eee6/raw/template.rb -d mysql