ianwhite / resources_controller

resources_controller rails plugin: rc makes RESTful controllers fun

This URL has Read+Write access

6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 1 # use pluginized rpsec if it exists
2 rspec_base = File.expand_path(File.dirname(__FILE__) + '/../rspec/lib')
3 $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) and !$LOAD_PATH.include?(rspec_base)
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 4
5 require 'spec/rake/spectask'
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 6 require 'spec/rake/verify_rcov'
7 require 'rake/rdoctask'
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 8
9f29e2c4 » ianwhite 2008-09-22 Making cruise task push doc... 9 plugin_name = 'resources_controller'
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 10
2b48b699 » ian 2007-05-30 tweaks to cruise tasks 11 task :default => :spec
60b3451c » ian 2007-05-26 Rakefile now contains a cru... 12
9f29e2c4 » ianwhite 2008-09-22 Making cruise task push doc... 13 task :cruise do
14 # run the garlic task, capture the output, if succesful make the docs and copy them to ardes
15 begin
16 sh "rake garlic:all > garlic_report.txt"
17
18 # send abridged rpeort
19 report = File.read('garlic_report.txt').sub(/^.*?==========/m, '==========')
20 report = "garlic report for #{plugin_name}\n#{`git log -n 1 --pretty=oneline --no-color`}\n" + report
21 File.open('garlic_report.txt', 'w+') {|f| f << report }
22 sh "scp -i ~/.ssh/ardes garlic_report.txt ardes@ardes.com:~/subdomains/plugins/httpdocs/doc/#{plugin_name}_garlic_report.txt"
23
24 # build doc and send that
25 cd "garlic/work/edge/vendor/plugins/#{plugin_name}" do
26 sh "rake doc:all"
27 sh "scp -i ~/.ssh/ardes -r doc ardes@ardes.com:~/subdomains/plugins/httpdocs/doc/inherit_views"
28 end
29
30 ensure
31 puts File.read('garlic_report.txt')
32 end
33 end
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 34
35 desc "Run the specs for #{plugin_name}"
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 36 Spec::Rake::SpecTask.new(:spec) do |t|
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 37 t.spec_files = FileList['spec/**/*_spec.rb']
38 t.spec_opts = ["--colour"]
39 end
40
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 41 namespace :spec do
42 desc "Generate RCov report for #{plugin_name}"
43 Spec::Rake::SpecTask.new(:rcov) do |t|
44 t.spec_files = FileList['spec/**/*_spec.rb']
45 t.rcov = true
46 t.rcov_dir = 'doc/coverage'
cac37025 » ianwhite 2008-05-22 Ignoring rcov.rb files in c... 47 t.rcov_opts = ['--text-report', '--exclude', "spec/,rcov.rb,#{File.expand_path(File.join(File.dirname(__FILE__),'../../..'))}"]
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 48 end
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 49
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 50 namespace :rcov do
51 desc "Verify RCov threshold for #{plugin_name}"
52 RCov::VerifyTask.new(:verify => "spec:rcov") do |t|
fc138623 » ian 2007-11-06 resources_controller: cover... 53 t.threshold = 100.0
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 54 t.index_html = File.join(File.dirname(__FILE__), 'doc/coverage/index.html')
55 end
56 end
57
58 desc "Generate specdoc for #{plugin_name}"
59 Spec::Rake::SpecTask.new(:doc) do |t|
60 t.spec_files = FileList['spec/**/*_spec.rb']
b7750a58 » ian 2007-07-09 * Enclosed named paths use ... 61 t.spec_opts = ["--format", "specdoc:SPECDOC"]
62 end
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 63
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 64 namespace :doc do
65 desc "Generate html specdoc for #{plugin_name}"
66 Spec::Rake::SpecTask.new(:html => :rdoc) do |t|
67 t.spec_files = FileList['spec/**/*_spec.rb']
b7750a58 » ian 2007-07-09 * Enclosed named paths use ... 68 t.spec_opts = ["--format", "html:doc/rspec_report.html", "--diff"]
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 69 end
70 end
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 71 end
72
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 73 task :rdoc => :doc
74 task "SPECDOC" => "spec:doc"
75
76 desc "Generate rdoc for #{plugin_name}"
77 Rake::RDocTask.new(:doc) do |t|
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 78 t.rdoc_dir = 'doc'
79 t.main = 'README'
80 t.title = "#{plugin_name}"
a4c29ffc » ian 2007-12-02 Added RDOC_TEMPLATE env var... 81 t.template = ENV['RDOC_TEMPLATE']
2200ba91 » ian 2007-09-05 * Major internal changes, a... 82 t.options = ['--line-numbers', '--inline-source', '--all']
ceaf1b96 » ianwhite 2008-09-13 The reason for the reversio... 83 t.rdoc_files.include('README.rdoc', 'SPECDOC', 'MIT-LICENSE', 'CHANGELOG')
ba59ce9a » ian 2007-01-29 Initial import of rest_cont... 84 t.rdoc_files.include('lib/**/*.rb')
85 end
86
6dccf6a7 » ian 2007-05-10 Upgraded specs for latest e... 87 namespace :doc do
88 desc "Generate all documentation (rdoc, specdoc, specdoc html and rcov) for #{plugin_name}"
89 task :all => ["spec:doc:html", "spec:doc", "spec:rcov", "doc"]
121b06e5 » ian 2007-09-13 updated threshold 90 end
b972d156 » ianwhite 2008-04-26 Added get_garlic rake task,... 91
92 # load up garlic if it's here
93 if File.directory?(File.join(File.dirname(__FILE__), 'garlic'))
94 require File.join(File.dirname(__FILE__), 'garlic/lib/garlic_tasks')
95 require File.join(File.dirname(__FILE__), 'garlic')
96 end
97
98 desc "clone the garlic repo (for running ci tasks)"
99 task :get_garlic do
100 sh "git clone git://github.com/ianwhite/garlic.git garlic"
101 end
31edab31 » ianwhite 2008-09-07 Finished generated specs ra... 102
103 # load up the tasks for testing rspec generators against RC
104 require File.join(File.dirname(__FILE__), 'spec/generate_rake_task')