-
better_errors
-
binding_of_caller
-
xray-rails 能夠看透是哪個 view 在消耗妳的資源
-
rack-dev-mark 能夠顯示目前是在 development 狀態,暫時不知道好處在哪裡。
-
rack-mini-profiler 可以做 profile 但是可能會嚴重拖慢速度
#How to Use rails _4.0.0_ new $1 -m app_tmpl.rb -T --skip-bundle | |
# rails (4.0.0, 3.2.13, 3.2.12) | |
require 'ap' | |
require 'awesome_print' | |
app_name=@app_name | |
remove_file "README.rdoc" | |
create_file "README.md", "TODO" | |
create_file ".ruby-version" | |
run "echo 2.1.2 > .ruby-version" | |
#install gemfile | |
# Gems used only for assets and not required | |
# # in production environments by default. | |
# gem 'bootstrap-sass', '~> 3.1.1', group: "assets" | |
gem 'bootstrap-sass', '~> 3.1.1' | |
gem 'compass-rails' | |
gem "therubyracer" | |
gem 'hirb-unicode' # auto complete in console | |
gem 'devise' | |
gem "devise_ldap_authenticatable" | |
gem 'rails_admin' | |
gem 'will_paginate', '~> 3.0' | |
gem 'rspec' | |
gem 'awesome_print', :require => 'ap' | |
gem 'tinymce-rails' | |
gem 'haml-rails' | |
gem 'taps' | |
# Segment.io as an analytics solution (https://github.com/segmentio/analytics-ruby) | |
gem "analytics-ruby" | |
# For encrypted password | |
gem "bcrypt-ruby" | |
# Useful SASS mixins (http://bourbon.io/) | |
gem "bourbon" | |
# For authorization (https://github.com/ryanb/cancancan) | |
gem "cancancan" | |
#For using the Sunspot search | |
gem 'sunspot_rails' | |
gem 'sunspot_solr' | |
gem "squeel", "~> 1.2.1" # Last officially released gem | |
# Use CoffeeScript for .js.coffee assets and views | |
gem 'coffee-rails', '~> 4.0.0' | |
# integrate ember-rails | |
gem 'ember-rails' | |
gem 'ember-source' # or the version you need | |
gem 'emblem-rails' | |
# Use jquery as the JavaScript library | |
gem 'jquery-rails' | |
gem_group :development do | |
gem "spring" | |
gem "rspec-rails" | |
gem "guard-rspec" | |
# Rspec for tests (https://github.com/rspec/rspec-rails) | |
gem "rspec-rails" | |
# Guard for automatically launching your specs when files are modified. (https://github.com/guard/guard-rspec) | |
gem "guard-rspec" | |
#For debugging | |
gem 'pry' | |
gem 'pry-rails' | |
gem 'pry-doc' | |
gem 'pry-rescue' | |
gem 'pry-stack_explorer' | |
# gem 'pry-nav' | |
if RUBY_VERSION >= '2.0.0' | |
gem 'pry-byebug' | |
else | |
gem 'pry-debugger' | |
gem 'pry-remote' | |
end | |
gem 'quiet_assets' | |
gem 'guard-livereload', require: false | |
gem "faker" | |
# profile | |
gem 'rack-mini-profiler' | |
end | |
gem "paperclip", "~> 4.1" | |
# It’s much faster and it’s multithreaded Server | |
#gem 'puma' | |
#resque | |
gem "resque", "~> 2.0.0.pre.1", github: "resque/resque" | |
#gem "resque", '~> 1.25.1' | |
gem 'resque_mailer', '~> 2.2.6' | |
gem 'resque-scheduler' | |
gem 'resque-status' | |
#Navigation | |
#https://github.com/andi/simple-navigation/wiki/Installation | |
# gem "simple-navigation" | |
#https://github.com/pdf/simple-navigation-bootstrap | |
# gem 'simple-navigation-bootstrap' | |
#install simple form | |
#http://railscasts.com/episodes/234-simple-form-revised?view=asciicast | |
#run 'rails g simple_form:install' | |
#setting template | |
$layout_folder="layout_template" | |
def tmpl_name(f_name) | |
return nil if f_name.length < 5 | |
to_file="../#{$layout_folder}/#{f_name}" | |
return "#{to_file} app/helpers/#{f_name}" if f_name.include? "helper.rb" | |
return "#{to_file} app/views/layouts/#{f_name}" if f_name.include? "html.erb" | |
return "#{to_file} app/assets/stylesheets/#{f_name}" if f_name.include? "css.scss" | |
end | |
#setting template | |
#get all template files | |
layout_folder_files = `ls ../#{$layout_folder}` | |
layout_folder_files.split().each do |f| | |
ap( "cp #{tmpl_name(f)}") | |
run 'cp '+ tmpl_name(f) | |
end | |
def dest_dir(fname) | |
dir=fname.split('.')[0..-3].join('/') | |
f=fname.split('.')[-2..3].join('.') | |
return dir+'/'+f | |
end | |
#CanCan | |
$custom_files_folder="../custom_files" | |
lists = `ls #{$custom_files_folder}` | |
ap(lists) | |
lists.split().each{|f| | |
from_file = "#{$custom_files_folder}/#{f}" | |
ap "cp #{from_file} #{dest_dir(f)}" | |
run "cp #{from_file} #{dest_dir(f)}" | |
} | |
# for application.yml refer to https://github.com/railscasts/085-yaml-configuration-revised/blob/master/blog-after/config/application.rb | |
gsub_file 'config/application.rb', /if defined\?\(Bundler\)/ do | |
<<-RUBY | |
#setting load secret variables | |
config = YAML.load(File.read(File.expand_path('../application.yml', __FILE__))) | |
config.merge! config.fetch(Rails.env, {}) | |
config.each do |key, value| | |
ENV[key] = value unless value.kind_of? Hash | |
end | |
if defined?(Bundler) | |
RUBY | |
end | |
#custom | |
#run 'rails g scaffold User name:text description:text' | |
#devise install | |
#https://github.com/cschiewek/devise_ldap_authenticatable | |
if yes?("Install devise and generat views?") | |
run 'rails g devise:install' | |
run 'rails g devise user' | |
run 'rails g devise:views' | |
end | |
#finish | |
rake "db:migrate" | |
rake "routes" | |
#github commit | |
#git :init | |
run "y|git flow init" | |
run "cp ~/common_lib/rails/.gitignore ./" | |
git add: "." | |
git commit: %Q{ -m 'Initial commit' } |
better_errors
binding_of_caller
xray-rails 能夠看透是哪個 view 在消耗妳的資源
rack-dev-mark 能夠顯示目前是在 development 狀態,暫時不知道好處在哪裡。
rack-mini-profiler 可以做 profile 但是可能會嚴重拖慢速度