cinch-rfc 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cinch-rfc.gemspec +1 -1
- data/lib/cinch/plugins/rfc.rb +10 -10
- data/lib/cinch/plugins/rfc/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a8fb55c4fd519e8d71f50cabc113eef2b404bf4
|
4
|
+
data.tar.gz: 581f8a45136b54d7824134b983f2bce9bdda7f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fc4d3e26dea934a486d82c3064627f188d690162feae642fc7278416106a3ae9054f21e375566bdc36da1236a9bc1d736d80188ddeb9e7f145ba741c5e1cc43
|
7
|
+
data.tar.gz: b2b658f717810fcafc44624cda33eb63ffd3de05082654fc89a322e60f9e3ede48c2e99c283818fb13bb5d6306c32fb66f7aefc28d12f28f5ae6abedf7b61f96
|
data/cinch-rfc.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "cinch", "~>2.0"
|
22
|
-
spec.add_dependency "
|
22
|
+
spec.add_dependency "httparty"
|
23
23
|
spec.add_dependency "nokogiri"
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
data/lib/cinch/plugins/rfc.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'cinch'
|
2
2
|
require 'nokogiri'
|
3
|
-
require '
|
3
|
+
require 'httparty'
|
4
4
|
require 'uri'
|
5
5
|
|
6
6
|
module Cinch
|
@@ -11,7 +11,7 @@ module Cinch
|
|
11
11
|
match /RFC ?(\d+)/i, method: :rfc_link, use_prefix: false
|
12
12
|
|
13
13
|
def rfc_link(m, rfc)
|
14
|
-
rfc_url = "http://tools.ietf.org/
|
14
|
+
rfc_url = "http://tools.ietf.org/html/rfc#{rfc}"
|
15
15
|
rfc_name = rfc_name_from_url(rfc_url)
|
16
16
|
m.reply "RFC #{rfc}: #{rfc_name} (#{rfc_url})"
|
17
17
|
end
|
@@ -19,14 +19,14 @@ module Cinch
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def rfc_name_from_url(uri)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
res = HTTParty.get(uri, headers: {
|
23
|
+
"User-Agent" => "Cinch IRC bot",
|
24
|
+
"Accept" => "text/html"
|
25
|
+
})
|
26
|
+
|
27
|
+
Nokogiri::HTML(res.body).at_xpath('//meta[@name="DC.Title"]')['content']
|
28
|
+
rescue
|
29
|
+
"<could not retrieve RFC name>"
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinch-rfc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Hastings-Spital
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cinch
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: httparty
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|