Sha256: 13c564a45bf4a2ffb7ba76ba0f3b94967f1d835a3dd3ce5e432f758ee3d52ecc

Contents?: true

Size: 1.66 KB

Versions: 14

Compression:

Stored size: 1.66 KB

Contents

COMMONTATOR_COPY_TASKS = ['config/locales', 'app/assets/images',
                          'app/assets/stylesheets', 'app/views', 'app/mailers',
                          'app/helpers', 'app/controllers', 'app/models']

namespace :commontator do
  namespace :install do
    desc "Copy initializers from commontator to application"
    task :initializers do
      Dir.glob(File.expand_path('../../../config/initializers/*.rb', __FILE__)) do |file|
        if File.exists?(File.expand_path(File.basename(file), 'config/initializers'))
          print "NOTE: Initializer #{File.basename(file)} from commontator has been skipped. Initializer with the same name already exists.\n"
        else
          cp file, 'config/initializers', :verbose => false
          print "Copied initializer #{File.basename(file)} from commontator\n"
        end
      end
    end
  end
  
  namespace :copy do
    COMMONTATOR_COPY_TASKS.each do |path|
      name = File.basename(path)
      desc "Copy #{name} from commontator to application"
      task name.to_sym do
        cp_r File.expand_path("../../../#{path}/commontator", __FILE__),
             path, :verbose => false
        print "Copied #{name} from commontator\n"
      end
    end
  end
  
  desc "Copy initializers and migrations from commontator to application"
  task :install do
    Rake::Task["commontator:install:initializers"].invoke
    Rake::Task["commontator:install:migrations"].invoke
  end
  
  desc "Copy assets, views, mailers, helpers, controllers and models from commontator to application"
  task :copy do
    COMMONTATOR_COPY_TASKS.each do |path|
      Rake::Task["commontator:copy:#{File.basename(path)}"].invoke
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
commontator-4.11.0 lib/tasks/commontator_tasks.rake
commontator-4.10.5 lib/tasks/commontator_tasks.rake
commontator-4.10.4 lib/tasks/commontator_tasks.rake
commontator-4.10.3 lib/tasks/commontator_tasks.rake
commontator-4.10.2 lib/tasks/commontator_tasks.rake
commontator-4.10.1 lib/tasks/commontator_tasks.rake
commontator-4.10.0 lib/tasks/commontator_tasks.rake
commontator-4.9.0 lib/tasks/commontator_tasks.rake
commontator-4.5.4 lib/tasks/commontator_tasks.rake
commontator-4.5.3 lib/tasks/commontator_tasks.rake
commontator-4.5.2 lib/tasks/commontator_tasks.rake
commontator-4.5.1 lib/tasks/commontator_tasks.rake
commontator-4.5.0 lib/tasks/commontator_tasks.rake
commontator-4.4.1 lib/tasks/commontator_tasks.rake