diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2018-06-27 16:20:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-27 16:20:58 +0200 |
commit | b430ba4754f59934acb4806c83d10dee5af8de9e (patch) | |
tree | 1d7482d313f05a800f63a3a490293c9593b2a6a2 /lib/tasks | |
parent | a4af9580d604221ec36d2cd5671eb7f256ae5173 (diff) | |
parent | 60050ee41275eda25601beaa453e26841511d492 (diff) | |
download | rails-b430ba4754f59934acb4806c83d10dee5af8de9e.tar.gz rails-b430ba4754f59934acb4806c83d10dee5af8de9e.tar.bz2 rails-b430ba4754f59934acb4806c83d10dee5af8de9e.zip |
Merge pull request #1 from basecamp/separate-rich-text-record
Separate Rich Text record
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/actiontext.rake | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/tasks/actiontext.rake b/lib/tasks/actiontext.rake new file mode 100644 index 0000000000..817a4c67f0 --- /dev/null +++ b/lib/tasks/actiontext.rake @@ -0,0 +1,28 @@ +# 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: %i( environment copy_migration copy_stylesheet ) + + 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 +end |