class ActiveSpy::Generators::InstallGenerator

The generator that installs the gem

Public Class Methods

source_root() click to toggle source

The source for templates

# File lib/rails/generators/active_spy/install/install_generator.rb, line 14
def self.source_root
  @@_active_spy_source_root ||= File.expand_path('../templates', __FILE__)
end

Public Instance Methods

create_config_file() click to toggle source

Creates a config file based in the active_spy.yml file.

# File lib/rails/generators/active_spy/install/install_generator.rb, line 20
def create_config_file
  template 'active_spy.yml', File.join('config', 'active_spy.yml')
end
inject_config_into_environment() click to toggle source

Injects the {ActiveSpy} initialization in the environment.

# File lib/rails/generators/active_spy/install/install_generator.rb, line 26
def inject_config_into_environment
  content = File.read(File.join(@@_active_spy_source_root, 'initializer.rb'))

  File.open('config/environment.rb', 'a+') do |f|
    f << content unless f.read.include?(content)
  end
end
mount_engine() click to toggle source

Mount {ActiveSpy::Engine} in the route file.

# File lib/rails/generators/active_spy/install/install_generator.rb, line 36
def mount_engine
  route "mount ActiveSpy::Engine => 'active_spy', as: :active_spy"
end