repost/plugins/commands/gentoo-bugs.rb

16 lines
489 B
Ruby
Raw Normal View History

2014-03-25 04:24:25 +00:00
require 'net/http'
require 'nokogiri'
Client.register_command("bug") { |args|
2014-03-25 04:37:16 +00:00
if args[0] =~ /^[0-9]+$/ then
doc = Nokogiri::HTML(Net::HTTP.get(URI(Config[:commands][:bug][:url] + args[0])))
2014-03-25 04:50:36 +00:00
[Config[: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,
2014-03-25 04:51:50 +00:00
].join('; ')
2014-03-25 04:37:16 +00:00
else
"invalid bug url"
end
2014-03-25 04:24:25 +00:00
}