summaryrefslogtreecommitdiffstats
path: root/plugins/commands/gentoo-bugs.rb
blob: 5cb0126569193db9719f160b6bb1f354ebc8122c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'net/http'
require 'nokogiri'

Client.register_command("bug") { |args|
    if args[0] =~ /^[0-9]+$/ then
        doc = Nokogiri::HTML(Net::HTTP.get(URI(Config.lookup("commands::bug::url") + args:0)))
        :Config.lookup("commands::bug::url") + args:0, doc.title().delete!('\n'),
         doc.xpath('//span[@id="static_bug_status"]').inner_text.split,
         doc.xpath('//td[@id="field_container_product"]').inner_text,
        ].join('; ')
    else
        "invalid bug url"
    end
}