-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrails3-template.rb
93 lines (74 loc) · 2.65 KB
/
rails3-template.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
gem "execjs"
gem "therubyracer"
# Templating engine and CSS framework
gem "haml-rails", :group => :development
gem "hpricot", :group => :development
gem "ruby_parser", :group => :development
gem "nifty-generators", :group => :development
gem "mocha"
# Form builder
gem "simple_form"
# authentication and authorization
gem "devise"
gem "cancan"
# rspec, factory girl, capybara, etc. for testing
gem "rails3-generators", :group => [ :development ]
gem "rspec-rails", :group => [ :development, :test ]
gem "factory_girl_rails", :group => [ :development, :test ]
gem "rcov", :group => [ :development, :test ]
gem "capybara", :group => :test
gem "ffaker", :group => :test
gem 'spork', '~> 0.9.0.rc', :group => [:development, :test]
gem 'guard-rspec', :group => [:development, :test]
gem 'guard-spork', :group => [:development, :test]
gem 'launchy', :group => [:development, :test]
gem 'rspec_multi_matchers', :group => [:development, :test]
gem 'random_data', :group => [:development, :test]
# Back-office
gem "activeadmin"
# Attachments
gem "paperclip"
# Pagination
gem "kaminari"
run 'bundle install'
run "bundle exec rake db:create", :env => :development
run "bundle exec rake db:create", :env => :test
generate 'nifty:layout --haml'
remove_file 'app/views/layouts/application.html.erb' # use nifty layout instead
generate 'simple_form:install'
generate 'nifty:config'
#remove_file 'public/javascripts/rails.js' # jquery-rails replaces this
generate 'rspec:install'
inject_into_file 'spec/spec_helper.rb', "\nrequire 'factory_girl'", :after => "require 'rspec/rails'"
inject_into_file 'config/application.rb', :after => "config.filter_parameters += [:password]" do
<<-eos
# Customize generators
config.generators do |g|
g.orm :active_record
g.template_engine :haml
g.test_framework :rspec
g.stylesheets false
g.form_builder :simple_form
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
end
eos
end
run "echo '--format documentation' >> .rspec"
generate "devise:install"
generate "active_admin:install User"
generate "devise:views users"
run "bundle exec rake db:migrate db:test:prepare"
generate "cancan:ability"
generate "active_admin:resource User"
generate "controller home index"
route 'root :to => "home#index"'
# clean up rails defaults
remove_file 'public/index.html'
remove_file 'rm public/images/rails.png'
#run 'cp config/database.yml config/database.example'
#run "echo 'config/database.yml' >> .gitignore"
say <<-eos
============================================================================
Your new Rails application is ready to go.
Don't forget to scroll up for important messages from installed generators.
eos