dakrone-fastri 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +61 -0
- data/COPYING +340 -0
- data/LEGAL +4 -0
- data/LICENSE +56 -0
- data/README.en +102 -0
- data/Rakefile +26 -0
- data/THANKS +36 -0
- data/bin/fastri-server +251 -0
- data/bin/fri +353 -0
- data/bin/ri-emacs +202 -0
- data/fastri.gemspec +64 -0
- data/indexer.rb +135 -0
- data/lib/fastri/full_text_index.rb +245 -0
- data/lib/fastri/full_text_indexer.rb +100 -0
- data/lib/fastri/name_descriptor.rb +71 -0
- data/lib/fastri/ri_index.rb +601 -0
- data/lib/fastri/ri_service.rb +430 -0
- data/lib/fastri/util.rb +183 -0
- data/lib/fastri/version.rb +13 -0
- data/lookup.rb +197 -0
- data/pre-install.rb +11 -0
- data/setup.rb +1585 -0
- data/test/test_full_text_index.rb +182 -0
- data/test/test_full_text_indexer.rb +84 -0
- data/test/test_functional_ri_service.rb +60 -0
- data/test/test_integration_full_text_index.rb +43 -0
- data/test/test_name_descriptor.rb +35 -0
- data/test/test_ri_index.rb +389 -0
- data/test/test_util.rb +91 -0
- metadata +84 -0
data/test/test_util.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Copyright (C) 2006 Mauricio Fernandez <mfp@acm.org>
|
2
|
+
#
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
6
|
+
$:.unshift "lib"
|
7
|
+
require 'fastri/util'
|
8
|
+
|
9
|
+
class TestUtil < Test::Unit::TestCase
|
10
|
+
data = <<EOF
|
11
|
+
foo 0.1.1 /usr/local/lib/ruby/gems/1.8/doc/foo-0.1.1/ri
|
12
|
+
foo 1.1.1 /usr/local/lib/ruby/gems/1.8/doc/foo-1.1.1/ri
|
13
|
+
bar 0.1.1 /usr/local/lib/ruby/gems/1.8/doc/bar-0.1.1/ri
|
14
|
+
baz 0.1.1 /usr/local/lib/ruby/gems/1.8/doc/baz-0.1.1/ri
|
15
|
+
EOF
|
16
|
+
GEM_DIR_INFO = data.split(/\n/).map{|l| l.split(/\s+/)}
|
17
|
+
|
18
|
+
include FastRI::Util
|
19
|
+
def test_gem_info_for_path
|
20
|
+
assert_equal(["foo", "0.1.1", "/usr/local/lib/ruby/gems/1.8/doc/foo-0.1.1/ri"],
|
21
|
+
gem_info_for_path("/usr/local/lib/ruby/gems/1.8/doc/foo-0.1.1/ri/Array/cdesc-Array.yaml", GEM_DIR_INFO))
|
22
|
+
assert_equal(["foo", "1.1.1", "/usr/local/lib/ruby/gems/1.8/doc/foo-1.1.1/ri"],
|
23
|
+
gem_info_for_path("/usr/local/lib/ruby/gems/1.8/doc/foo-1.1.1/ri/Array/cdesc-Array.yaml", GEM_DIR_INFO))
|
24
|
+
assert_equal(["bar", "0.1.1", "/usr/local/lib/ruby/gems/1.8/doc/bar-0.1.1/ri"],
|
25
|
+
gem_info_for_path("/usr/local/lib/ruby/gems/1.8/doc/bar-0.1.1/ri/Array/cdesc-Array.yaml", GEM_DIR_INFO))
|
26
|
+
assert_equal(["baz", "0.1.1", "/usr/local/lib/ruby/gems/1.8/doc/baz-0.1.1/ri"],
|
27
|
+
gem_info_for_path("/usr/local/lib/ruby/gems/1.8/doc/baz-0.1.1/ri/Array/cdesc-Array.yaml", GEM_DIR_INFO))
|
28
|
+
assert_nil(gem_info_for_path("/usr/lib/ruby/gems/1.8/doc/baz-1.1.1/ri/Array/cdesc-Array.yaml", GEM_DIR_INFO))
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_gem_relpath_to_full_name
|
32
|
+
assert_equal("Array", gem_relpath_to_full_name("Array/cdesc-Array.yaml"))
|
33
|
+
assert_equal("String", gem_relpath_to_full_name("String/cdesc-String.yaml"))
|
34
|
+
assert_equal("Foo::Bar::String", gem_relpath_to_full_name("Foo/Bar/String/cdesc-String.yaml"))
|
35
|
+
assert_equal("Foo::Bar#eql?", gem_relpath_to_full_name("Foo/Bar/eql%3f-i.yaml"))
|
36
|
+
assert_equal("Foo::Bar.eql?", gem_relpath_to_full_name("Foo/Bar/eql%3f-c.yaml"))
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_change_query_method_type
|
40
|
+
assert_equal(".foo", change_query_method_type(".foo"))
|
41
|
+
assert_equal("::foo", change_query_method_type("#foo"))
|
42
|
+
assert_equal("#foo", change_query_method_type("::foo"))
|
43
|
+
assert_equal("A::B.foo", change_query_method_type("A::B.foo"))
|
44
|
+
assert_equal("A::B::foo", change_query_method_type("A::B#foo"))
|
45
|
+
assert_equal("A::B#foo", change_query_method_type("A::B::foo"))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class TestUtilMagicHelp < Test::Unit::TestCase
|
50
|
+
include FastRI::Util::MagicHelp
|
51
|
+
module TestModule
|
52
|
+
def foo; end
|
53
|
+
module_function :foo
|
54
|
+
|
55
|
+
def self.bar; end
|
56
|
+
def bar; end
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_magic_help
|
60
|
+
assert_equal("IO::readlines", magic_help("IO::readlines"))
|
61
|
+
assert_equal("IO::readlines", magic_help("IO.readlines"))
|
62
|
+
|
63
|
+
assert_equal("Enumerable#inject", magic_help("File#inject"))
|
64
|
+
assert_equal("Enumerable#inject", magic_help("File.inject"))
|
65
|
+
|
66
|
+
assert_equal("IO::readlines", magic_help("File.readlines"))
|
67
|
+
assert_equal("IO::readlines", magic_help("File::readlines"))
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_magic_help_nested_namespaces
|
71
|
+
assert_equal("TestUtilMagicHelp::TestModule#foo",
|
72
|
+
magic_help("TestUtilMagicHelp::TestModule.foo"))
|
73
|
+
assert_equal("TestUtilMagicHelp::TestModule::bar",
|
74
|
+
magic_help("TestUtilMagicHelp::TestModule.bar"))
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_magic_help__new
|
78
|
+
assert_equal("Array::new", magic_help("Array::new"))
|
79
|
+
assert_equal("Array::new", magic_help("Array.new"))
|
80
|
+
assert_equal("Struct::new", magic_help("Struct.new"))
|
81
|
+
assert_equal("Struct::new", magic_help("Struct::new"))
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_magic_help__Kernel_public_instance_methods
|
85
|
+
# It is mysterious.
|
86
|
+
# Object.instance_method(:object_id) # => #<UnboundMethod: Object(Kernel)#object_id>
|
87
|
+
assert_equal("Object#object_id", magic_help("Object.object_id"))
|
88
|
+
assert_equal("Object#object_id", magic_help("Object#object_id"))
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dakrone-fastri
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mauricio Fernandez
|
8
|
+
- Lee Hinman
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-07-17 00:00:00 -07:00
|
14
|
+
default_executable: fri
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: Fastri is RI, fast.
|
18
|
+
email: lee@writequit.org
|
19
|
+
executables:
|
20
|
+
- fastri-server
|
21
|
+
- fri
|
22
|
+
- ri-emacs
|
23
|
+
extensions: []
|
24
|
+
|
25
|
+
extra_rdoc_files:
|
26
|
+
- README.en
|
27
|
+
files:
|
28
|
+
- fastri.gemspec
|
29
|
+
- Rakefile
|
30
|
+
- README.en
|
31
|
+
- THANKS
|
32
|
+
- CHANGES
|
33
|
+
- COPYING
|
34
|
+
- LEGAL
|
35
|
+
- LICENSE
|
36
|
+
- bin/fastri-server
|
37
|
+
- bin/fri
|
38
|
+
- bin/ri-emacs
|
39
|
+
- lib/fastri/full_text_index.rb
|
40
|
+
- lib/fastri/full_text_indexer.rb
|
41
|
+
- lib/fastri/name_descriptor.rb
|
42
|
+
- lib/fastri/ri_index.rb
|
43
|
+
- lib/fastri/ri_service.rb
|
44
|
+
- lib/fastri/util.rb
|
45
|
+
- lib/fastri/version.rb
|
46
|
+
- indexer.rb
|
47
|
+
- lookup.rb
|
48
|
+
- pre-install.rb
|
49
|
+
- setup.rb
|
50
|
+
- test/test_full_text_index.rb
|
51
|
+
- test/test_full_text_indexer.rb
|
52
|
+
- test/test_functional_ri_service.rb
|
53
|
+
- test/test_integration_full_text_index.rb
|
54
|
+
- test/test_name_descriptor.rb
|
55
|
+
- test/test_ri_index.rb
|
56
|
+
- test/test_util.rb
|
57
|
+
has_rdoc: false
|
58
|
+
homepage: http://github.com/dakrone/fastri
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options:
|
61
|
+
- --charset=UTF-8
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: "0"
|
75
|
+
version:
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 1.2.0
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Fastri is RI, fast.
|
83
|
+
test_files: []
|
84
|
+
|