howdy 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/TODO +1 -0
- data/VERSION +1 -1
- data/bin/how +3 -3
- data/howdy.gemspec +2 -2
- data/lib/howdy/base.rb +8 -2
- metadata +2 -2
data/TODO
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/bin/how
CHANGED
@@ -26,10 +26,10 @@ opts = OptionParser.new do |opts|
|
|
26
26
|
end
|
27
27
|
Howdy::Dictionary.set( Howdy::Dictionary.available[index-1] )
|
28
28
|
else
|
29
|
-
if dict_klass = Howdy::Dictionary.find_by_label(
|
29
|
+
if dict_klass = Howdy::Dictionary.find_by_label(d)
|
30
30
|
Howdy::Dictionary.set(dict_klass)
|
31
31
|
else
|
32
|
-
Howdy::UI.error "Dictionary: '#{
|
32
|
+
Howdy::UI.error "Dictionary: '#{d}' not found. Choose one of available dictionaries"
|
33
33
|
exit 1
|
34
34
|
end
|
35
35
|
end
|
@@ -54,7 +54,7 @@ else
|
|
54
54
|
query = ARGV.join(' ')
|
55
55
|
end
|
56
56
|
|
57
|
-
dict = Howdy::Dictionary.current.new(query
|
57
|
+
dict = Howdy::Dictionary.current.new(query)
|
58
58
|
dict.parse
|
59
59
|
dict.print
|
60
60
|
|
data/howdy.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{howdy}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["mlomnicki"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-17}
|
13
13
|
s.default_executable = %q{how}
|
14
14
|
s.description = %q{Howdy is a tool that allows querying web dictionaries from a command line.}
|
15
15
|
s.email = %q{michal.lomnicki@gmail.com}
|
data/lib/howdy/base.rb
CHANGED
@@ -66,7 +66,7 @@ module Howdy # :nodoc
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def initialize(user_query) # :nodoc
|
69
|
-
@user_query = user_query
|
69
|
+
@user_query = user_query.squeeze(' ').strip
|
70
70
|
end
|
71
71
|
|
72
72
|
# Sets URL to query the web dictionary.
|
@@ -161,7 +161,13 @@ module Howdy # :nodoc
|
|
161
161
|
|
162
162
|
# Returns content of HTTP response wrapped in Nokogiri::HTML backend.
|
163
163
|
def document
|
164
|
-
|
164
|
+
# FIXME: deal more sophistically with exception
|
165
|
+
begin
|
166
|
+
@document ||= Nokogiri::HTML(open(URI.escape(interpolated_url)), nil, self.class.doc_encoding)
|
167
|
+
rescue
|
168
|
+
UI.error "Nothing found"
|
169
|
+
exit 0
|
170
|
+
end
|
165
171
|
end
|
166
172
|
|
167
173
|
# Array which stores the answers for the user query. Used in +parse+ method.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: howdy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mlomnicki
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-17 00:00:00 +01:00
|
13
13
|
default_executable: how
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|