Class: Faalis::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Faalis::Generators::InstallGenerator
- Defined in:
- lib/generators/faalis/install_generator.rb
Overview
Generator responsible for ‘install` generator
Instance Method Summary collapse
- #add_gems ⇒ Object
- #append_assets_to_compile ⇒ Object
- #assets_manifests_initializer ⇒ Object
- #configure_kaminari ⇒ Object
- #copy_init_files ⇒ Object
- #copy_js_manifest ⇒ Object
- #copy_migrations ⇒ Object
-
#copy_scss_manifest ⇒ Object
def grunt_file template ‘i18n/Gruntfile.js.erb’, ‘lib/tasks/grunt/Gruntfile.js’ end.
- #install_formtastic ⇒ Object
- #install_model_discovery ⇒ Object
- #install_routes ⇒ Object
- #patch_application_controller ⇒ Object
- #patch_formtastic ⇒ Object
- #patch_seed ⇒ Object
- #show_readme ⇒ Object
Instance Method Details
#add_gems ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/generators/faalis/install_generator.rb', line 95 def add_gems gem 'jquery-turbolinks' inside Rails.root do run 'bundle update' end end |
#append_assets_to_compile ⇒ Object
103 104 105 106 107 |
# File 'lib/generators/faalis/install_generator.rb', line 103 def append_assets_to_compile append_to_file 'config/initializers/assets.rb' do "Rails.application.config.assets.precompile += %w( dashboard/rtl/application.css dashboard/ltr/application.css)" end end |
#assets_manifests_initializer ⇒ Object
85 86 87 88 89 |
# File 'lib/generators/faalis/install_generator.rb', line 85 def assets_manifests_initializer initializer 'faalis_assets.rb' do 'Rails.application.config.assets.precompile += %w( faalis/simple.js )' end end |
#configure_kaminari ⇒ Object
61 62 63 |
# File 'lib/generators/faalis/install_generator.rb', line 61 def configure_kaminari generate 'kaminari:config' end |
#copy_init_files ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/generators/faalis/install_generator.rb', line 37 def copy_init_files template 'devise.rb', 'config/initializers/devise.rb' template 'faalis.rb', 'config/initializers/faalis.rb' template 'api_controller.rb', 'app/controllers/api_controller.rb' template 'dashboard_controller.rb', 'app/controllers/dashboard/application_controller.rb' template 'policy/application_policy.rb', 'app/policies/application_policy.rb' end |
#copy_js_manifest ⇒ Object
51 52 53 54 |
# File 'lib/generators/faalis/install_generator.rb', line 51 def copy_js_manifest empty_directory 'app/assets/javascripts/dashboard' directory 'javascripts', 'app/assets/javascripts/dashboard' end |
#copy_migrations ⇒ Object
29 30 31 |
# File 'lib/generators/faalis/install_generator.rb', line 29 def copy_migrations rake('faalis:install:migrations') unless [:mongoid] end |
#copy_scss_manifest ⇒ Object
def grunt_file
template 'i18n/Gruntfile.js.erb', 'lib/tasks/grunt/Gruntfile.js'
end
69 70 71 |
# File 'lib/generators/faalis/install_generator.rb', line 69 def copy_scss_manifest directory 'stylesheets', 'app/assets/stylesheets' end |
#install_formtastic ⇒ Object
57 58 59 |
# File 'lib/generators/faalis/install_generator.rb', line 57 def install_formtastic generate 'formtastic:install' end |
#install_model_discovery ⇒ Object
33 34 35 |
# File 'lib/generators/faalis/install_generator.rb', line 33 def install_model_discovery rake 'model_discovery_engine:install:migrations' end |
#install_routes ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/generators/faalis/install_generator.rb', line 73 def install_routes route "end\n" route ' # Your dashboard routes goes here.' route "in_dashboard do" route "end\n" route ' # Your API routes goes here.' route 'api_routes do' route "mount Faalis::Engine => '/'\n" end |
#patch_application_controller ⇒ Object
91 92 93 |
# File 'lib/generators/faalis/install_generator.rb', line 91 def patch_application_controller inject_into_class "app/controllers/application_controller.rb", ApplicationController, " extend Faalis::I18n::Locale\n" end |
#patch_formtastic ⇒ Object
109 110 111 112 113 |
# File 'lib/generators/faalis/install_generator.rb', line 109 def patch_formtastic append_to_file 'config/initializers/formtastic.rb' do 'Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder' end end |
#patch_seed ⇒ Object
45 46 47 48 49 |
# File 'lib/generators/faalis/install_generator.rb', line 45 def patch_seed prepend_to_file 'db/seeds.rb' do "Faalis::Engine.load_seed\n" end end |
#show_readme ⇒ Object
115 116 117 |
# File 'lib/generators/faalis/install_generator.rb', line 115 def show_readme readme 'README' if behavior == :invoke end |