howdoi 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/howdoi.rb +12 -10
- metadata +3 -3
data/lib/howdoi.rb
CHANGED
@@ -47,18 +47,20 @@ def how_do_i(args, opts = {})
|
|
47
47
|
page = get_url link
|
48
48
|
html = Nokogiri.HTML page
|
49
49
|
ans = html.at_css(".answer")
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
if ans
|
51
|
+
instruction = ans.css("pre").children.
|
52
|
+
collect(&:content).
|
53
|
+
join(" " * 5 + '-' * 50 + "\n") ||
|
54
|
+
ans.at_css("code").content
|
55
|
+
unless opts[:all] or instruction.empty?
|
56
|
+
puts instruction
|
57
|
+
else
|
58
|
+
puts ans.at('.post-text').content
|
59
|
+
end
|
58
60
|
end
|
59
|
-
|
60
|
-
puts "Sorry, couldn't find any help with that topic"
|
61
|
+
exit
|
61
62
|
end
|
63
|
+
puts "Sorry, couldn't find any help with that topic"
|
62
64
|
end
|
63
65
|
|
64
66
|
if __FILE__ == $0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: howdoi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-09 00:00:00.
|
12
|
+
date: 2013-01-09 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: This is ruby clone of original Python howdoi by Benjamin Gleitzman (@gleitz)
|
15
15
|
email: roylzuo@gmail.com
|
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
version: '0'
|
42
42
|
requirements: []
|
43
43
|
rubyforge_project:
|
44
|
-
rubygems_version: 1.8.
|
44
|
+
rubygems_version: 1.8.15
|
45
45
|
signing_key:
|
46
46
|
specification_version: 3
|
47
47
|
summary: a code search tool
|