-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path004b_clearance.rails
102 lines (87 loc) · 2.72 KB
/
004b_clearance.rails
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
94
95
96
97
98
99
100
101
102
###############################
# NOT IMPLEMENTED YET!
###############################
#
#
# Clearance template
#
# Builds on top of:
# - 003_haml.rails
#
# Inherited setup:
# - Rails application directory structure initiliazed with git as the SCM system
# - Standard "ignored files" are added to '.gitignore' (.log, database.yml, etc)
# - Saved standard "empty" directories you want in your app
# - A base database.yml file set up to talk to Sqlite3
# - Removes unnecessary files...except index.html (README, et cetera)
# - A single "Initial commit" commit in your repository history
# - RSpec, rspec-rails, webrat, and cucumber gems
# - Builds the gems
# - Removes the test directory
# - App initialized for both rspec and cucumber
# - ie: './script/generate rspec' (& cucumber) have been run
#
# Added functionality/features:
# - thoughtbot's clearance authentication plugin
# - sets up application_controller.rb, user model, and
# a 'session' controller as clearance does by default
# - user model & migration (migration is run for you)
# - session controller
# - updated application_controller for clearance support
# - a 'brochures' controller with an 'index' action & view
# - intended solely for 'external' pages
# - put in place for clearance, remove & replace
# the map.root definition and you should be set
# - removes the default 'index.html' from public
#
# rails:rm_tmp_dirs
["./tmp/pids", "./tmp/sessions", "./tmp/sockets", "./tmp/cache"].each do |f|
run("rmdir ./#{f}")
end
# Delete unnecessary files
run "rm README"
run "rm doc/README_FOR_APP"
run "rm public/favicon.ico"
run "rm public/robots.txt"
# Remove test dir...this uses RSpec
run "rm -rf test"
# git:hold_empty_dirs
run("find . \\( -type d -empty \\) -and \\( -not -regex ./\\.git.* \\) -exec touch {}/.gitignore \\;")
# git:rails:new_app
git :init
file '.gitignore', <<-CODE
log/*.log
log/*.pid
db/*.db
db/*.sqlite3
db/schema.rb
tmp/**/*
.DS_Store
doc/api
doc/app
config/database.yml
CODE
run "cp config/database.yml config/database.yml.sample"
# Migrate to create a db/schema.rb file
rake "db:migrate"
gem "term-ansicolor"
gem "treetop"
gem "nokogiri"
gem "diff-lcs", :lib => "diff/lcs"
gem "builder"
gem "ZenTest"
gem "cucumber"
gem "rspec", :lib => "spec", :version => ">= 1.2.2"
gem "rspec-rails", :lib => "spec/rails", :version => ">= 1.2.2"
gem "webrat"
gem "haml"
rake("gems:install", :sudo => true) if yes?("Install gems on local system? (y/n)")
# Initialize submodules
git :submodule => "init"
# Generate RSpec & cucumber support/directory system
generate("rspec")
generate("cucumber")
# Initialize haml in project
run "haml --rails ."
git :add => "."
git :commit => "-a -m 'Initial commit'"