Rakefile in rgl-0.5.0 vs Rakefile in rgl-0.5.1

- old
+ new

@@ -4,33 +4,19 @@ require 'bundler/setup' require 'rubygems/package_task' require 'rake/testtask' -require 'rdoc/task' require 'yard' $:.unshift File.join(File.dirname(__FILE__), 'lib') require 'rgl/base' # require base module to get RGL_VERSION SUMMARY = "Ruby Graph Library" SOURCES = FileList['lib/**/*.rb'] -RDOC_DIR = './rgl' -# The location for published documents to be copied. -remote_user = ENV['REMOTE_USER'] || '' -remote_host = ENV['REMOTE_HOST'] || 'github.org' -remote_path = ENV['REMOTE_PATH'] || 'FIXME' -remote_path += '/' unless remote_path[-1, 1] == '/' -REMOTE_RDOC_DIR = remote_path -REMOTE_RDOC_DIR.insert( - 0, - remote_user + (remote_user.empty? ? '' : '@') + remote_host + ':' -) unless remote_host.empty? - # The default task is run if rake is given no explicit arguments. - desc "Default Task" task :default => :test # Define a test task. @@ -61,20 +47,10 @@ puts "Committing and tagging version #{RGL_VERSION}" `git commit -am 'Version #{RGL_VERSION}'` `git tag 'v#{RGL_VERSION}'` end -# Tasks for generating docs. - -Rake::RDocTask.new("rdoc") do |rdoc| - rdoc.rdoc_dir = RDOC_DIR - rdoc.template = 'doc/jamis.rb' - rdoc.title = SUMMARY - rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README.rdoc' - rdoc.rdoc_files.include(SOURCES, 'README.rdoc', 'ChangeLog', 'examples/examples.rb', 'rakelib/*.rake') -end - YARD::Rake::YardocTask.new # Tasks for building and installing RGL gem. Bundler::GemHelper.install_tasks @@ -121,6 +97,34 @@ show_line(fn, lines, codelines) total_lines += lines total_code += codelines end show_line("TOTAL", total_lines, total_code) +end + +# simple rake task to output a changelog between two commits, tags ... +# output is formatted simply, commits are grouped under each author name +# +desc "generate changelog with nice clean output" +task :changelog, :since_c, :until_c do |t,args| + since_c = args[:since_c] || `git tag | tail -1`.chomp + until_c = args[:until_c] + cmd=`git log --pretty='format:%ci::%an <%ae>::%s::%H' #{since_c}..#{until_c}` + + entries = Hash.new + changelog_content = String.new + + cmd.split("\n").each do |entry| + date, author, subject, hash = entry.chomp.split("::") + entries[author] = Array.new unless entries[author] + day = date.split(" ").first + entries[author] << "#{subject} (#{hash[0..5]})" unless subject =~ /Merge/ + end + + # generate clean output + entries.keys.each do |author| + changelog_content += author + "\n" + entries[author].reverse.each { |entry| changelog_content += " * #{entry}\n" } + end + + puts changelog_content end