lookup 1.0.0.beta7 → 1.0.0.beta8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +15 -9
- data/bin/lookup +2 -7
- data/config/lookup +21 -0
- data/lib/lookup.rb +57 -43
- data/lib/models.rb +5 -10
- data/lookup.gemspec +3 -2
- data/spec/.lookup/config +21 -0
- data/spec/.lookup/lookup.sqlite3 +0 -0
- data/spec/apis/faker/classes.html +34 -0
- data/spec/apis/faker/methods.html +63 -0
- data/spec/config +21 -0
- data/spec/lookup_spec.rb +15 -2
- data/spec/spec_helper.rb +4 -6
- metadata +40 -28
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
rspec-expectations (2.0.0.beta.20)
|
30
30
|
diff-lcs (>= 1.1.2)
|
31
31
|
rspec-mocks (2.0.0.beta.20)
|
32
|
-
sqlite3-ruby (1.3.
|
32
|
+
sqlite3-ruby (1.3.0)
|
33
33
|
tzinfo (0.3.23)
|
34
34
|
webmock (1.3.5)
|
35
35
|
addressable (>= 2.1.1)
|
@@ -43,5 +43,5 @@ DEPENDENCIES
|
|
43
43
|
find_by_hash
|
44
44
|
nokogiri
|
45
45
|
rspec (~> 2.0.0.beta.20)
|
46
|
-
sqlite3-ruby
|
46
|
+
sqlite3-ruby
|
47
47
|
webmock
|
data/README.md
CHANGED
@@ -2,27 +2,29 @@
|
|
2
2
|
|
3
3
|
## Installation
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
sudo gem install gemcutter
|
8
|
-
gem tumble
|
9
|
-
|
10
|
-
Then you'll be able to:
|
5
|
+
Simply:
|
11
6
|
|
12
|
-
|
7
|
+
gem install lookup
|
13
8
|
|
14
9
|
## Example usage:
|
15
10
|
|
16
|
-
This has changed since the pre-1.0 versions. From 1.0 onwards you **
|
11
|
+
This has changed since the pre-1.0 versions. From 1.0 onwards you **sometimes have to** specify an API that you wish to search.
|
17
12
|
|
18
13
|
* `lookup v2.3.8 ActiveRecord::Base#new` (returns a single method from the Rails 2.3.8 API, since the method name is right)
|
19
14
|
* `lookup v3.0.0 ActiveRecord::Base#destroy` (returns two methods from the Rails 3.0.0 API, since there's two methods with that name)
|
20
|
-
* `lookup v2.3.8 ActiveRecord::Base#destro` (returns three methods, uses methods beginning with "
|
15
|
+
* `lookup v2.3.8 ActiveRecord::Base#destro` (returns three methods, uses methods beginning with "destro")
|
21
16
|
* `lookup v2.3.8 ActiveRecord::Base#d` (tells you to be more specific, because it can't open 35 tabs at once)
|
22
17
|
* `lookup v2.3.8 ActiveRecord::Base` (returns a single consant)
|
23
18
|
* `lookup v2.3.8 av::Base` ("av" maps to ActionView, so returns ActionView::Base constant)
|
19
|
+
|
20
|
+
And for those of you who are Ruby inclined:
|
21
|
+
|
24
22
|
* `lookup 1.8 Array#join` (Returns a single method from the Ruby 1.8.7 API)
|
25
23
|
* `lookup 1.9 Array#join` (Returns a single method from the Ruby 1.9 API)
|
24
|
+
|
25
|
+
Or if you want to to look up for your current version of Ruby, simply:
|
26
|
+
|
27
|
+
* `lookup Array#join (Returns a single method from either Ruby 1.8 or Ruby 1.9. Other implementations not yet supported.)
|
26
28
|
|
27
29
|
## Options
|
28
30
|
|
@@ -31,6 +33,10 @@ It also takes options:
|
|
31
33
|
* `-c or --clear` will delete the database and update the api again. This can take a minute or two.
|
32
34
|
* `-t or --text` is useful for when you don't want lookup to spam tabs into your browser willy-nilly.
|
33
35
|
|
36
|
+
## Configuration
|
37
|
+
|
38
|
+
Lookup (as of 1.0) comes with a configuration file at _~/.lookup/config_ which you can use to alter the APIs which lookup looks through. The name Lookup uses to determine what API you want is the key for the info hash. The name in the info hash serves no real importance other than for than "you fail at lookup" APINotFound error messages, where as the URL must point to the exact directory where the _fr\_method\_index.html file is located.
|
39
|
+
|
34
40
|
## How it finds them
|
35
41
|
|
36
42
|
1. Finds the specified API and uses it to scope future calls.
|
data/bin/lookup
CHANGED
@@ -46,8 +46,8 @@ def display_results(results, search_string)
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
local_lib=File.
|
50
|
-
if File.exists?(local_lib
|
49
|
+
local_lib=Pathname.new(File.expand_path(File.dirname(__FILE__))) + "../lib/lookup.rb"
|
50
|
+
if File.exists?(local_lib)
|
51
51
|
require local_lib
|
52
52
|
else
|
53
53
|
require 'rubygems'
|
@@ -59,11 +59,6 @@ output = nil
|
|
59
59
|
op=OptionParser.new do |opts|
|
60
60
|
opts.banner = %Q{
|
61
61
|
Usage: lookup <api> <constant|method> [method] [OPTIONS]
|
62
|
-
APIs are:
|
63
|
-
v3.0.0 - Rails 3.0.0
|
64
|
-
v2.3.8 - Rails 2.3.8
|
65
|
-
1.9 - Ruby 1.9
|
66
|
-
1.8 - Ruby 1.8
|
67
62
|
|
68
63
|
Example: lookup v3.0.0 ActiveRecord::Base new
|
69
64
|
}
|
data/config/lookup
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
apis:
|
2
|
+
faker:
|
3
|
+
name: Faker
|
4
|
+
url: "http://faker.rubyforge.org/rdoc/"
|
5
|
+
|
6
|
+
v3.0.0:
|
7
|
+
name: Rails v3.0.0
|
8
|
+
url: "http://api.rubyonrails.org"
|
9
|
+
|
10
|
+
v2.3.8:
|
11
|
+
name: Rails v2.3.8
|
12
|
+
url: "http://api.rubyonrails.org/v2.3.8"
|
13
|
+
|
14
|
+
1.8:
|
15
|
+
name: Ruby 1.8
|
16
|
+
url: "http://www.ruby-doc.org/core"
|
17
|
+
|
18
|
+
1.9:
|
19
|
+
name: Ruby 1.9
|
20
|
+
url: "http://ruby-doc.org/ruby-1.9"
|
21
|
+
|
data/lib/lookup.rb
CHANGED
@@ -6,49 +6,56 @@ require 'bundler'
|
|
6
6
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
7
7
|
Bundler.require(:default)
|
8
8
|
|
9
|
+
# Because some of you don't have ActiveSupport 3.0
|
10
|
+
# And I'm too lazy to require all the shit for 2.3.8 just for this.
|
11
|
+
|
12
|
+
class Hash
|
13
|
+
def stringify_keys!
|
14
|
+
keys.each do |key|
|
15
|
+
self[key.to_s] = delete(key)
|
16
|
+
end
|
17
|
+
self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
9
21
|
module Lookup
|
10
|
-
VERSION = "1.0.0.
|
22
|
+
VERSION = "1.0.0.beta8"
|
11
23
|
APIS = []
|
12
24
|
|
13
25
|
class APINotFound < StandardError; end
|
14
26
|
|
15
27
|
class << self
|
28
|
+
|
29
|
+
def home
|
30
|
+
Pathname.new(ENV["HOME"]) + ".lookup"
|
31
|
+
end
|
32
|
+
|
16
33
|
def config
|
17
|
-
YAML
|
34
|
+
YAML.load_file(home + "config")
|
35
|
+
end
|
36
|
+
|
37
|
+
def apis
|
38
|
+
apis = config["apis"].stringify_keys!
|
18
39
|
end
|
19
40
|
|
20
41
|
def update!
|
21
|
-
puts "Updating API
|
22
|
-
puts "Big APIs (like Ruby + Rails) can take some time."
|
23
|
-
2.times { puts " " }
|
42
|
+
puts "Updating API, this may take a minute or two. Please be patient!"
|
24
43
|
[Constant, Entry, Api].map { |klass| klass.delete_all }
|
25
|
-
|
26
|
-
|
27
|
-
apis = config["apis"].values
|
28
|
-
for api in apis
|
29
|
-
puts " " + api["name"]
|
30
|
-
end
|
31
|
-
|
32
|
-
for api in apis
|
44
|
+
puts "Updating #{apis.size} APIs."
|
45
|
+
for api in apis.values
|
33
46
|
update_api!(api["name"], api["url"])
|
34
47
|
end
|
35
|
-
|
36
48
|
end
|
37
49
|
|
38
50
|
def update_api!(name, url)
|
39
|
-
puts "
|
51
|
+
puts "Updating API for #{name}..."
|
40
52
|
api = Api.find_or_create_by_name_and_url(name, url)
|
41
53
|
APIS << api
|
42
|
-
|
43
|
-
print " methods..."
|
54
|
+
puts "Updating methods for #{name}"
|
44
55
|
api.update_methods!
|
45
|
-
puts "
|
46
|
-
|
47
|
-
print " classes..."
|
56
|
+
puts "Updating classes for #{name}"
|
48
57
|
api.update_classes!
|
49
|
-
puts "
|
50
|
-
|
51
|
-
puts " ✓ #{name}"
|
58
|
+
puts "The #{name} API is done."
|
52
59
|
end
|
53
60
|
|
54
61
|
def find_constant(name, entry=nil, options={})
|
@@ -125,27 +132,26 @@ module Lookup
|
|
125
132
|
end
|
126
133
|
|
127
134
|
def search(msg, options={})
|
128
|
-
options[:api] ||=
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
135
|
+
options[:api] ||= msg.split.first
|
136
|
+
api_check = lambda { |options| (!apis.keys.map(&:to_s).include?(options[:api]) && !options[:api].is_a?(Api)) }
|
137
|
+
# to_s because yaml interprets "1.8" as a literal 1.8
|
138
|
+
# And because I'm super, super lazy
|
139
|
+
if !@attempted_ruby && api_check.call(options)
|
140
|
+
# Attempt a current Ruby lookup
|
141
|
+
@attempted_ruby = true
|
142
|
+
api = case RUBY_VERSION
|
143
|
+
when /^1.8/
|
144
|
+
"1.8"
|
145
|
+
when /^1.9/
|
146
|
+
"1.9"
|
147
|
+
end
|
148
|
+
search(msg, options.merge!(:api => api)) if api
|
134
149
|
end
|
135
150
|
|
136
|
-
|
137
|
-
v2.3.8 - Rails 2.3.8
|
138
|
-
v3.0.0 - Rails 3.0.0
|
139
|
-
1.9 - Ruby 1.9
|
140
|
-
1.8 - Ruby 1.8
|
141
|
-
|
142
|
-
Example usage: lookup v2.3.8 ActiveRecord::Base
|
143
|
-
} if options[:api].blank?
|
144
|
-
|
145
|
-
|
146
|
-
options[:api] = Api.find_by_name!(options[:api]) unless options[:api].is_a?(Api)
|
151
|
+
options[:api] = Api.find_by_name!(apis[options[:api]]["name"]) unless options[:api].is_a?(Api)
|
147
152
|
|
148
|
-
|
153
|
+
# We want to retain message.
|
154
|
+
msg = msg.gsub(/^(.*?)\s/, "")
|
149
155
|
|
150
156
|
splitter = options[:splitter] || "#"
|
151
157
|
parts = msg.split(" ")[0..-1].flatten.map { |a| a.split(splitter) }.flatten!
|
@@ -172,9 +178,17 @@ module Lookup
|
|
172
178
|
|
173
179
|
return selected_output
|
174
180
|
end
|
181
|
+
|
182
|
+
private
|
175
183
|
|
184
|
+
def api_not_found
|
185
|
+
raise Lookup::APINotFound, %Q{You must specify a valid API as the first keyword. Included APIs:\n} +
|
186
|
+
(apis.map do |short, info|
|
187
|
+
"#{short} - #{info["name"]}"
|
188
|
+
end.join("\n"))
|
189
|
+
|
190
|
+
end
|
176
191
|
end
|
177
192
|
end
|
178
193
|
|
179
|
-
|
180
|
-
require File.join(File.dirname(__FILE__), 'models')
|
194
|
+
require File.join(File.dirname(__FILE__), 'models')
|
data/lib/models.rb
CHANGED
@@ -31,11 +31,7 @@ module Lookup
|
|
31
31
|
# This makes it valid.
|
32
32
|
doc = Nokogiri::HTML(doc.gsub(/<a(.*?)>(.*?)<\/a>/m) { "<a#{$1}>#{$2.gsub("<", "<").gsub(">", ">")}" })
|
33
33
|
|
34
|
-
|
35
|
-
methods = doc.css("a")
|
36
|
-
print " #{methods.size} to index"
|
37
|
-
|
38
|
-
methods.each do |a|
|
34
|
+
doc.css("a").each do |a|
|
39
35
|
names = a.text.split(" ")
|
40
36
|
next if names.empty?
|
41
37
|
method = names[0]
|
@@ -51,15 +47,14 @@ module Lookup
|
|
51
47
|
end
|
52
48
|
constant.entries.find_or_create_by_name_and_url(method, url)
|
53
49
|
end
|
50
|
+
|
51
|
+
# entries.each_slice(100) do |methods|
|
52
|
+
# LookupBase.connection.execute("INSERT INTO entries (name, url) ")
|
53
|
+
# end
|
54
54
|
end
|
55
55
|
|
56
56
|
def update_classes!
|
57
57
|
doc = Nokogiri::HTML(Net::HTTP.get(URI.parse("#{url}/fr_class_index.html")))
|
58
|
-
|
59
|
-
# All the a tags on this page are classes
|
60
|
-
classes = doc.css("a")
|
61
|
-
print " #{classes.size} to index"
|
62
|
-
|
63
58
|
doc.css("a").each do |a|
|
64
59
|
constant = self.constants.find_or_create_by_name_and_url(a.text, self.url + "/" + a["href"])
|
65
60
|
end
|
data/lookup.gemspec
CHANGED
@@ -21,11 +21,12 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
23
23
|
|
24
|
-
s.add_dependency(%q<sqlite3-ruby>, [">= 1.
|
24
|
+
s.add_dependency(%q<sqlite3-ruby>, [">= 1.2.5"])
|
25
25
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
26
26
|
s.add_dependency(%q<activerecord>, [">= 2.3.8"])
|
27
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
27
28
|
|
28
29
|
s.files = `git ls-files`.split("\n")
|
29
30
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
30
31
|
s.require_path = 'lib'
|
31
|
-
end
|
32
|
+
end
|
data/spec/.lookup/config
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
apis:
|
2
|
+
faker:
|
3
|
+
name: Faker
|
4
|
+
url: "http://faker.rubyforge.org/rdoc/"
|
5
|
+
|
6
|
+
v3.0.0:
|
7
|
+
name: Rails v3.0.0
|
8
|
+
url: "http://api.rubyonrails.org"
|
9
|
+
|
10
|
+
v2.3.8:
|
11
|
+
name: Rails v2.3.8
|
12
|
+
url: "http://api.rubyonrails.org/v2.3.8"
|
13
|
+
|
14
|
+
1.8:
|
15
|
+
name: Ruby 1.8
|
16
|
+
url: "http://www.ruby-doc.org/core"
|
17
|
+
|
18
|
+
1.9:
|
19
|
+
name: Ruby 1.9
|
20
|
+
url: "http://ruby-doc.org/ruby-1.9"
|
21
|
+
|
data/spec/.lookup/lookup.sqlite3
CHANGED
Binary file
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Classes
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Classes</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Classes</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/Array.html">Array</a><br />
|
24
|
+
<a href="classes/Faker/Address.html">Faker::Address</a><br />
|
25
|
+
<a href="classes/Faker/Company.html">Faker::Company</a><br />
|
26
|
+
<a href="classes/Faker/Internet.html">Faker::Internet</a><br />
|
27
|
+
<a href="classes/Faker/Lorem.html">Faker::Lorem</a><br />
|
28
|
+
<a href="classes/Faker/Name.html">Faker::Name</a><br />
|
29
|
+
<a href="classes/Faker/PhoneNumber.html">Faker::PhoneNumber</a><br />
|
30
|
+
<a href="classes/Object.html">Object</a><br />
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</body>
|
34
|
+
</html>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Methods
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Methods</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Methods</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/Faker/Company.html#M000024">bs (Faker::Company)</a><br />
|
24
|
+
<a href="classes/Faker/Company.html#M000023">catch_phrase (Faker::Company)</a><br />
|
25
|
+
<a href="classes/Faker/Address.html#M000030">city (Faker::Address)</a><br />
|
26
|
+
<a href="classes/Faker/Address.html#M000028">city_prefix (Faker::Address)</a><br />
|
27
|
+
<a href="classes/Faker/Address.html#M000029">city_suffix (Faker::Address)</a><br />
|
28
|
+
<a href="classes/Faker/Internet.html#M000013">domain_name (Faker::Internet)</a><br />
|
29
|
+
<a href="classes/Faker/Internet.html#M000015">domain_suffix (Faker::Internet)</a><br />
|
30
|
+
<a href="classes/Faker/Internet.html#M000014">domain_word (Faker::Internet)</a><br />
|
31
|
+
<a href="classes/Faker/Internet.html#M000010">email (Faker::Internet)</a><br />
|
32
|
+
<a href="classes/Faker/Name.html#M000005">first_name (Faker::Name)</a><br />
|
33
|
+
<a href="classes/Faker/Internet.html#M000011">free_email (Faker::Internet)</a><br />
|
34
|
+
<a href="classes/Faker/Name.html#M000006">last_name (Faker::Name)</a><br />
|
35
|
+
<a href="classes/Faker/Name.html#M000004">name (Faker::Name)</a><br />
|
36
|
+
<a href="classes/Faker/Company.html#M000021">name (Faker::Company)</a><br />
|
37
|
+
<a href="classes/Faker/Lorem.html#M000019">paragraph (Faker::Lorem)</a><br />
|
38
|
+
<a href="classes/Faker/Lorem.html#M000020">paragraphs (Faker::Lorem)</a><br />
|
39
|
+
<a href="classes/Faker/PhoneNumber.html#M000009">phone_number (Faker::PhoneNumber)</a><br />
|
40
|
+
<a href="classes/Faker/Name.html#M000007">prefix (Faker::Name)</a><br />
|
41
|
+
<a href="classes/Array.html#M000001">rand (Array)</a><br />
|
42
|
+
<a href="classes/Object.html#M000003">returning (Object)</a><br />
|
43
|
+
<a href="classes/Faker/Address.html#M000034">secondary_address (Faker::Address)</a><br />
|
44
|
+
<a href="classes/Faker/Lorem.html#M000017">sentence (Faker::Lorem)</a><br />
|
45
|
+
<a href="classes/Faker/Lorem.html#M000018">sentences (Faker::Lorem)</a><br />
|
46
|
+
<a href="classes/Array.html#M000002">shuffle (Array)</a><br />
|
47
|
+
<a href="classes/Faker/Address.html#M000033">street_address (Faker::Address)</a><br />
|
48
|
+
<a href="classes/Faker/Address.html#M000032">street_name (Faker::Address)</a><br />
|
49
|
+
<a href="classes/Faker/Address.html#M000031">street_suffix (Faker::Address)</a><br />
|
50
|
+
<a href="classes/Faker/Company.html#M000022">suffix (Faker::Company)</a><br />
|
51
|
+
<a href="classes/Faker/Name.html#M000008">suffix (Faker::Name)</a><br />
|
52
|
+
<a href="classes/Faker/Address.html#M000036">uk_country (Faker::Address)</a><br />
|
53
|
+
<a href="classes/Faker/Address.html#M000035">uk_county (Faker::Address)</a><br />
|
54
|
+
<a href="classes/Faker/Address.html#M000037">uk_postcode (Faker::Address)</a><br />
|
55
|
+
<a href="classes/Faker/Address.html#M000026">us_state (Faker::Address)</a><br />
|
56
|
+
<a href="classes/Faker/Address.html#M000027">us_state_abbr (Faker::Address)</a><br />
|
57
|
+
<a href="classes/Faker/Internet.html#M000012">user_name (Faker::Internet)</a><br />
|
58
|
+
<a href="classes/Faker/Lorem.html#M000016">words (Faker::Lorem)</a><br />
|
59
|
+
<a href="classes/Faker/Address.html#M000025">zip_code (Faker::Address)</a><br />
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
</body>
|
63
|
+
</html>
|
data/spec/config
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
apis:
|
2
|
+
faker:
|
3
|
+
name: Faker
|
4
|
+
url: "http://faker.rubyforge.org/rdoc/"
|
5
|
+
|
6
|
+
v3.0.0:
|
7
|
+
name: Rails v3.0.0
|
8
|
+
url: "http://api.rubyonrails.org"
|
9
|
+
|
10
|
+
v2.3.8:
|
11
|
+
name: Rails v2.3.8
|
12
|
+
url: "http://api.rubyonrails.org/v2.3.8"
|
13
|
+
|
14
|
+
1.8:
|
15
|
+
name: Ruby 1.8
|
16
|
+
url: "http://www.ruby-doc.org/core"
|
17
|
+
|
18
|
+
1.9:
|
19
|
+
name: Ruby 1.9
|
20
|
+
url: "http://ruby-doc.org/ruby-1.9"
|
21
|
+
|
data/spec/lookup_spec.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
|
-
describe "Lookup" do
|
3
|
+
describe "Lookup" do
|
4
|
+
#before(:all) do
|
5
|
+
# Lookup.update!
|
6
|
+
#end
|
7
|
+
|
4
8
|
def find_api(name)
|
5
9
|
Lookup::Api.find_by_name(name)
|
6
10
|
end
|
@@ -26,7 +30,16 @@ describe "Lookup" do
|
|
26
30
|
end
|
27
31
|
|
28
32
|
it "should lookup for 1.8" do
|
29
|
-
search("1.8 Array#flatten").should eql(find_entry("Ruby 1.8
|
33
|
+
search("1.8 Array#flatten").should eql(find_entry("Ruby 1.8", "Array", "flatten"))
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should lookup for the current version of Ruby" do
|
37
|
+
case RUBY_VERSION
|
38
|
+
when /^1.8/
|
39
|
+
search("Array#flatten").should eql(find_entry("Ruby 1.8", "Array", "flatten"))
|
40
|
+
when /^1.9/
|
41
|
+
search("Array#flatten").should eql(find_entry("Ruby 1.9", "Array", "flatten"))
|
42
|
+
end
|
30
43
|
end
|
31
44
|
|
32
45
|
it "should be able to find a constant" do
|
data/spec/spec_helper.rb
CHANGED
@@ -42,13 +42,11 @@ stub_request(:get, "http://ruby-doc.org/ruby-1.9/fr_class_index.html").to_return
|
|
42
42
|
stub_request(:get, "http://faker.rubyforge.org/rdoc//fr_method_index.html").to_return(:body => entries("faker"))
|
43
43
|
stub_request(:get, "http://faker.rubyforge.org/rdoc//fr_class_index.html").to_return(:body => classes("faker"))
|
44
44
|
|
45
|
+
# Copy over default config.
|
46
|
+
FileUtils.cp(here + "../config/lookup", here + "config")
|
45
47
|
|
46
48
|
require 'lookup'
|
47
|
-
# require 'pathname'
|
48
49
|
|
49
50
|
RSpec.configure do |config|
|
50
|
-
|
51
|
-
|
52
|
-
Lookup.update!
|
53
|
-
end
|
54
|
-
end
|
51
|
+
|
52
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lookup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -1848230057
|
5
4
|
prerelease: true
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 0
|
9
8
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.0.0.
|
9
|
+
- beta8
|
10
|
+
version: 1.0.0.beta8
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Ryan Bigg
|
@@ -21,66 +20,75 @@ default_executable:
|
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: bundler
|
24
|
-
|
25
|
-
prerelease: false
|
26
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
24
|
none: false
|
28
25
|
requirements:
|
29
26
|
- - ">="
|
30
27
|
- !ruby/object:Gem::Version
|
31
|
-
hash: 23
|
32
28
|
segments:
|
33
29
|
- 1
|
34
30
|
- 0
|
35
31
|
- 0
|
36
32
|
version: 1.0.0
|
37
|
-
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *id001
|
38
36
|
- !ruby/object:Gem::Dependency
|
39
37
|
name: sqlite3-ruby
|
40
|
-
|
41
|
-
prerelease: false
|
42
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
39
|
none: false
|
44
40
|
requirements:
|
45
41
|
- - ">="
|
46
42
|
- !ruby/object:Gem::Version
|
47
|
-
hash: 27
|
48
43
|
segments:
|
49
44
|
- 1
|
50
|
-
-
|
51
|
-
-
|
52
|
-
version: 1.
|
53
|
-
requirement: *id002
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: nokogiri
|
45
|
+
- 2
|
46
|
+
- 5
|
47
|
+
version: 1.2.5
|
56
48
|
type: :runtime
|
57
49
|
prerelease: false
|
58
|
-
version_requirements:
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: nokogiri
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
59
54
|
none: false
|
60
55
|
requirements:
|
61
56
|
- - ">="
|
62
57
|
- !ruby/object:Gem::Version
|
63
|
-
hash: 3
|
64
58
|
segments:
|
65
59
|
- 0
|
66
60
|
version: "0"
|
67
|
-
requirement: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: activerecord
|
70
61
|
type: :runtime
|
71
62
|
prerelease: false
|
72
|
-
version_requirements:
|
63
|
+
version_requirements: *id003
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: activerecord
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
67
|
none: false
|
74
68
|
requirements:
|
75
69
|
- - ">="
|
76
70
|
- !ruby/object:Gem::Version
|
77
|
-
hash: 19
|
78
71
|
segments:
|
79
72
|
- 2
|
80
73
|
- 3
|
81
74
|
- 8
|
82
75
|
version: 2.3.8
|
83
|
-
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: *id004
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: webmock
|
81
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
segments:
|
87
|
+
- 0
|
88
|
+
version: "0"
|
89
|
+
type: :runtime
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *id005
|
84
92
|
description: A gem that provides a lazy man's ri
|
85
93
|
email:
|
86
94
|
- radarlistener@gmail.com
|
@@ -98,20 +106,25 @@ files:
|
|
98
106
|
- README.md
|
99
107
|
- Rakefile
|
100
108
|
- bin/lookup
|
109
|
+
- config/lookup
|
101
110
|
- install.rb
|
102
111
|
- lib/lookup.rb
|
103
112
|
- lib/lookup.sqlite3
|
104
113
|
- lib/models.rb
|
105
114
|
- lookup.gemspec
|
115
|
+
- spec/.lookup/config
|
106
116
|
- spec/.lookup/lookup.sqlite3
|
107
117
|
- spec/apis/1.8/classes.html
|
108
118
|
- spec/apis/1.8/methods.html
|
109
119
|
- spec/apis/1.9/classes.html
|
110
120
|
- spec/apis/1.9/methods.html
|
121
|
+
- spec/apis/faker/classes.html
|
122
|
+
- spec/apis/faker/methods.html
|
111
123
|
- spec/apis/rails-2.3.8/classes.html
|
112
124
|
- spec/apis/rails-2.3.8/methods.html
|
113
125
|
- spec/apis/rails-3.0.0/classes.html
|
114
126
|
- spec/apis/rails-3.0.0/methods.html
|
127
|
+
- spec/config
|
115
128
|
- spec/lookup_spec.rb
|
116
129
|
- spec/regressions_spec.rb
|
117
130
|
- spec/spec_helper.rb
|
@@ -129,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
142
|
requirements:
|
130
143
|
- - ">="
|
131
144
|
- !ruby/object:Gem::Version
|
132
|
-
hash:
|
145
|
+
hash: -3416915888773412004
|
133
146
|
segments:
|
134
147
|
- 0
|
135
148
|
version: "0"
|
@@ -138,7 +151,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
151
|
requirements:
|
139
152
|
- - ">="
|
140
153
|
- !ruby/object:Gem::Version
|
141
|
-
hash: 23
|
142
154
|
segments:
|
143
155
|
- 1
|
144
156
|
- 3
|