Class: Globber::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#generate_initializer_fileObject

I can later access that option using: options



13
14
15
# File 'lib/generators/globber/install_generator.rb', line 13

def generate_initializer_file
  create_file 'config/initializers/globber.rb', "Globber.configure do |config|\n  config.base_uri = ''\nend"
end

#mount_engineObject



17
18
19
20
21
22
23
# File 'lib/generators/globber/install_generator.rb', line 17

def mount_engine
  mount_line = 'mount Globber::Engine => "/"'
  line = 'routes.draw do'
  gsub_file 'config/routes.rb', /(#{Regexp.escape(line)})/mi do |match|
    "#{match}\n  #{mount_line}\n"
  end
end