Sha256: 5ba1e19937911dab9e43683ae8c234f55f56df36d8b35ea9c0515f568a9a69eb
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
require 'fileutils' module Codelog module Command module Step class Changelog include FileUtils def self.run Codelog::Command::Step::Changelog.new.run end def run chdir Dir.pwd do create_file_from changes end end private def changes version_changelogs = Dir['changelogs/releases/*.md'] version_changelogs.sort_by! do |file_name| version_number = file_name.split('/').last.chomp('.md') Gem::Version.new(version_number) end.reverse! version_changelogs.inject([]) do |partial_changes, version_changelog| partial_changes + File.readlines(version_changelog) end end def create_file_from(changes) File.open('CHANGELOG.md', 'w+') do |f| f.puts %(# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ) f.puts(changes) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
codelog-0.2.3 | lib/codelog/command/step/changelog.rb |
codelog-0.2.2 | lib/codelog/command/step/changelog.rb |