Sha256: 30635c4dc3ac02cdcc1a591e62e69ca325909b6d38395b0cf6a752bb0fdcdb0b

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 Bytes

Contents

class YamlConfigFileGenerator < Rails::Generators::NamedBase
  
  source_root File.expand_path('../templates', __FILE__)
  
  class_option :skip_yaml_file, :type => :boolean, :default => false, :description => "Skip generation of the YAML file"
  class_option :skip_initializer, :type => :boolean, :default => false, :description => "Skip generation of the initializer"  
  
  def yaml_config_file
    template "config_file.yml", "config/#{gen_file_name}.yml" unless options.skip_yaml_file?
    template "config_file.rb", "config/initializers/#{gen_file_name}.rb" unless options.skip_initializer?
  end
  
  private
  def gen_file_name
    file_name.underscore
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yaml_config_file-0.2.0 lib/generators/yaml_config_file/yaml_config_file_generator.rb