class Anyway::Generators::ConfigGenerator

Public Instance Methods

create_config() click to toggle source
# File lib/generators/anyway/config/config_generator.rb, line 21
def create_config
  template "config.rb", File.join(config_root, class_path, "#{file_name}_config.rb")
end
create_yml() click to toggle source
# File lib/generators/anyway/config/config_generator.rb, line 25
def create_yml
  create_yml = options.fetch(:yml) { yes?("Would you like to generate a #{file_name}.yml file?") }
  return unless create_yml
  template "config.yml", File.join("config", "#{file_name}.yml")
end
run_install_if_needed() click to toggle source

check_class_collision suffix: “Config”

# File lib/generators/anyway/config/config_generator.rb, line 16
def run_install_if_needed
  return if ::Rails.root.join(static_config_root, "application_config.rb").exist?
  generate "anyway:install"
end

Private Instance Methods

config_root() click to toggle source
# File lib/generators/anyway/config/config_generator.rb, line 37
def config_root
  if options[:app]
    "app/configs"
  else
    static_config_root
  end
end
needs_config_name?() click to toggle source
# File lib/generators/anyway/config/config_generator.rb, line 45
def needs_config_name?
  raise "No longer needed" if Gem::Version.new(Anyway::VERSION) >= Gem::Version.new("3.0.0")
  file_name.include?("_")
end
static_config_root() click to toggle source
# File lib/generators/anyway/config/config_generator.rb, line 33
def static_config_root
  Anyway::Settings.autoload_static_config_path || Anyway::DEFAULT_CONFIGS_PATH
end