1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/lib/tasks/actiontext.rake

42 lines
1.4 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
namespace :action_text do
# Prevent migration installation task from showing up twice.
Rake::Task["install:migrations"].clear_comments
desc "Copy over the migration, stylesheet, and JavaScript files"
task install: %w( environment copy_migration copy_stylesheet copy_fixtures active_storage:install )
task :copy_migration do
if Rake::Task.task_defined?("action_text:install:migrations")
Rake::Task["action_text:install:migrations"].invoke
else
Rake::Task["app:action_text:install:migrations"].invoke
end
end
STYLESHEET_TEMPLATE_PATH = File.expand_path("../templates/actiontext.css", __dir__)
STYLESHEET_APP_PATH = Rails.root.join("app/assets/stylesheets/actiontext.css")
task :copy_stylesheet do
if File.exist?(STYLESHEET_APP_PATH)
puts "Won't copy Action Text stylesheet as it already exists"
else
FileUtils.cp STYLESHEET_TEMPLATE_PATH, STYLESHEET_APP_PATH
end
end
2018-09-12 19:22:40 -04:00
FIXTURE_TEMPLATE_PATH = File.expand_path("../templates/fixtures.yml", __dir__)
FIXTURE_APP_DIR_PATH = Rails.root.join("test/fixtures/action_text")
2018-09-12 19:24:20 -04:00
FIXTURE_APP_PATH = FIXTURE_APP_DIR_PATH.join("rich_texts.yml")
2018-09-12 19:22:40 -04:00
task :copy_fixtures do
if File.exist?(FIXTURE_APP_PATH)
puts "Won't copy Action Text fixtures as it already exists"
else
FileUtils.mkdir FIXTURE_APP_DIR_PATH
FileUtils.cp FIXTURE_TEMPLATE_PATH, FIXTURE_APP_PATH
end
end
end