lib/tasks/layouts_extension_tasks.rake in radiant-layouts-extension-0.9.1 vs lib/tasks/layouts_extension_tasks.rake in radiant-layouts-extension-1.0.0
- old
+ new
@@ -1,18 +1,40 @@
namespace :radiant do
namespace :extensions do
namespace :layouts do
- desc "Runs the migration of the Shop Products extension and its dependancies"
+ desc "Runs the migration of the Layouts extension"
task :migrate => :environment do
- puts "radiant:layouts:migrate - Nohing to do"
+ require 'radiant/extension_migrator'
+ if ENV["VERSION"]
+ LayoutsExtension.migrator.migrate(ENV["VERSION"].to_i)
+ Rake::Task['db:schema:dump'].invoke
+ else
+ LayoutsExtension.migrator.migrate
+ Rake::Task['db:schema:dump'].invoke
+ end
end
- desc "Copies public assets of the Shop Products to the instance public/ directory."
+ desc "Copies public assets of the Layouts to the instance public/ directory."
task :update => :environment do
- puts "radiant:layouts:update - Nohing to do"
- end
+ is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
+ puts "Copying assets from LayoutsExtension"
+ Dir[LayoutsExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
+ path = file.sub(LayoutsExtension.root, '')
+ directory = File.dirname(path)
+ mkdir_p RAILS_ROOT + directory, :verbose => false
+ cp file, RAILS_ROOT + path, :verbose => false
+ end
+ unless LayoutsExtension.root.starts_with? RAILS_ROOT # don't need to copy vendored tasks
+ puts "Copying rake tasks from LayoutsExtension"
+ local_tasks_path = File.join(RAILS_ROOT, %w(lib tasks))
+ mkdir_p local_tasks_path, :verbose => false
+ Dir[File.join LayoutsExtension.root, %w(lib tasks *.rake)].each do |file|
+ cp file, local_tasks_path, :verbose => false
+ end
+ end
+ end
desc "Syncs all available translations for this ext to the English ext master"
task :sync => :environment do
# The main translation root, basically where English is kept
language_root = LayoutsExtension.root + "/config/locales"
@@ -26,9 +48,8 @@
words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
TranslationSupport.write_file(filename, basename, comments, other)
end
end
-
end
end
end