Class: StandardSingpass::Generators::InstallGenerator

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

Overview

Installs StandardSingpass in a host Rails application.

Writes the initializer at ‘config/initializers/standard_singpass.rb` with the full configuration surface commented out so consumers know what’s available without being forced to wire everything up front.

Idempotent: re-running the generator skips an existing initializer unless ‘–force` is passed.

Instance Method Summary collapse

Instance Method Details

#copy_initializerObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/generators/standard_singpass/install/install_generator.rb', line 33

def copy_initializer
  initializer_path = "config/initializers/standard_singpass.rb"

  if File.exist?(File.join(destination_root, initializer_path)) && !options[:force]
    say_status("identical", "#{initializer_path} (already exists; pass --force to overwrite)", :blue)
    return
  end

  template "initializer.rb.erb", initializer_path, force: options[:force]
end