lib/ad_agency.rb in ad_agency-0.1.0 vs lib/ad_agency.rb in ad_agency-0.1.1

- old
+ new

@@ -1,9 +1,15 @@ require 'rake' require 'rake/tasklib' require 'jeweler' +module AdAgency +end + +require 'lib/ad_agency/print_shop' +require 'lib/ad_agency/history' + class Jeweler # Rake tasks for announcing a Jeweler gem. # # Jeweler::Tasks.new needs to be used before this. # @@ -19,29 +25,19 @@ self.jeweler = Rake.application.jeweler define end def define - namespace :advertize do + namespace :advertise do desc "generate an announcement email body" task :email_body do - spec = jeweler.gemspec - version = File.readlines("VERSION").first.chomp - maj_min = version[/^\d+\.\d+/] - puts "Announcing #{spec.name} version #{version}" - puts spec.summary - puts - puts spec.description - puts - if File.exist?("History.txt") - puts "Changes:" - puts - File.readlines("History.txt").each do |line| - if line =~ /^=+\s+(\d+\.\d+)\./ - break unless $1 == maj_min - end - puts line - end + AdAgency::PrintShop.print_ad(jeweler.gemspec) + end + + desc "generate History.txt from the git log" + task :gen_history do + File.open(File.expand_path(File.dirname(__FILE__) + "../../History.txt"), 'w') do |hist_file| + AdAgency::History.new.generate(hist_file) end end end end end