Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 377
- Log:
Various files are in the gem, but apparently not in the source distribution
on GitHub. These have been copied in from the working gem.
- Author:
- rool
- Date:
- Mon Mar 21 13:46:18 +0000 2011
- Size:
- 4305 Bytes
1 | # I think this is the one that should be moved to the extension Rakefile template |
2 | |
3 | # In rails 1.2, plugins aren't available in the path until they're loaded. |
4 | # Check to see if the rspec plugin is installed first and require |
5 | # it if it is. If not, use the gem version. |
6 | |
7 | # Determine where the RSpec plugin is by loading the boot |
8 | unless defined? RADIANT_ROOT |
9 | ENV["RAILS_ENV"] = "test" |
10 | case |
11 | when ENV["RADIANT_ENV_FILE"] |
12 | require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot" |
13 | when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions} |
14 | require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot" |
15 | else |
16 | require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot" |
17 | end |
18 | end |
19 | |
20 | require 'rake' |
21 | require 'rake/rdoctask' |
22 | require 'rake/testtask' |
23 | |
24 | rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib') |
25 | $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) |
26 | require 'spec/rake/spectask' |
27 | require 'cucumber' |
28 | require 'cucumber/rake/task' |
29 | |
30 | # Cleanup the RADIANT_ROOT constant so specs will load the environment |
31 | Object.send(:remove_const, :RADIANT_ROOT) |
32 | |
33 | extension_root = File.expand_path(File.dirname(__FILE__)) |
34 | |
35 | task :default => :spec |
36 | task :stats => "spec:statsetup" |
37 | |
38 | desc "Run all specs in spec directory" |
39 | Spec::Rake::SpecTask.new(:spec) do |t| |
40 | t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] |
41 | t.spec_files = FileList['spec/**/*_spec.rb'] |
42 | end |
43 | |
44 | task :features => 'spec:integration' |
45 | |
46 | namespace :spec do |
47 | desc "Run all specs in spec directory with RCov" |
48 | Spec::Rake::SpecTask.new(:rcov) do |t| |
49 | t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] |
50 | t.spec_files = FileList['spec/**/*_spec.rb'] |
51 | t.rcov = true |
52 | t.rcov_opts = ['--exclude', 'spec', '--rails'] |
53 | end |
54 | |
55 | desc "Print Specdoc for all specs" |
56 | Spec::Rake::SpecTask.new(:doc) do |t| |
57 | t.spec_opts = ["--format", "specdoc", "--dry-run"] |
58 | t.spec_files = FileList['spec/**/*_spec.rb'] |
59 | end |
60 | |
61 | [:models, :controllers, :views, :helpers].each do |sub| |
62 | desc "Run the specs under spec/#{sub}" |
63 | Spec::Rake::SpecTask.new(sub) do |t| |
64 | t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] |
65 | t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] |
66 | end |
67 | end |
68 | |
69 | desc "Run the Cucumber features" |
70 | Cucumber::Rake::Task.new(:integration) do |t| |
71 | t.fork = true |
72 | t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')] |
73 | # t.feature_pattern = "#{extension_root}/features/**/*.feature" |
74 | t.profile = "default" |
75 | end |
76 | |
77 | # Setup specs for stats |
78 | task :statsetup do |
79 | require 'code_statistics' |
80 | ::STATS_DIRECTORIES << %w(Model\ specs spec/models) |
81 | ::STATS_DIRECTORIES << %w(View\ specs spec/views) |
82 | ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) |
83 | ::STATS_DIRECTORIES << %w(Helper\ specs spec/views) |
84 | ::CodeStatistics::TEST_TYPES << "Model specs" |
85 | ::CodeStatistics::TEST_TYPES << "View specs" |
86 | ::CodeStatistics::TEST_TYPES << "Controller specs" |
87 | ::CodeStatistics::TEST_TYPES << "Helper specs" |
88 | ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/} |
89 | end |
90 | |
91 | namespace :db do |
92 | namespace :fixtures do |
93 | desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y" |
94 | task :load => :environment do |
95 | require 'active_record/fixtures' |
96 | ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) |
97 | (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| |
98 | Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*')) |
99 | end |
100 | end |
101 | end |
102 | end |
103 | end |
104 | |
105 | desc 'Generate documentation for the it extension.' |
106 | Rake::RDocTask.new(:rdoc) do |rdoc| |
107 | rdoc.rdoc_dir = 'rdoc' |
108 | rdoc.title = 'I18nItExtension' |
109 | rdoc.options << '--line-numbers' << '--inline-source' |
110 | rdoc.rdoc_files.include('README') |
111 | rdoc.rdoc_files.include('lib/**/*.rb') |
112 | end |
113 | |
114 | # For extensions that are in transition |
115 | desc 'Test the it extension.' |
116 | Rake::TestTask.new(:test) do |t| |
117 | t.libs << 'lib' |
118 | t.pattern = 'test/**/*_test.rb' |
119 | t.verbose = true |
120 | end |
121 | |
122 | # Load any custom rakefiles for extension |
123 | Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f } |