1 require 'rake/testtask'
5 desc "Run all Radiant extension migrations"
6 task :extensions => :environment do
7 require 'radiant/extension_migrator'
8 MerbRadiant::ExtensionMigrator.migrate_extensions
11 namespace :remigrate do
12 desc "Migrate down and back up all Radiant extension migrations"
13 task :extensions => :environment do
14 require 'highline/import'
15 if agree("This task will destroy any data stored by extensions in the database. Are you sure you want to \ncontinue? [yn] ")
16 require 'radiant/extension_migrator'
17 MerbRadiant::Extension.descendants.map(&:migrator).each {|m| m.migrate(0) }
18 Rake::Task['db:migrate:extensions'].invoke
25 desc "Runs tests on all available Radiant extensions, pass EXT=extension_name to test a single extension"
26 task :extensions => "db:test:prepare" do
27 extension_roots = MerbRadiant::Extension.descendants.map(&:root)
29 extension_roots = extension_roots.select {|x| /\/(\d+_)?#{ENV["EXT"]}$/ === x }
30 if extension_roots.empty?
31 puts "Sorry, that extension is not installed."
34 extension_roots.each do |directory|
35 if File.directory?(File.join(directory, 'test'))
37 if RUBY_PLATFORM =~ /win32/
38 system "rake.cmd test MERB_RADIANT_ENV_FILE=#{RAILS_ROOT}/config/environment"
40 system "rake test MERB_RADIANT_ENV_FILE=#{RAILS_ROOT}/config/environment"
49 desc "Runs specs on all available Radiant extensions, pass EXT=extension_name to test a single extension"
50 task :extensions => "db:test:prepare" do
51 extension_roots = MerbRadiant::Extension.descendants.map(&:root)
53 extension_roots = extension_roots.select {|x| /\/(\d+_)?#{ENV["EXT"]}$/ === x }
54 if extension_roots.empty?
55 puts "Sorry, that extension is not installed."
58 extension_roots.each do |directory|
59 if File.directory?(File.join(directory, 'spec'))
61 if RUBY_PLATFORM =~ /win32/
62 system "rake.cmd spec MERB_RADIANT_ENV_FILE=#{RAILS_ROOT}/config/environment"
64 system "rake spec MERB_RADIANT_ENV_FILE=#{RAILS_ROOT}/config/environment"
72 # Load any custom rakefiles from extensions
73 [Merb.root, MERB_RADIANT_ROOT].uniq.each do |root|
74 Dir[root + '/vendor/extensions/**/tasks/**/*.rake'].sort.each { |ext| load ext }