class Rails::Command::EnvCredentialsCommand

Public Instance Methods

edit() click to toggle source
Calls superclass method
# File lib/rails/commands/env_credentials_command.rb, line 24
def edit
  set_credentials_env_from_argument!
  super
end
show() click to toggle source
Calls superclass method
# File lib/rails/commands/env_credentials_command.rb, line 29
def show
  set_credentials_env_from_argument!
  super
end

Private Instance Methods

credentials_generator() click to toggle source
# File lib/rails/commands/env_credentials_command.rb, line 57
def credentials_generator
  require "rails/generators"
  require "rails/generators/rails/credentials/credentials_generator"

  Rails::Generators::CredentialsGenerator.prepend(RailsEnvCredentials::CredentialsOverwrite)
  Rails::Generators::CredentialsGenerator.new
end
master_key_generator() click to toggle source
# File lib/rails/commands/env_credentials_command.rb, line 48
def master_key_generator
  require "rails/generators"
  require "rails/generators/rails/master_key/master_key_generator"

  key_path = RailsEnvCredentials.options[:key_path]
  Rails::Generators::MasterKeyGenerator.const_set!(:MASTER_KEY_PATH, Pathname.new(key_path))
  Rails::Generators::MasterKeyGenerator.new
end
set_credentials_env_from_argument!() click to toggle source
# File lib/rails/commands/env_credentials_command.rb, line 36
def set_credentials_env_from_argument!
  extract_environment_option_from_argument

  if options.file
    RailsEnvCredentials.config_path = options.file
  elsif available_environments.include?(options.environment)
    RailsEnvCredentials.env = options[:environment]
  else
    raise "'#{options.environment}' environment is not found. Available: #{available_environments}"
  end
end