lookup 0.4.1 → 1.0.0.beta1
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/README.md +17 -20
- data/Rakefile +1 -0
- data/doc/classes/APILookup/Api.src/M000010.html +40 -0
- data/doc/classes/APILookup/Api.src/M000011.html +21 -0
- data/doc/classes/APILookup.src/M000003.html +24 -0
- data/doc/classes/APILookup.src/M000004.html +22 -0
- data/doc/classes/APILookup.src/M000005.html +33 -0
- data/doc/classes/APILookup.src/M000006.html +21 -0
- data/doc/classes/APILookup.src/M000007.html +33 -0
- data/doc/classes/APILookup.src/M000008.html +35 -0
- data/doc/classes/APILookup.src/M000009.html +52 -0
- data/doc/classes/SetupTables.src/M000001.html +18 -0
- data/doc/classes/SetupTables.src/M000002.html +34 -0
- data/doc/files/lib/lookup_rb.html +112 -0
- data/doc/files/lib/lookup_sqlite3.html +0 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/lookup.rb +31 -24
- data/lib/models.rb +5 -3
- data/spec/apis/{rails → rails-2.3.8}/classes.html +0 -0
- data/spec/apis/{rails → rails-2.3.8}/methods.html +0 -0
- data/spec/apis/rails-3.0.0/classes.html +850 -0
- data/spec/apis/rails-3.0.0/methods.html +10185 -0
- data/spec/lookup_spec.rb +23 -12
- data/spec/regressions_spec.rb +1 -1
- data/spec/spec_helper.rb +10 -8
- metadata +59 -14
- data/lib/config.rb +0 -5
data/spec/lookup_spec.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
3
|
describe "Lookup" do
|
4
|
+
before(:all) do
|
5
|
+
# APILookup.update!
|
6
|
+
end
|
4
7
|
|
5
8
|
def find_api(name)
|
6
9
|
APILookup::Api.find_by_name(name)
|
@@ -19,51 +22,59 @@ describe "Lookup" do
|
|
19
22
|
end
|
20
23
|
|
21
24
|
it "should be able to find a method in Ruby 1.9" do
|
22
|
-
search("shuffle").should eql(find_entry("Ruby 1.9", "Array", "shuffle"))
|
25
|
+
search("1.9 shuffle").should eql(find_entry("Ruby 1.9", "Array", "shuffle"))
|
23
26
|
end
|
24
27
|
|
25
28
|
it "should be able to lookup for Ruby 1.9 only" do
|
26
29
|
search("1.9 Array#flatten").should eql(find_entry("Ruby 1.9", "Array", "flatten"))
|
27
30
|
end
|
28
31
|
|
32
|
+
it "should lookup for 1.8" do
|
33
|
+
search("1.8 Array#flatten").should eql(find_entry("Ruby 1.8.7", "Array", "flatten"))
|
34
|
+
end
|
35
|
+
|
29
36
|
it "should be able to find a constant" do
|
30
|
-
search("ActiveRecord::Base").should eql([find_constant("Rails", "ActiveRecord::Base")])
|
37
|
+
search("v2.3.8 ActiveRecord::Base").should eql([find_constant("Rails v2.3.8", "ActiveRecord::Base")])
|
31
38
|
end
|
32
39
|
|
33
40
|
it "should be able to find a short constant" do
|
34
|
-
search("ar::Base").should eql([find_constant("Rails", "ActiveRecord::Base")])
|
41
|
+
search("v2.3.8 ar::Base").should eql([find_constant("Rails v2.3.8", "ActiveRecord::Base")])
|
35
42
|
end
|
36
43
|
|
37
44
|
it "should be able to find a constant and a method (using hash symbol)" do
|
38
|
-
search("ActiveRecord::Base#new").should eql(find_entry("Rails", "ActiveRecord::Base", "new"))
|
45
|
+
search("v2.3.8 ActiveRecord::Base#new").should eql(find_entry("Rails v2.3.8", "ActiveRecord::Base", "new"))
|
39
46
|
end
|
40
47
|
|
41
48
|
it "should be able to find a constant and a method (using spaces)" do
|
42
|
-
search("ActiveRecord::Base new").should eql(find_entry("Rails", "ActiveRecord::Base", "new"))
|
49
|
+
search("v2.3.8 ActiveRecord::Base new").should eql(find_entry("Rails v2.3.8", "ActiveRecord::Base", "new"))
|
43
50
|
end
|
44
51
|
|
45
52
|
it "should be able to find a constant and a method (specified wildcard)" do
|
46
|
-
search("ActiveRecord::Base#n*w").should eql(find_entry("Rails", "ActiveRecord::Base", "new"))
|
53
|
+
search("v2.3.8 ActiveRecord::Base#n*w").should eql(find_entry("Rails v2.3.8", "ActiveRecord::Base", "new"))
|
47
54
|
end
|
48
55
|
|
49
56
|
it "should be able to find a constant and some methods (fuzzy)" do
|
50
|
-
search("ActiveRecord::Base#nw").should eql([find_entry("Rails", "ActiveRecord::Base", "new"), find_entry("Rails", "ActiveRecord::Base", "new_record?")].flatten)
|
57
|
+
search("v2.3.8 ActiveRecord::Base#nw").should eql([find_entry("Rails v2.3.8", "ActiveRecord::Base", "new"), find_entry("Rails v2.3.8", "ActiveRecord::Base", "new_record?")].flatten)
|
51
58
|
end
|
52
59
|
|
53
60
|
it "should be able to find the constant and method by code examples" do
|
54
|
-
search("ActiveRecord::Base.destroy").should eql(find_entry("Rails", "ActiveRecord::Base", "destroy"))
|
61
|
+
search("v2.3.8 ActiveRecord::Base.destroy").should eql(find_entry("Rails v2.3.8", "ActiveRecord::Base", "destroy"))
|
55
62
|
end
|
56
63
|
|
57
64
|
it "should be able to search on shortened constants" do
|
58
|
-
search("ar::base#new").should eql(find_entry("Rails", "ActiveRecord::Base", "new"))
|
65
|
+
search("v2.3.8 ar::base#new").should eql(find_entry("Rails v2.3.8", "ActiveRecord::Base", "new"))
|
66
|
+
end
|
67
|
+
|
68
|
+
it "Should be able to find a Rails 3 constant" do
|
69
|
+
search("v3.0.0 Rails::Engine").should eql([find_constant("Rails v3.0.0", "Rails::Engine")])
|
59
70
|
end
|
60
71
|
|
61
72
|
it "should be able to find it if a hash-symbol is specified" do
|
62
73
|
# sort_by used here because once it returned it out of order.
|
63
74
|
# Ensure order.
|
64
|
-
APILookup.search("#today?").should eql([ find_entry("Rails", "ActiveSupport::CoreExtensions::Date::Calculations", "today?"),
|
65
|
-
find_entry("Rails", "ActiveSupport::TimeWithZone", "today?"),
|
66
|
-
find_entry("Rails", "ActiveSupport::CoreExtensions::Time::Calculations", "today?")
|
75
|
+
APILookup.search("v2.3.8 #today?").should eql([ find_entry("Rails v2.3.8", "ActiveSupport::CoreExtensions::Date::Calculations", "today?"),
|
76
|
+
find_entry("Rails v2.3.8", "ActiveSupport::TimeWithZone", "today?"),
|
77
|
+
find_entry("Rails v2.3.8", "ActiveSupport::CoreExtensions::Time::Calculations", "today?")
|
67
78
|
].flatten!.sort_by(&:id))
|
68
79
|
end
|
69
80
|
|
data/spec/regressions_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/spec_helper'
|
|
2
2
|
|
3
3
|
describe "testing for regressions" do
|
4
4
|
it "should not fail if an initial hash is specified" do
|
5
|
-
lambda { APILookup.search("#today?") }.should_not raise_error
|
5
|
+
lambda { APILookup.search("v2.3.8 #today?") }.should_not raise_error
|
6
6
|
end
|
7
7
|
|
8
8
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
$TESTING=true
|
2
2
|
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
|
3
3
|
ENV['HOME'] = File.dirname(__FILE__)
|
4
|
-
|
5
4
|
require 'rubygems'
|
6
|
-
require '
|
5
|
+
require 'bundler'
|
6
|
+
Bundler.require(:default, :test)
|
7
7
|
|
8
8
|
def here
|
9
9
|
Pathname.new(File.dirname(__FILE__))
|
@@ -25,8 +25,12 @@ include WebMock
|
|
25
25
|
|
26
26
|
WebMock.disable_net_connect!
|
27
27
|
|
28
|
-
|
29
|
-
stub_request(:get, "http://api.rubyonrails.org/
|
28
|
+
|
29
|
+
stub_request(:get, "http://api.rubyonrails.org/v2.3.8/fr_method_index.html").to_return(:body => entries("rails-2.3.8"))
|
30
|
+
stub_request(:get, "http://api.rubyonrails.org/v2.3.8/fr_class_index.html").to_return(:body => classes("rails-2.3.8"))
|
31
|
+
|
32
|
+
stub_request(:get, "http://api.rubyonrails.org/fr_method_index.html").to_return(:body => entries("rails-3.0.0"))
|
33
|
+
stub_request(:get, "http://api.rubyonrails.org/fr_class_index.html").to_return(:body => classes("rails-3.0.0"))
|
30
34
|
|
31
35
|
stub_request(:get, "http://www.ruby-doc.org/core/fr_method_index.html").to_return(:body => entries("1.8"))
|
32
36
|
stub_request(:get, "http://www.ruby-doc.org/core/fr_class_index.html").to_return(:body => classes("1.8"))
|
@@ -36,10 +40,8 @@ stub_request(:get, "http://ruby-doc.org/ruby-1.9/fr_class_index.html").to_return
|
|
36
40
|
|
37
41
|
|
38
42
|
require 'lookup'
|
39
|
-
require '
|
40
|
-
require 'spec/autorun'
|
41
|
-
require 'pathname'
|
43
|
+
# require 'pathname'
|
42
44
|
|
43
|
-
|
45
|
+
RSpec.configure do |config|
|
44
46
|
|
45
47
|
end
|
metadata
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lookup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: -1848230051
|
5
|
+
prerelease: true
|
5
6
|
segments:
|
6
|
-
- 0
|
7
|
-
- 4
|
8
7
|
- 1
|
9
|
-
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
- beta1
|
11
|
+
version: 1.0.0.beta1
|
10
12
|
platform: ruby
|
11
13
|
authors:
|
12
14
|
- Ryan Bigg
|
@@ -14,16 +16,18 @@ autorequire: lookup
|
|
14
16
|
bindir: bin
|
15
17
|
cert_chain: []
|
16
18
|
|
17
|
-
date: 2010-
|
19
|
+
date: 2010-09-10 00:00:00 +10:00
|
18
20
|
default_executable:
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
23
|
name: sqlite3-ruby
|
22
24
|
prerelease: false
|
23
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
24
27
|
requirements:
|
25
28
|
- - ">="
|
26
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 21
|
27
31
|
segments:
|
28
32
|
- 1
|
29
33
|
- 2
|
@@ -35,26 +39,46 @@ dependencies:
|
|
35
39
|
name: nokogiri
|
36
40
|
prerelease: false
|
37
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
38
43
|
requirements:
|
39
44
|
- - ">="
|
40
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
41
47
|
segments:
|
42
48
|
- 0
|
43
49
|
version: "0"
|
44
50
|
type: :runtime
|
45
51
|
version_requirements: *id002
|
46
52
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
53
|
+
name: activerecord
|
48
54
|
prerelease: false
|
49
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
50
57
|
requirements:
|
51
58
|
- - ">="
|
52
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 19
|
61
|
+
segments:
|
62
|
+
- 2
|
63
|
+
- 3
|
64
|
+
- 8
|
65
|
+
version: 2.3.8
|
66
|
+
type: :runtime
|
67
|
+
version_requirements: *id003
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: webmock
|
70
|
+
prerelease: false
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
53
77
|
segments:
|
54
78
|
- 0
|
55
79
|
version: "0"
|
56
80
|
type: :development
|
57
|
-
version_requirements: *
|
81
|
+
version_requirements: *id004
|
58
82
|
description: A gem that provides a lazy man's ri
|
59
83
|
email: radarlistener@gmail.com
|
60
84
|
executables:
|
@@ -72,7 +96,20 @@ files:
|
|
72
96
|
- Rakefile
|
73
97
|
- TODO
|
74
98
|
- bin/lookup
|
75
|
-
-
|
99
|
+
- doc/classes/APILookup.src/M000003.html
|
100
|
+
- doc/classes/APILookup.src/M000004.html
|
101
|
+
- doc/classes/APILookup.src/M000005.html
|
102
|
+
- doc/classes/APILookup.src/M000006.html
|
103
|
+
- doc/classes/APILookup.src/M000007.html
|
104
|
+
- doc/classes/APILookup.src/M000008.html
|
105
|
+
- doc/classes/APILookup.src/M000009.html
|
106
|
+
- doc/classes/APILookup/Api.src/M000010.html
|
107
|
+
- doc/classes/APILookup/Api.src/M000011.html
|
108
|
+
- doc/classes/SetupTables.src/M000001.html
|
109
|
+
- doc/classes/SetupTables.src/M000002.html
|
110
|
+
- doc/files/lib/lookup_rb.html
|
111
|
+
- doc/files/lib/lookup_sqlite3.html
|
112
|
+
- doc/rdoc-style.css
|
76
113
|
- lib/lookup.rb
|
77
114
|
- lib/lookup.sqlite3
|
78
115
|
- lib/models.rb
|
@@ -80,8 +117,10 @@ files:
|
|
80
117
|
- spec/apis/1.8/methods.html
|
81
118
|
- spec/apis/1.9/classes.html
|
82
119
|
- spec/apis/1.9/methods.html
|
83
|
-
- spec/apis/rails/classes.html
|
84
|
-
- spec/apis/rails/methods.html
|
120
|
+
- spec/apis/rails-2.3.8/classes.html
|
121
|
+
- spec/apis/rails-2.3.8/methods.html
|
122
|
+
- spec/apis/rails-3.0.0/classes.html
|
123
|
+
- spec/apis/rails-3.0.0/methods.html
|
85
124
|
- spec/lookup_spec.rb
|
86
125
|
- spec/regressions_spec.rb
|
87
126
|
- spec/spec_helper.rb
|
@@ -95,23 +134,29 @@ rdoc_options:
|
|
95
134
|
require_paths:
|
96
135
|
- lib
|
97
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
98
138
|
requirements:
|
99
139
|
- - ">="
|
100
140
|
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
101
142
|
segments:
|
102
143
|
- 0
|
103
144
|
version: "0"
|
104
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
105
147
|
requirements:
|
106
|
-
- - "
|
148
|
+
- - ">"
|
107
149
|
- !ruby/object:Gem::Version
|
150
|
+
hash: 25
|
108
151
|
segments:
|
109
|
-
-
|
110
|
-
|
152
|
+
- 1
|
153
|
+
- 3
|
154
|
+
- 1
|
155
|
+
version: 1.3.1
|
111
156
|
requirements: []
|
112
157
|
|
113
158
|
rubyforge_project:
|
114
|
-
rubygems_version: 1.3.
|
159
|
+
rubygems_version: 1.3.7
|
115
160
|
signing_key:
|
116
161
|
specification_version: 3
|
117
162
|
summary: A gem that provides a lazy man's ri
|