CHips L MINI SHELL

CHips L pro

Current Path : /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/doc/
Upload File :
Current File : //opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/did_you_mean-1.2.0/doc/changelog_generator.rb

require 'octokit'
require 'reverse_markdown'
require 'erb'

class ChangeLogGenerator
  attr :repository, :template_path, :changelog_path

  def initialize(repository, template_path: "CHANGELOG.md.erb", changelog_path: "CHANGELOG.md")
    @repository     = repository
    @template_path  = template_path
    @changelog_path = changelog_path
  end

  def generate_and_save!
    changelog_in_md   = ERB.new(template).result(binding)
    changelog_in_html = Octokit.markdown(changelog_in_md, context: repository, mode: "gfm")

    File.open(changelog_path, 'w') do |file|
      file.write ReverseMarkdown.convert(changelog_in_html, github_flavored: true)
    end
  end

  private

  def template
    open("#{__dir__}/#{template_path}").read
  end

  def releases
    @releases ||= Octokit.releases(repository)
  end
end

ChangeLogGenerator.new("yuki24/did_you_mean").generate_and_save!

Copyright 2K16 - 2K18 Indonesian Hacker Rulez