-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.rb
84 lines (67 loc) · 2.47 KB
/
base.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
#Ask questions.
description = ask("Please provide a short description of your Project")
if yes?("Use Autlogic?")
using_authlogic = true
user_model_name = ask("What do you want a user to be called?")
else
if yes?("Use nifty-auth without authlogic?")
using_nifty_authentication = true
user_model_name = ask("What do you want a user to be called?")
end
end
#Set up Readme file formatted for GitHub with title and discription.
file 'README.markdown', <<-CODE
#{File.dirname(File.expand_path(__FILE__)).split("/")[-1].titleize}
===
==Description
#{description}
== Other Stuff
Blah...
CODE
#Install gems
gem "haml"
gem "authlogic" if using_authlogic
#gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com'
rake "gems:install", :sudo => true
#Install Plugins
# Attachments with no extra database tables, only one library to install for image processing
plugin 'paperclip', :git => "git://github.com/thoughtbot/paperclip.git"
#Initiate git repo & add gitignore rules
git :init
run "touch tmp/.gitignore log/.gitignore vendor/.gitignore"
run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore}
file '.gitignore', <<-END
.DS_Store
log/*.log
tmp/**/*
config/database.yml
db/*.sqlite3
END
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
run "cp config/database.yml config/example_database.yml"
#Generate welcome controller for front page
generate :controller, "welcome index"
route "map.root :controller => 'welcome'"
run "rm public/index.html"
#Remove prototype files
run "rm public/javascripts/controls.js"
run "rm public/javascripts/dragdrop.js"
run "rm public/javascripts/effects.js"
run "rm public/javascripts/prototype.js"
#Add nifty authentication or authlogic if needed
if using_authlogic
generate :nifty_authentication, "--authlogic", user_model_name
rake "db:migrate"
git :add => ".", :commit => "-m 'adding authlogic authentication'"
end
if using_nifty_authentication
generate :nifty_authentication, user_model_name
rake "db:migrate"
git :add => ".", :commit => "-m 'adding nifty_layouts authentication'"
end
#Add initial stuff to git repo
git :add => ".", :commit => "-m 'initial commit'"
puts "\nDon't forget to set up a github repository and set github as a remote by running\n\tgit remote add origin [email protected]:dannysmith/WHATEVER_THE_REPO_IS_CALLED.git\n\nAfter that, push to github using:\n\tgit push\n\n"