Class: FlexibleAdmin::CkeditorGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- FlexibleAdmin::CkeditorGenerator
- Defined in:
- lib/generators/flexible_admin/ckeditor_generator.rb
Instance Method Summary collapse
- #install_gem ⇒ Object
- #instructions ⇒ Object
- #run_generator ⇒ Object
- #set_paperclip_settings_for_s3 ⇒ Object
Instance Method Details
#install_gem ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/flexible_admin/ckeditor_generator.rb', line 13 def install_gem append_file "Gemfile", "\n", :force => true gem "ckeditor", "~> 3.6.3" gem "paperclip" gem 'aws-s3', :require => 'aws/s3' inside Rails.root do run "bundle install" end end |
#instructions ⇒ Object
36 37 38 39 |
# File 'lib/generators/flexible_admin/ckeditor_generator.rb', line 36 def instructions say "you now need to run 'rake db:migrate' to create the ckeditor tables", :blue say "the pictures/attachments for ckeditor assume an amazon_s3 config file at config/amazon_s3.yml. Add that file OR change the settings at app/models/ckeditor/picture.rb & app/models/ckeditor/attachment_file.rb", :blue end |
#run_generator ⇒ Object
24 25 26 27 |
# File 'lib/generators/flexible_admin/ckeditor_generator.rb', line 24 def run_generator generate "ckeditor:install" generate "ckeditor:models --orm=active_record --backend=paperclip" end |
#set_paperclip_settings_for_s3 ⇒ Object
29 30 31 32 33 34 |
# File 'lib/generators/flexible_admin/ckeditor_generator.rb', line 29 def set_paperclip_settings_for_s3 remove_file 'app/models/ckeditor/picture.rb' remove_file 'app/models/ckeditor/attachment_file.rb' template "ckeditor/picture.rb", "app/models/ckeditor/picture.rb" template "ckeditor/attachment_file.rb", "app/models/ckeditor/attachment_file.rb" end |