2 namespace :extensions do
3 namespace :<%= file_name %> do
5 desc "Runs the migration of the <%= extension_name %> extension"
6 task :migrate => :environment do
7 require 'radiant/extension_migrator'
9 <%= class_name %>.migrator.migrate(ENV["VERSION"].to_i)
11 <%= class_name %>.migrator.migrate
15 desc "Copies public assets of the <%= extension_name %> to the instance public/ directory."
16 task :update => :environment do
17 is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
18 Dir[<%= class_name %>.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
19 path = file.sub(<%= class_name %>.root, '')
20 directory = File.dirname(path)
21 puts "Copying #{path}..."
22 mkdir_p RAILS_ROOT + directory
23 cp file, RAILS_ROOT + path