Sha256: d3e2fdc02a45e7d2f3d3c63c2ccc9d52a6c2f66b58fff18b212e40b6b5d02798

Contents?: true

Size: 626 Bytes

Versions: 42

Compression:

Stored size: 626 Bytes

Contents

require 'fileutils'

module Octopolo
  class Changelog
    attr_reader :filename

    def initialize(filename="CHANGELOG.markdown")
      @filename = filename
    end

    def readlines
      File.readlines(@filename)
    end

    def open
      FileUtils.touch(@filename) unless File.exists?(@filename)
      File.copy_stream(@filename,'old_changelog')
      File.open('old_changelog', 'r') do |old_changelog|
        File.open(@filename, 'w') do |changelog|
          yield changelog
          old_changelog.each_line { |line| changelog.puts line }
        end
      end
      File.delete('old_changelog')
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
octopolo-0.0.2 lib/octopolo/changelog.rb
octopolo-0.0.1 lib/octopolo/changelog.rb