Sha256: da2ff0c92e1b4efecf2bd4ca981dab31aea87fd57b4ad5d35c361c8cabb8aa6b

Contents?: true

Size: 676 Bytes

Versions: 2

Compression:

Stored size: 676 Bytes

Contents

class PowerApi::VersionGenerator < Rails::Generators::NamedBase
  source_root File.expand_path('templates', __dir__)

  def modify_routes
    insert_into_file(
      helper.routes_path,
      after: helper.routes_line_to_inject_new_version
    ) do
      helper.version_route_tpl
    end

    helper.format_ruby_file(helper.routes_path)
  end

  def add_base_controller
    create_file(
      helper.version_base_controller_path,
      helper.version_base_controller_tpl
    )
  end

  def add_serializers_directory
    create_file(helper.ams_serializers_path)
  end

  private

  def helper
    @helper ||= PowerApi::GeneratorHelpers.new(version_number: file_name)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
power_api-2.1.1 lib/generators/power_api/version/version_generator.rb
power_api-2.1.0 lib/generators/power_api/version/version_generator.rb