Search
j0ke.net Open Build Service
>
Projects
>
devel
:
tools
:
building
>
hudson
> dump-changelog.rb
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File dump-changelog.rb of Package hudson
#!/usr/bin/env ruby require 'rubygems' require 'hpricot' require 'active_support' require 'open-uri' def wrap_text(txt, col = 75) txt.gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/, "\\1\\3\n") end # load the RedHanded home page file = open("https://hudson.dev.java.net/changelog.html") #puts file.read doc = Hpricot(file) from = ARGV[0] to = ARGV[1] current = 0 first = true doc.search("*").each do |element| if first puts else end first = false if element.elem? if element.name == "a" and element.attributes["name"] =~ /v1\.(\d+)/ #puts element.methods.sort #puts "link! #{$1}" current = $1 next if current > to break if current < from end if element.name == "ul" element.search("li") do |item| line = " * #{item.to_plain_text.squish}" ['issue', 'report', 'discussion'].each do |key| line.gsub!(" (#{key}", "\n (#{key}") end puts line end end end end exit (from..to).each do |i| doc.search("//li/preceding-sibling::a[@name='v1.#{i}']").each do |release| puts "Release #{i}" puts release.to_s release.search("li").each do |item| puts item.to_s end end end