Method: ActionText::Generators::InstallGenerator#create_actiontext_files

Defined in:
actiontext/lib/generators/action_text/install/install_generator.rb

#create_actiontext_filesObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'actiontext/lib/generators/action_text/install/install_generator.rb', line 38

def create_actiontext_files
  destination = Pathname(destination_root)

  template "actiontext.css", "app/assets/stylesheets/actiontext.css"

  unless destination.join("app/assets/application.css").exist?
    if (stylesheets = Dir.glob "#{destination_root}/app/assets/stylesheets/application.*.{scss,css}").length > 0
      insert_into_file stylesheets.first.to_s, %(@import 'actiontext.css';)
    else
      say "        To use the Trix editor, you must require 'app/assets/stylesheets/actiontext.css' in your base stylesheet.\n      INSTRUCTIONS\n    end\n  end\n\n  gem_root = \"\#{__dir__}/../../../..\"\n\n  copy_file \"\#{gem_root}/app/views/active_storage/blobs/_blob.html.erb\",\n    \"app/views/active_storage/blobs/_blob.html.erb\"\n\n  copy_file \"\#{gem_root}/app/views/layouts/action_text/contents/_content.html.erb\",\n    \"app/views/layouts/action_text/contents/_content.html.erb\"\nend\n", :green