ud 0.2.2 → 0.2.3

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.
Files changed (7) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +2 -0
  3. data.tar.gz.sig +2 -0
  4. data/bin/ud +9 -2
  5. data/lib/ud.rb +21 -1
  6. metadata +44 -22
  7. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 932d05b8defad2478c07957cf69f7bf9cb2a69e8
4
- data.tar.gz: 914e4c70a670503b590929148a08a88dc8786e0e
3
+ metadata.gz: 3ccafe9c95f63045cc15ddbb317cb7c2342cbeba
4
+ data.tar.gz: e3c9bf16950fbcbff3b79be88697fe87f247861b
5
5
  SHA512:
6
- metadata.gz: 09bd788eb87689849510ccad1ab1826cc694d9dffd4192ba807d78d7be4be146828aa72fab37ddc3821efdfc7b93708bca3b6c9915f0c8769901768741c38f30
7
- data.tar.gz: 4242090f5787f30764cfb2d4cae03ad5d4d84afa94909bce0964f239f5feff03358e789e3d3d3d80f69bf69ba80c11da2a1f71492e30aeb6ab353cfb85de2e91
6
+ metadata.gz: 99c89f5c0fdbd53c2c3e4da643b12ad54f90a7f0227897e5923050506cd16635f448788c828aa30b5c4559f84869daaae42bf0b6e01c00d5f97a7ee29b15644b
7
+ data.tar.gz: 0dd857c47767eb40371d75056def0eac0325010eba4c1294dbffdedbe4834321dde05cae18420c9ea80a489df22aa5cffc5544ecc4db55cd0d23955ebe5e8a69
@@ -0,0 +1,2 @@
1
+ r/�y̬֬P���,�SЎ�r q�M>��UMB �q1 5�K���*sV�������f��y����c;�!�-�y��Lf�̤��<8&yH@�y�
2
+ -5~�J:sc��SW��F#��Z_���X)�^46�E�)�Ȟ�}SGJ֪�]����%C�]���b�M��x�Fm���D��ë)������-�J�X���tP�$м�R)�e�vZ~�\�OOT����N�D�����ѿ�=�<��( �l��H+
@@ -0,0 +1,2 @@
1
+ U�ą8T��v�p�<���"�y=���������/\ݘ2(�Ũ4��B�3%��O .�% R| ��Ȗ]��;6}
2
+ ��ٔ�o�,`�HN�n�.�Z�D"�N�I��7�q�^����0}5
data/bin/ud CHANGED
@@ -20,6 +20,7 @@ EOS
20
20
  opt :ratio, 'Filter by upvotes/downvotes ratio', :type => :float, :default => 0.0, :short => '-r'
21
21
  opt :count, 'Limit the number of definitions', :type => :int, :default => 1, :short => '-n'
22
22
  opt :color, 'Use colorized output', :default => true
23
+ opt :browser, 'Open the results in a browser window', :short => '-b'
23
24
  opt :up, 'Shortcut for \'-r 2\''
24
25
 
25
26
  end
@@ -34,6 +35,12 @@ if ARGV.empty?
34
35
  exit 1
35
36
  end
36
37
 
37
- q = UD.query(ARGV.join(' '), opts)
38
- puts UD.format_results(q, opts[:color])
38
+ term = ARGV.join(' ')
39
+
40
+ if opts[:browser]
41
+ UD.open_url(term)
42
+ else
43
+ q = UD.query(ARGV.join(' '), opts)
44
+ puts UD.format_results(q, opts[:color])
45
+ end
39
46
 
data/lib/ud.rb CHANGED
@@ -13,7 +13,7 @@ module UD
13
13
 
14
14
  # @return [String] the current gem's version
15
15
  def version
16
- '0.2.2'
16
+ '0.2.3'
17
17
  end
18
18
 
19
19
  # Get the search URL to query for a given term.
@@ -25,6 +25,14 @@ module UD
25
25
  "http://api.urbandictionary.com/v0/define?#{param}"
26
26
  end
27
27
 
28
+ # Open the search URL in the user's browser
29
+ # @param term [String] the term to search for. It must be a string, spaces
30
+ # are allowed.
31
+ # @return [Nil]
32
+ def open_url(term='')
33
+ system open_cmd, search_url(term)
34
+ end
35
+
28
36
  # Query the website and return a list of definitions for the provided term.
29
37
  # This list may be empty if there's no result.
30
38
  # @param term [String] the term to search for
@@ -66,5 +74,17 @@ module UD
66
74
  UD::Formatting.text(results, color)
67
75
  end
68
76
 
77
+ private
78
+
79
+ def open_cmd
80
+ case RbConfig::CONFIG["host_os"]
81
+ when /darwin/
82
+ "open"
83
+ when /bsd|linux/
84
+ "xdg-open"
85
+ when /cygwin|mingw|mswin/
86
+ "start"
87
+ end
88
+ end
69
89
  end
70
90
  end
metadata CHANGED
@@ -1,125 +1,147 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baptiste Fontaine
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2014-05-19 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA9MRAwDgYDVQQDDAdiYXRp
14
+ Zm9uMRUwEwYKCZImiZPyLGQBGRYFeWFob28xEjAQBgoJkiaJk/IsZAEZFgJmcjAe
15
+ Fw0xNDA4MjQxMTM5NTJaFw0xNTA4MjQxMTM5NTJaMD0xEDAOBgNVBAMMB2JhdGlm
16
+ b24xFTATBgoJkiaJk/IsZAEZFgV5YWhvbzESMBAGCgmSJomT8ixkARkWAmZyMIIB
17
+ IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn3uOgWl+FwXIjDdCay28i6cK
18
+ FxHWhHoS/mH9pkXzSGVctEKP2fulie6MkIvrLCP5M6TpByeaBjcJjZPadrou1FIc
19
+ Yc/O14jYjaKTqfMxpzgNfGzDdBgBo0QZ9rcHjORetdIZdUSDaZjPtI1aGS6eBMsh
20
+ W2X6GxL4UQ1kH0Lyg7iPYAH5RHnD3+G+S28iOPFfRLFzm4fwJp1k7URiiSyOHTDp
21
+ B0ZehKKrW/ibCaRMYp2VoCamcim4de1VA6CTOaYSShueqThE18n1HM6aprihziyM
22
+ 04yIpo80/unO6JxlsUFdBjsb5d7oJSqPJ6/OfcFnyXa/VRm+Ed9d6PTwZvL7YwID
23
+ AQABo3MwcTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUWyH3xMx1
24
+ 8I5NLncgNEC0ZlDRKegwGwYDVR0RBBQwEoEQYmF0aWZvbkB5YWhvby5mcjAbBgNV
25
+ HRIEFDASgRBiYXRpZm9uQHlhaG9vLmZyMA0GCSqGSIb3DQEBBQUAA4IBAQAaTVya
26
+ CGgojxBwUoadCCIsFheGsXvSFhikkXYNXy0VxEYr8BaTfGwzYh9c9T5N+Y5Mu5MW
27
+ WegqwIwRhIu6Rg7huqJ7TK50pVDF0yrZcsxvWjOfd3clblBHjKGQx5Mbu7LVNGKE
28
+ +QNdTAwYVTAA8wXHpxk200cHb9xz4e9ANpb4lonGuPz8jKmb/A7Z1M5QD6zStG8l
29
+ sTlVAhA/LZiC9gL9LtW8Iq7o7xRFhxNPKWHu6JVThH9i16eli+JignOJbGna7C40
30
+ QnOQb8zHyNL+gq2m/mnZGrSehx+6AujokjOfHbmivYMfDATOQQx0eIBI18IhacZm
31
+ 42WxhhIV2bwDtd77
32
+ -----END CERTIFICATE-----
33
+ date: 2015-05-17 00:00:00.000000000 Z
12
34
  dependencies:
13
35
  - !ruby/object:Gem::Dependency
14
36
  name: json
15
37
  requirement: !ruby/object:Gem::Requirement
16
38
  requirements:
17
- - - ~>
39
+ - - "~>"
18
40
  - !ruby/object:Gem::Version
19
41
  version: '1.8'
20
42
  type: :runtime
21
43
  prerelease: false
22
44
  version_requirements: !ruby/object:Gem::Requirement
23
45
  requirements:
24
- - - ~>
46
+ - - "~>"
25
47
  - !ruby/object:Gem::Version
26
48
  version: '1.8'
27
49
  - !ruby/object:Gem::Dependency
28
50
  name: trollop
29
51
  requirement: !ruby/object:Gem::Requirement
30
52
  requirements:
31
- - - ~>
53
+ - - "~>"
32
54
  - !ruby/object:Gem::Version
33
55
  version: '2.0'
34
56
  type: :runtime
35
57
  prerelease: false
36
58
  version_requirements: !ruby/object:Gem::Requirement
37
59
  requirements:
38
- - - ~>
60
+ - - "~>"
39
61
  - !ruby/object:Gem::Version
40
62
  version: '2.0'
41
63
  - !ruby/object:Gem::Dependency
42
64
  name: colored
43
65
  requirement: !ruby/object:Gem::Requirement
44
66
  requirements:
45
- - - ~>
67
+ - - "~>"
46
68
  - !ruby/object:Gem::Version
47
69
  version: '1.2'
48
70
  type: :runtime
49
71
  prerelease: false
50
72
  version_requirements: !ruby/object:Gem::Requirement
51
73
  requirements:
52
- - - ~>
74
+ - - "~>"
53
75
  - !ruby/object:Gem::Version
54
76
  version: '1.2'
55
77
  - !ruby/object:Gem::Dependency
56
78
  name: simplecov
57
79
  requirement: !ruby/object:Gem::Requirement
58
80
  requirements:
59
- - - ~>
81
+ - - "~>"
60
82
  - !ruby/object:Gem::Version
61
83
  version: '0.7'
62
84
  type: :development
63
85
  prerelease: false
64
86
  version_requirements: !ruby/object:Gem::Requirement
65
87
  requirements:
66
- - - ~>
88
+ - - "~>"
67
89
  - !ruby/object:Gem::Version
68
90
  version: '0.7'
69
91
  - !ruby/object:Gem::Dependency
70
92
  name: rake
71
93
  requirement: !ruby/object:Gem::Requirement
72
94
  requirements:
73
- - - ~>
95
+ - - "~>"
74
96
  - !ruby/object:Gem::Version
75
97
  version: '10.1'
76
98
  type: :development
77
99
  prerelease: false
78
100
  version_requirements: !ruby/object:Gem::Requirement
79
101
  requirements:
80
- - - ~>
102
+ - - "~>"
81
103
  - !ruby/object:Gem::Version
82
104
  version: '10.1'
83
105
  - !ruby/object:Gem::Dependency
84
106
  name: test-unit
85
107
  requirement: !ruby/object:Gem::Requirement
86
108
  requirements:
87
- - - ~>
109
+ - - "~>"
88
110
  - !ruby/object:Gem::Version
89
111
  version: '2.5'
90
112
  type: :development
91
113
  prerelease: false
92
114
  version_requirements: !ruby/object:Gem::Requirement
93
115
  requirements:
94
- - - ~>
116
+ - - "~>"
95
117
  - !ruby/object:Gem::Version
96
118
  version: '2.5'
97
119
  - !ruby/object:Gem::Dependency
98
120
  name: fakeweb
99
121
  requirement: !ruby/object:Gem::Requirement
100
122
  requirements:
101
- - - ~>
123
+ - - "~>"
102
124
  - !ruby/object:Gem::Version
103
125
  version: '1.3'
104
126
  type: :development
105
127
  prerelease: false
106
128
  version_requirements: !ruby/object:Gem::Requirement
107
129
  requirements:
108
- - - ~>
130
+ - - "~>"
109
131
  - !ruby/object:Gem::Version
110
132
  version: '1.3'
111
133
  - !ruby/object:Gem::Dependency
112
134
  name: coveralls
113
135
  requirement: !ruby/object:Gem::Requirement
114
136
  requirements:
115
- - - ~>
137
+ - - "~>"
116
138
  - !ruby/object:Gem::Version
117
139
  version: '0.7'
118
140
  type: :development
119
141
  prerelease: false
120
142
  version_requirements: !ruby/object:Gem::Requirement
121
143
  requirements:
122
- - - ~>
144
+ - - "~>"
123
145
  - !ruby/object:Gem::Version
124
146
  version: '0.7'
125
147
  description: Get words' definitions from Urban Dictionary on the command-line.
@@ -145,17 +167,17 @@ require_paths:
145
167
  - lib
146
168
  required_ruby_version: !ruby/object:Gem::Requirement
147
169
  requirements:
148
- - - '>='
170
+ - - ">="
149
171
  - !ruby/object:Gem::Version
150
172
  version: '0'
151
173
  required_rubygems_version: !ruby/object:Gem::Requirement
152
174
  requirements:
153
- - - '>='
175
+ - - ">="
154
176
  - !ruby/object:Gem::Version
155
177
  version: '0'
156
178
  requirements: []
157
179
  rubyforge_project:
158
- rubygems_version: 2.2.1
180
+ rubygems_version: 2.4.6
159
181
  signing_key:
160
182
  specification_version: 4
161
183
  summary: Urban Dictionary unofficial scrapper
Binary file