Sha256: 5dea91a8a1ea5e969b489b42a7d90d6957f83f072ea2602b0d2cb561275c03cd

Contents?: true

Size: 1.98 KB

Versions: 174

Compression:

Stored size: 1.98 KB

Contents

namespace :radiant do
  namespace :extensions do
    namespace :<%= file_name %> do

      desc "Runs the migration of the <%= extension_name %> extension"
      task :migrate => :environment do
        require 'trusty_cms/extension_migrator'
        if ENV["VERSION"]
          <%= class_name %>.migrator.migrate(ENV["VERSION"].to_i)
          Rake::Task['db:schema:dump'].invoke
        else
          <%= class_name %>.migrator.migrate
          Rake::Task['db:schema:dump'].invoke
        end
      end

      desc "Copies public assets of the <%= extension_name %> to the instance public/ directory."
      task :update => :environment do
        is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
        puts "Copying assets from <%= class_name %>"
        Dir[<%= class_name %>.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
          path = file.sub(<%= class_name %>.root, '')
          directory = File.dirname(path)
          mkdir_p Rails.root + directory, :verbose => false
          cp file, Rails.root + path, :verbose => false
        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 = <%= class_name %>.root + "/config/locales"
        words = TranslationSupport.get_translation_keys(language_root)

        Dir["#{language_root}/*.yml"].each do |filename|
          next if filename.match('_available_tags')
          basename = File.basename(filename, '.yml')
          puts "Syncing #{basename}"
          (comments, other) = TranslationSupport.read_file(filename, basename)
          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

Version data entries

174 entries across 174 versions & 1 rubygems

Version Path
trusty-cms-3.3.7 lib/generators/extension/templates/tasks.rake
trusty-cms-3.3.6 lib/generators/extension/templates/tasks.rake
trusty-cms-3.3.5 lib/generators/extension/templates/tasks.rake
trusty-cms-3.3.3 lib/generators/extension/templates/tasks.rake
trusty-cms-3.3.2 lib/generators/extension/templates/tasks.rake
trusty-cms-3.3.1 lib/generators/extension/templates/tasks.rake
trusty-cms-3.2.1 lib/generators/extension/templates/tasks.rake
trusty-cms-3.3.0 lib/generators/extension/templates/tasks.rake
trusty-cms-3.2.0 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.11 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.10 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.9 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.8 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.7 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.6 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.5 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.3 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.2 lib/generators/extension/templates/tasks.rake
trusty-cms-3.0.11 lib/generators/extension/templates/tasks.rake
trusty-cms-3.1.1 lib/generators/extension/templates/tasks.rake