-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.rake
51 lines (45 loc) · 1.78 KB
/
setup.rake
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
desc "Setup a new Rails application"
namespace :setup do
desc "Install commonly used plugins"
namespace :plugins do
desc "Install Shoulda, shoulda_generator, and Factory Girl"
task :shoulda do
unless File.exist?(File.dirname(__FILE__) + "/../../vendor/plugins/shoulda")
sh('script/plugin install git://github.com/thoughtbot/shoulda.git')
end
unless File.exist?(File.dirname(__FILE__) + "/../../vendor/plugins/shoulda_generator")
sh('script/plugin install git://github.com/technicalpickles/shoulda_generator.git')
end
unless File.exist?(File.dirname(__FILE__) + "/../../vendor/plugins/factory_girl")
sh('script/plugin install git://github.com/thoughtbot/factory_girl.git')
end
end
desc "Install RESTful Authentication"
task :restful_auth do
unless File.exist?(File.dirname(__FILE__) + "/../../vendor/plugins/restful-authentication")
sh('git clone git://github.com/technoweenie/restful-authentication.git vendor/plugins/restful-authentication')
end
end
desc "Install jRails"
task :jrails do
unless File.exist?(File.dirname(__FILE__) + "/../../vendor/plugins/jrails")
sh('script/plugin install git://github.com/aaronchi/jrails.git')
end
end
desc "Run all plugin tasks"
task :all do
tasks = tasks_in_namespace("setup:plugins")
tasks.each do |task|
Rake::Task["#{task}"].invoke
end
end
end
end
private
# Borrowed this lovely method from: http://www.betweentherails.com/rake/
def tasks_in_namespace(ns)
#grab all tasks in the supplied namespace
tasks = Rake.application.tasks.select { |t| t.name =~ /^#{ns}:/ }
#make sure we don't include the :all task
tasks.reject! { |t| t.name =~ /:all/ }
end