Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 8995 Bytes
1 | raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec pkg])) |
2 | raise "To avoid rake task loading problems: run 'rake clobber' in vendor/plugins/rspec-rails" if File.directory?(File.join(File.dirname(__FILE__), *%w[.. .. vendor plugins rspec-rails pkg])) |
3 | |
4 | # In rails 1.2, plugins aren't available in the path until they're loaded. |
5 | # Check to see if the rspec plugin is installed first and require |
6 | # it if it is. If not, use the gem version. |
7 | rspec_base = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec/lib') |
8 | $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base) |
9 | begin |
10 | require 'spec/rake/spectask' |
11 | require 'cucumber/rake/task' |
12 | |
13 | spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop |
14 | task :noop do |
15 | end |
16 | |
17 | task :default => :spec |
18 | task :stats => "spec:statsetup" |
19 | |
20 | desc 'Run all specs in spec directory (excluding plugin & generator specs)' |
21 | task :spec => spec_prereq do |
22 | errors = %w(spec:integration spec:models spec:controllers spec:views spec:helpers spec:lib spec:generators spec:extensions).collect do |task| |
23 | begin |
24 | puts %{\nRunning #{task.gsub('spec:', '').titlecase} Spec Task} |
25 | Rake::Task[task].invoke |
26 | nil |
27 | rescue => e |
28 | task |
29 | ensure |
30 | if task == 'spec:integration' |
31 | Rake::Task["db:test:load"].reenable |
32 | Rake::Task["db:schema:load"].reenable |
33 | Rake::Task["db:test:prepare"].execute |
34 | end |
35 | end |
36 | end.compact |
37 | abort "Errors running #{errors.to_sentence}!" if errors.any? |
38 | end |
39 | |
40 | namespace :spec do |
41 | desc "Run all specs in spec directory with RCov (excluding plugin & generator specs)" |
42 | Spec::Rake::SpecTask.new(:rcov) do |t| |
43 | t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""] |
44 | t.spec_files = FileList.new('spec/**/*_spec.rb') do |fl| |
45 | fl.exclude(/generator/) |
46 | end |
47 | t.rcov = true |
48 | t.rcov_opts = lambda do |
49 | IO.readlines("#{RADIANT_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten |
50 | end |
51 | end |
52 | |
53 | desc "Print Specdoc for all specs (excluding plugin & generator specs)" |
54 | Spec::Rake::SpecTask.new(:doc) do |t| |
55 | t.spec_opts = ["--format", "specdoc", "--dry-run"] |
56 | t.spec_files = FileList.new('spec/**/*_spec.rb') do |fl| |
57 | fl.exclude(/generator/) |
58 | end |
59 | end |
60 | |
61 | desc "Print Specdoc for all plugin specs" |
62 | Spec::Rake::SpecTask.new(:plugin_doc) do |t| |
63 | t.spec_opts = ["--format", "specdoc", "--dry-run"] |
64 | t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*') |
65 | end |
66 | |
67 | [:models, :controllers, :views, :helpers, :lib].each do |sub| |
68 | desc "Run the specs under spec/#{sub}" |
69 | Spec::Rake::SpecTask.new(sub => spec_prereq) do |t| |
70 | t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""] |
71 | t.spec_files = FileList["#{RADIANT_ROOT}/spec/#{sub}/**/*_spec.rb"] |
72 | end |
73 | end |
74 | Cucumber::Rake::Task.new(:integration)# do |t| |
75 | # t.cucumber_opts = ["--format","progress"] |
76 | # t.feature_pattern = "#{RADIANT_ROOT}/features/**/*.feature" |
77 | # end |
78 | |
79 | desc 'Run all specs in spec/generators directory' |
80 | task :generators => spec_prereq do |
81 | errors = ['spec:generators:extension_controller', 'spec:generators:extension_mailer', |
82 | 'spec:generators:extension_migration', 'spec:generators:extension_model', |
83 | 'spec:generators:extension', 'spec:generators:instance'].collect do |task| |
84 | begin |
85 | Rake::Task[task].invoke |
86 | nil |
87 | rescue => e |
88 | task |
89 | end |
90 | end.compact |
91 | abort "Errors running #{errors.to_sentence}!" if errors.any? |
92 | end |
93 | |
94 | namespace :generators do |
95 | [:extension_controller, :extension_mailer, :extension_migration, :extension_model, :extension, :instance].each do |generator| |
96 | desc "Run the spec at spec/geneartors/#{generator}_generator_spec.rb" |
97 | Spec::Rake::SpecTask.new(generator => spec_prereq) do |t| |
98 | t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""] |
99 | t.spec_files = [File.join(RADIANT_ROOT, "spec/generators/#{generator}_generator_spec.rb")] |
100 | end |
101 | end |
102 | end |
103 | |
104 | desc "Run the specs under vendor/plugins (except RSpec's own)" |
105 | Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t| |
106 | t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""] |
107 | t.spec_files = FileList['vendor/plugins/**/spec/**/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*") |
108 | end |
109 | |
110 | namespace :plugins do |
111 | desc "Runs the examples for rspec_on_rails" |
112 | Spec::Rake::SpecTask.new(:rspec_on_rails) do |t| |
113 | t.spec_opts = ['--options', "\"#{RADIANT_ROOT}/spec/spec.opts\""] |
114 | t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*_spec.rb'] |
115 | end |
116 | end |
117 | |
118 | # Setup specs for stats |
119 | task :statsetup do |
120 | require 'code_statistics' |
121 | ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models') |
122 | ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views') |
123 | ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers') |
124 | ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers') |
125 | ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib') |
126 | ::STATS_DIRECTORIES << %w(Integration\ specs spec/integration) if File.exist?('spec/integration') |
127 | ::STATS_DIRECTORIES << %w(Generator\ specs spec/generators) if File.exist?('spec/generators') |
128 | ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models') |
129 | ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views') |
130 | ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers') |
131 | ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers') |
132 | ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib') |
133 | ::CodeStatistics::TEST_TYPES << "Generator specs" if File.exist?('spec/generators') |
134 | ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/} |
135 | end |
136 | |
137 | namespace :db do |
138 | namespace :fixtures do |
139 | desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y" |
140 | task :load => :environment do |
141 | require 'active_record/fixtures' |
142 | ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) |
143 | (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RADIANT_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| |
144 | Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*')) |
145 | end |
146 | end |
147 | end |
148 | end |
149 | |
150 | namespace :server do |
151 | daemonized_server_pid = File.expand_path("spec_server.pid", RAILS_ROOT + "/tmp") |
152 | |
153 | desc "start spec_server." |
154 | task :start do |
155 | if File.exist?(daemonized_server_pid) |
156 | $stderr.puts "spec_server is already running." |
157 | else |
158 | $stderr.puts "Starting up spec server." |
159 | system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid) |
160 | end |
161 | end |
162 | |
163 | desc "stop spec_server." |
164 | task :stop do |
165 | unless File.exist?(daemonized_server_pid) |
166 | $stderr.puts "No server running." |
167 | else |
168 | $stderr.puts "Shutting down spec_server." |
169 | system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) && |
170 | File.delete(daemonized_server_pid) |
171 | end |
172 | end |
173 | |
174 | desc "reload spec_server." |
175 | task :restart do |
176 | unless File.exist?(daemonized_server_pid) |
177 | $stderr.puts "No server running." |
178 | else |
179 | $stderr.puts "Reloading down spec_server." |
180 | system("kill", "-s", "USR2", File.read(daemonized_server_pid).strip) |
181 | end |
182 | end |
183 | end |
184 | end |
185 | rescue LoadError |
186 | task :spec_prereq do |
187 | puts "Required dependencies RSpec, RSpec-Rails or Cucumber are missing.\nRun 'rake gems:install RAILS_ENV=test'" |
188 | end |
189 | |
190 | task :spec => :spec_prereq |
191 | namespace :spec do |
192 | %w(integration models controllers views helpers lib generators).each do |t| |
193 | task t => :spec_prereq |
194 | end |
195 | |
196 | namespace :generators do |
197 | [:extension_controller, :extension_mailer, :extension_migration, :extension_model, :extension, :instance].each do |t| |
198 | task t => :spec_prereq |
199 | end |
200 | end |
201 | |
202 | task :plugins => :spec_prereq |
203 | namespace :plugins do |
204 | task :rspec_on_rails => :spec_prereq |
205 | end |
206 | |
207 | task :statsetup => :spec_prereq |
208 | |
209 | namespace :db do |
210 | namespace :fixtures do |
211 | task :load => :spec_prereq |
212 | end |
213 | end |
214 | |
215 | namespace :server do |
216 | [:start, :stop, :restart].each do |t| |
217 | task t => :spec_prereq |
218 | end |
219 | end |
220 | end |
221 | end |