Sha256: e891a3f3b62ee8c74e0bdefdb45f5f9c63cf84cf9ab40dd41a9a4595619dba57

Contents?: true

Size: 829 Bytes

Versions: 2

Compression:

Stored size: 829 Bytes

Contents

module AdAgency
  class PrintShop
    
    def self.get_version
      File.readlines("VERSION").first.chomp
    end
    
    def self.history_file?
      File.exist?("History.txt")
    end
    
    def self.history_lines
      File.readlines("History.txt")
    end
      
    def self.print_ad(spec, outfile=STDOUT)
      version = get_version
      maj_min = version[/^\d+\.\d+/]
      outfile.puts "Announcing #{spec.name} version #{version}"
      outfile.puts spec.summary
      outfile.puts
      outfile.puts spec.description
      outfile.puts
      if history_file?
        outfile.puts "Changes:"
        outfile.puts
        history_lines.each do |line|
          if line =~ /^=+\s+v?(\d+\.\d+)\./
            break unless $1 == maj_min
          end
          outfile.puts line
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ad_agency-0.1.2 lib/ad_agency/print_shop.rb
ad_agency-0.1.1 lib/ad_agency/print_shop.rb