Sha256: 253399a01b4d0e53d6837d4ef55e73d936f23781e5cbc5df899d2078315968bd

Contents?: true

Size: 838 Bytes

Versions: 5

Compression:

Stored size: 838 Bytes

Contents

require "erb"

# NOTE pbmenvで参照しているクラス
# 後方互換を維持するために、パラメータの削除・必須をしてはいけない
class AppGenerator
  attr_reader :prefix_path

  # @param [String] prefix_path
  # @param [Boolean] enable_integration_with_pbm_cloud
  def initialize(prefix_path: , enable_integration_with_pbm_cloud: )
    @prefix_path = prefix_path
    @enable_integration_with_pbm_cloud = enable_integration_with_pbm_cloud
  end

  def generate
    erb = File.read(template_path)
    enable_integration_with_pbm_cloud = @enable_integration_with_pbm_cloud
    app_rb = ERB.new(erb, nil, '-').result(binding)
    File.write(output_path, app_rb)
  end

  private

  def template_path
    File.join(prefix_path, "app.rb.erb")
  end

  def output_path
    File.join(prefix_path, "app.rb")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.2 project_template/lib/app_generator.rb
procon_bypass_man-0.3.1 project_template/lib/app_generator.rb
procon_bypass_man-0.3.0 project_template/lib/app_generator.rb
procon_bypass_man-0.2.3 project_template/lib/app_generator.rb
procon_bypass_man-0.2.2 project_template/lib/app_generator.rb