Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix delicious posting

  • Loading branch information...
commit 840bb0b46d9616447e5c382f970b6ee579906a41 1 parent f70d64d
@evan authored
Showing with 5 additions and 3 deletions.
  1. +1 −1  bin/kirby
  2. +4 −2 lib/kirby.rb
View
2  bin/kirby
@@ -31,7 +31,7 @@ end
:nick => param(ARGV[0]),
:channel => param(ARGV[1]),
:server => param(ARGV[2]),
- :delicious_name => param(ARGV[3]),
+ :delicious_user => param(ARGV[3]),
:delicious_pass => param(ARGV[4]),
:silent => option?("silent"),
:debug => option?("debug"),
View
6 lib/kirby.rb
@@ -145,7 +145,7 @@ def poll
(Hpricot(`svn log #{repo} -rHEAD:#{last} --limit 10 --xml`)/:logentry).reverse[1..-1].each do |ci|
@svns[repo] = rev = ci.attributes['revision'].to_i
project = case repo
- when /^http://(\w+)\.rubyforge/ then $1
+ when /^http:\/\/(\w+)\.rubyforge/ then $1
else
repo.split(/\.\//).reject { |path| ['trunk', 'svn', 'org', 'com', 'net', nil].include? path }.last
end
@@ -167,6 +167,7 @@ def poll
# Post a url to the del.icio.us account.
def post url
+ puts "POST: #{url}" if config[:debug]
query = {:url => url,
:description => (((Hpricot(open(url))/:title).first.innerHTML or url) rescue url),
:tags => (Hpricot(open("http://del.icio.us/url/check?url=#{CGI.escape(url)}"))/'.alphacloud'/:a).map{|s| s.innerHTML}.join(" "),
@@ -174,11 +175,12 @@ def post url
begin
http = Net::HTTP.new('api.del.icio.us', 443)
http.use_ssl = true
- http.start do |http|
+ response = http.start do |http|
req = Net::HTTP::Get.new('/v1/posts/add?' + query.map{|k,v| "#{k}=#{CGI.escape(v)}"}.join('&'))
req.basic_auth config[:delicious_user], config[:delicious_pass]
http.request(req)
end.body
+ puts "POST: #{response.inspect}" if config[:debug]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.