Class: Virgo::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/virgo/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#app_has_engine_route?Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/generators/virgo/install/install_generator.rb', line 11

def app_has_engine_route?
  route_contents = File.read("#{Rails.root}/config/routes.rb")
  route_contents.include?("Virgo::Engine")
end

#run_installObject



3
4
5
6
7
8
9
# File 'lib/generators/virgo/install/install_generator.rb', line 3

def run_install
  unless app_has_engine_route?
    route "mount Virgo::Engine => \"/\""
  end

  generate "virgo:views"
end