Class: MnoEnterprise::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- MnoEnterprise::Generators::InstallGenerator
- Defined in:
- lib/generators/mno_enterprise/install/install_generator.rb
Instance Method Summary collapse
- #copy_initializer ⇒ Object
- #install_factory_girl ⇒ Object
- #install_rspec_rails ⇒ Object
- #install_sprite_generator ⇒ Object
- #install_summary ⇒ Object
-
#notify_about_routes ⇒ Object
Inject engine routes.
- #setup_assets ⇒ Object
Instance Method Details
#copy_initializer ⇒ Object
15 16 17 18 19 |
# File 'lib/generators/mno_enterprise/install/install_generator.rb', line 15 def copy_initializer template "Procfile" template "config/initializers/mno_enterprise.rb" template "config/mno_enterprise_styleguide.yml" end |
#install_factory_girl ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/generators/mno_enterprise/install/install_generator.rb', line 91 def install_factory_girl unless [:skip_factory_girl] say("\n") @install_facto_girl = ask_with_default("Would you like to install factory_girl_rails?") if @install_facto_girl gem_group :test do gem "factory_girl_rails" end end end end |
#install_rspec_rails ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/generators/mno_enterprise/install/install_generator.rb', line 78 def install_rspec_rails unless [:skip_rspec] say("\n") @install_rspec = ask_with_default("Would you like to install rspec-rails?") if @install_rspec gem_group :test do gem "rspec-rails" end generate "rspec:install" end end end |
#install_sprite_generator ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/generators/mno_enterprise/install/install_generator.rb', line 64 def install_sprite_generator if (defined?(MnoEnterprise::Frontend) || Rails.env.test?) && ![:skip_sprite] say("\n") @install_sprite = ask_with_default('Would you like to install sprite-factory?') if @install_sprite gem_group :development do gem "chunky_png" gem "sprite-factory" end template "tasks/sprites.rake", "lib/tasks/sprites.rake" end end end |
#install_summary ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/generators/mno_enterprise/install/install_generator.rb', line 103 def install_summary unless [:quiet] say("\n\n") say_status("==> Maestrano Enterprise has been installed ==", nil) say("- You can generate deployment configs by running: 'rails g mno_enterprise:puma_stack'") say("- You can start the server with: 'foreman start'") if @install_sprite =~ /y/i say("\n\n") say("==> Sprite Factory has been installed") say("- Drop your icons in vendor/sprites/icons then run: 'rake assets:resprite'") say("- Add more icons folders to vendor/sprites then modify lib/tasks/sprites.rake") end say("\n\n") end end |
#notify_about_routes ⇒ Object
Inject engine routes
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/generators/mno_enterprise/install/install_generator.rb', line 43 def notify_about_routes if (routes_file = destination_path.join('config', 'routes.rb')).file? && (routes_file.read !~ %r{mount\ MnoEnterprise::Engine}) mount = %Q{ # This line mount Maestrano Enterprise routes in your application under /mnoe. # If you would like to change where this engine is mounted, simply change the :at option to something different # # We ask that you don't use the :as option here, as Mnoe relies on it being the default of "mno_enterprise" mount MnoEnterprise::Engine, at: '/mnoe', as: :mno_enterprise } inject_into_file routes_file, mount, after: "Rails.application.routes.draw do\n" end unless [:quiet] say " " say "We added the following line to your application's config/routes.rb file:" say " " say " mount MnoEnterprise::Engine, at: '/mnoe'" end end |
#setup_assets ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/generators/mno_enterprise/install/install_generator.rb', line 21 def setup_assets if defined?(MnoEnterprise::Frontend) || Rails.env.test? # JavaScript copy_file "javascripts/mno_enterprise_extensions.js", "app/assets/javascripts/mno_enterprise_extensions.js" # Stylesheets copy_file "stylesheets/main.less_erb", "app/assets/stylesheets/main.less.erb" copy_file "stylesheets/theme.less_erb", "app/assets/stylesheets/theme.less.erb" copy_file "stylesheets/variables.less", "app/assets/stylesheets/variables.less" # Require main stylesheet file inject_into_file 'app/assets/stylesheets/application.css', before: " */" do " *= require main\n" end # Disable require_tree which breaks the app gsub_file 'app/assets/stylesheets/application.css', /\*= require_tree ./, '* require_tree .' end end |