1
- #Clear out todo and generate a nifty layout
2
- run "echo TODO > README"
3
- generate :nifty_layout
4
-
1
+ #Ask questions.
2
+
3
+ description = ask ( "Please provide a short description of your Project" )
4
+
5
+ if yes? ( "Use Autlogic?" )
6
+ using_authlogic = true
7
+ user_model_name = ask ( "What do you want a user to be called?" )
8
+ else
9
+ if yes? ( "Use nifty-auth without authlogic?" )
10
+ using_nifty_authentication = true
11
+ user_model_name = ask ( "What do you want a user to be called?" )
12
+ end
13
+ end
14
+
15
+ #Set up Readme file formatted for GitHub with title and discription.
16
+ file 'README.markdown' , <<-CODE
17
+ #{ File . dirname ( File . expand_path ( __FILE__ ) ) . split ( "/" ) [ -1 ] . titleize }
18
+ ===
19
+
20
+ ==Description
21
+ #{ description }
22
+
23
+ == Other Stuff
24
+ Blah...
25
+ CODE
26
+
5
27
#Install gems
6
- gem 'RedCloth' , :lib => 'redcloth'
7
- gem 'mislav-will_paginate' , :lib => 'will_paginate' , :source => 'http://gems.github.com'
28
+ gem "haml"
29
+ gem "authlogic" if using_authlogic
30
+
31
+ #gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com'
8
32
rake "gems:install" , :sudo => true
9
33
34
+ #Install Plugins
35
+ # Attachments with no extra database tables, only one library to install for image processing
36
+ plugin 'paperclip' , :git => "git://github.com/thoughtbot/paperclip.git"
37
+
10
38
#Initiate git repo & add gitignore rules
11
39
git :init
12
-
13
- file ".gitignore" , <<-END
40
+
41
+ run "touch tmp/.gitignore log/.gitignore vendor/.gitignore"
42
+ run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore}
43
+ file '.gitignore' , <<-END
14
44
.DS_Store
15
45
log/*.log
16
46
tmp/**/*
17
47
config/database.yml
18
48
db/*.sqlite3
19
49
END
20
-
21
- run "touch tmp/.gitignore log/.gitignore vendor/.gitignore"
50
+ run "rm README"
51
+ run "rm public/index.html"
52
+ run "rm public/favicon.ico"
53
+ run "rm public/robots.txt"
54
+
22
55
run "cp config/database.yml config/example_database.yml"
23
56
24
- #Add initial stuff to git repo
25
- git :add => "." , :commit => "-m 'initial commit'"
26
-
27
- #Add nifty authentication if needed
28
- if yes? ( "Do you want authentication?" )
29
- name = ask ( "What do you want a user to be called?" )
30
- generate :nifty_authentication , name
31
- rake "db:migrate"
32
-
33
- git :add => "." , :commit => "-m 'adding authentication'"
34
- end
35
-
36
- #Remove prototype files
37
- git :rm => "public/javascripts/controls.js"
38
- git :rm => "public/javascripts/dragdrop.js"
39
- git :rm => "public/javascripts/effects.js"
40
- git :rm => "public/javascripts/prototype.js"
41
-
42
- inside ( 'public/javascripts' ) do
43
- #and add jquery
44
- run "cp ~/current_libs/jquery/* ."
45
- git :add => "." , :commit => "-m 'switching prototype for jquery'"
46
- end
47
-
48
- #Vendor rails
49
- if yes? ( "Vendor rails?" )
50
- inside ( 'vendor' ) do
51
- run "git clone git://github.com/rails/rails.git"
52
- end
53
- end
54
-
55
57
#Generate welcome controller for front page
56
58
generate :controller , "welcome index"
57
59
route "map.root :controller => 'welcome'"
58
- git :rm => "public/index.html"
59
- git :add => "." , :commit => "-m 'adding welcome controller'"
60
+ run "rm public/index.html"
60
61
61
- if yes? ( "Deploy to Heroku?" ) do
62
- heroku create --remote
63
- git push heroku master
64
- puts "\n \n To push to heroku, use:\n \n \t git push heroku master\n \n followed by\n \n heroku rake db:migrate"
62
+ #Remove prototype files
63
+ run "rm public/javascripts/controls.js"
64
+ run "rm public/javascripts/dragdrop.js"
65
+ run "rm public/javascripts/effects.js"
66
+ run "rm public/javascripts/prototype.js"
67
+
68
+ #Add nifty authentication or authlogic if needed
69
+ if using_authlogic
70
+ generate :nifty_authentication , "--authlogic" , user_model_name
71
+ rake "db:migrate"
72
+ git :add => "." , :commit => "-m 'adding authlogic authentication'"
73
+ end
74
+
75
+ if using_nifty_authentication
76
+ generate :nifty_authentication , user_model_name
77
+ rake "db:migrate"
78
+ git :add => "." , :commit => "-m 'adding nifty_layouts authentication'"
65
79
end
66
- puts "\n \n To push to github, use:\n \t git push\n \n "
80
+
81
+ #Add initial stuff to git repo
82
+ git :add => "." , :commit => "-m 'initial commit'"
83
+
84
+ puts "\n Don't forget to set up a github repository and set github as a remote by running\n \t git remote add origin [email protected] :dannysmith/WHATEVER_THE_REPO_IS_CALLED.git\n \n After that, push to github using:\n \t git push\n \n "
0 commit comments