Sha256: 96252f9ea62fadc9b74e7f2ead1fec1d4ea72a630d24620123ee568363cc7682

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

class Rafters::SourceGenerator < Rails::Generators::NamedBase
  source_root File.expand_path("../templates", __FILE__)
  argument :source_name, type: :string

  def create_directory
    empty_directory "#{base_directory}"
  end

  def create_files
    template "source.rb.erb", "#{base_directory}/#{source_file_name}_source.rb"
  end

  private

  def base_directory
    "app/components/#{file_name}/sources"
  end

  def source_file_name
    source_name.underscore
  end

  def source_class_name
    source_name.classify
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rafters-1.2.1 lib/generators/rafters/source/source_generator.rb
rafters-1.2.0 lib/generators/rafters/source/source_generator.rb