ianwhite / resources_controller

resources_controller rails plugin: rc makes RESTful controllers fun

This URL has Read+Write access

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