fxri 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ require 'rubygems'
4
4
  spec = Gem::Specification.new do |s|
5
5
  s.name = "fxri"
6
6
  s.add_dependency('fxruby', '>= 1.2.0')
7
- s.version = "0.3.6"
7
+ s.version = "0.3.7"
8
8
  s.date = Time.now
9
9
  s.summary = "Graphical interface to the RI documentation, with search engine."
10
10
  s.require_paths = ["lib"]
data/fxri.rb CHANGED
@@ -8,7 +8,7 @@ Dir.chdir(File.dirname(File.expand_path(__FILE__)))
8
8
  begin
9
9
  # try fxruby gem
10
10
  require 'rubygems'
11
- require_gem 'fxruby', '= 1.6'
11
+ gem 'fxruby', '= 1.6'
12
12
  require 'fox16'
13
13
  require 'fox16/colors'
14
14
  FOXVERSION="1.6"
@@ -23,7 +23,7 @@ rescue LoadError
23
23
  rescue
24
24
  # Workaround for Windows OCI: Use fox12
25
25
  begin
26
- require_gem 'fxruby'
26
+ gem 'fxruby'
27
27
  require 'fox12'
28
28
  require 'fox12/colors'
29
29
  FOXVERSION="1.2"
@@ -282,6 +282,7 @@ class FXri < FXHorizontalFrame
282
282
  # loads all ri items
283
283
  def load_items
284
284
  @gui.search_field.text = "loading..."
285
+ @gui.packet_list.hide
285
286
  @data.ri_manager.all_names.each do |name|
286
287
  icon = case name.type
287
288
  when NameDescriptor::CLASS
@@ -300,6 +301,7 @@ class FXri < FXHorizontalFrame
300
301
  @gui.packet_list.on_cmd_header(0)
301
302
  @gui.packet_list.update_header_width
302
303
  recalc
304
+ @gui.packet_list.show
303
305
  end
304
306
 
305
307
  def go_search(string)
@@ -1,50 +1,50 @@
1
- require 'lib/Recursive_Open_Struct'
2
-
3
- $cfg = Recursive_Open_Struct.new
4
-
5
- $cfg.app.name = "fxri - Instant Ruby Enlightenment"
6
-
7
- $cfg.delayed_loading = false
8
-
9
- $cfg.search_paths = ENV['FXRI_SEARCH_PATH'] if ENV.has_key?('FXRI_SEARCH_PATH')
10
-
11
- # uses the first font that is available
12
- $cfg.app.font.name = ["Bitstream Vera Sans", "Verdana", "Trebuchet MS", "Tahoma", "Arial"]
13
- $cfg.ri_font = ["Bitstream Vera Sans Mono", "Courier New", "Courier"]
14
- $cfg.app.font.size = 8
15
-
16
- $cfg.app.width = 760
17
- $cfg.app.height = 480
18
- $cfg.search_delay = 0.1
19
- $cfg.minimum_letters_per_line = 20
20
- $cfg.packet_list_width = 160
21
- $cfg.irb_height = 300
22
- $cfg.status_line_update_interval = 0.1
23
-
24
- $cfg.list.opts = ICONLIST_SINGLESELECT|ICONLIST_DETAILED|LAYOUT_FILL_X|LAYOUT_FILL_Y|ICONLIST_AUTOSIZE
25
-
26
- # icons, are automatically loaded from Icon_Loader.
27
- $cfg.icons_path = File.join("lib","icons")
28
- $cfg.icons.klass = "class.png"
29
- $cfg.icons.class_method = "module.png"
30
- $cfg.icons.instance_method = "method.png"
31
-
32
- # all texts
33
- $cfg.text.search = "%d / %d entries"
34
- $cfg.text.search_field = "What do you want to know?"
35
- $cfg.text.method_name = "name"
36
-
37
- # IRB
38
- $cfg.launch_irb = true
39
-
40
- $cfg.text.help = %|This is <b>fxri</b>, a graphical interface to the <em>Ruby</em> documentation. Fxri comes with a search engine with quite a few features. Here are several examples:
41
- '<em>Array</em>': Lists all classes with the name <em>Array</em>. Note that upcase words are treated case sensitive, lowercase words insensitive.
42
- '<em>array sort</em>': Everything that contains both <em>array</em> and <em>sort</em> (case insensitive).
43
- '<em>array -Fox</em>': Everything that contain the name <em>array</em> (case insensitive), but not <em>Fox</em> (case sensitive).
44
- After searching just press <em>down</em> to browse the search results. Press <em>Tab</em> to move back into the search field.
45
- If you have any questions, suggestions, problems, please contact the current maintainer with <b>markus.prinz@qsig.org</b>.
46
- Original author: Martin Ankerl (<b>martin.ankerl@gmail.com</b>).|
47
-
48
-
49
- # prevent further modifications
50
- $cfg.close
1
+ require 'lib/Recursive_Open_Struct'
2
+
3
+ $cfg = Recursive_Open_Struct.new
4
+
5
+ $cfg.app.name = "fxri - Instant Ruby Enlightenment"
6
+
7
+ $cfg.delayed_loading = false
8
+
9
+ $cfg.search_paths = ENV['FXRI_SEARCH_PATH'] if ENV.has_key?('FXRI_SEARCH_PATH')
10
+
11
+ # uses the first font that is available
12
+ $cfg.app.font.name = ["Bitstream Vera Sans", "Verdana", "Trebuchet MS", "Tahoma", "Arial"]
13
+ $cfg.ri_font = ["Bitstream Vera Sans Mono", "Courier New", "Courier"]
14
+ $cfg.app.font.size = 8
15
+
16
+ $cfg.app.width = 760
17
+ $cfg.app.height = 480
18
+ $cfg.search_delay = 0.1
19
+ $cfg.minimum_letters_per_line = 20
20
+ $cfg.packet_list_width = 160
21
+ $cfg.irb_height = 300
22
+ $cfg.status_line_update_interval = 0.1
23
+
24
+ $cfg.list.opts = ICONLIST_SINGLESELECT|ICONLIST_DETAILED|LAYOUT_FILL_X|LAYOUT_FILL_Y|ICONLIST_AUTOSIZE
25
+
26
+ # icons, are automatically loaded from Icon_Loader.
27
+ $cfg.icons_path = File.join("lib","icons")
28
+ $cfg.icons.klass = "class.png"
29
+ $cfg.icons.class_method = "module.png"
30
+ $cfg.icons.instance_method = "method.png"
31
+
32
+ # all texts
33
+ $cfg.text.search = "%d / %d entries"
34
+ $cfg.text.search_field = "What do you want to know?"
35
+ $cfg.text.method_name = "name"
36
+
37
+ # IRB
38
+ $cfg.launch_irb = true
39
+
40
+ $cfg.text.help = %|This is <b>fxri</b>, a graphical interface to the <em>Ruby</em> documentation. Fxri comes with a search engine with quite a few features. Here are several examples:
41
+ '<em>Array</em>': Lists all classes with the name <em>Array</em>. Note that upcase words are treated case sensitive, lowercase words insensitive.
42
+ '<em>array sort</em>': Everything that contains both <em>array</em> and <em>sort</em> (case insensitive).
43
+ '<em>array -Fox</em>': Everything that contain the name <em>array</em> (case insensitive), but not <em>Fox</em> (case sensitive).
44
+ After searching just press <em>down</em> to browse the search results. Press <em>Tab</em> to move back into the search field.
45
+ If you have any questions, suggestions, problems, please contact the current maintainer with <b>markus.prinz@qsig.org</b>.
46
+ Original author: Martin Ankerl (<b>martin.ankerl@gmail.com</b>).|
47
+
48
+
49
+ # prevent further modifications
50
+ $cfg.close
@@ -1,160 +1,160 @@
1
- require "yaml"
2
- require 'rdoc/ri/ri_driver'
3
- require 'pp'
4
-
5
- class NameDescriptor
6
- CLASS = 0
7
- INSTANCE_METHOD = 1
8
- CLASS_METHOD = 2
9
- def type
10
- @method_name ||= false
11
- @is_class_method ||= false
12
- if @method_name
13
- if @is_class_method
14
- CLASS_METHOD
15
- else
16
- INSTANCE_METHOD
17
- end
18
- else
19
- CLASS
20
- end
21
- end
22
-
23
- def to_s
24
- str = ""
25
- str << @class_names.join("::")
26
- if @method_name && str != ""
27
- str << (@is_class_method ? "::" : "#")
28
- end
29
- str << @method_name if @method_name
30
- str
31
- end
32
- end
33
-
34
- # This basically is a stripped down version of RiDriver.
35
- # I cannot use RiDriver directly, because I need to set the driver.
36
- class RiManager
37
- def initialize(display, path = RI::Paths::PATH)
38
- # See if search_paths exists, if so, append it to path
39
- begin
40
- path << $cfg.search_paths.split(';')
41
- rescue
42
- end
43
- @reader = RI::RiReader.new(RI::RiCache.new(path))
44
- @display = display
45
- @display.reader = @reader
46
- # prepare all names
47
- @all_names = prepare_all_names
48
- end
49
-
50
- def prepare_all_names
51
- names = Array.new
52
- @reader.all_names.each do |name|
53
- begin
54
- names.push NameDescriptor.new(name)
55
- rescue RiError => e
56
- # silently ignore errors
57
- end
58
- end
59
- names
60
- end
61
-
62
- def check_names
63
- @reader.all_names.each do |name|
64
- begin
65
- if (NameDescriptor.new(name).to_s != name)
66
- p [name, NameDescriptor.new(name).to_s, NameDescriptor.new(name)]
67
- end
68
- rescue RiError => e
69
- puts e
70
- end
71
- end
72
- end
73
-
74
- # Returns all fully names as name descriptors
75
- def all_names
76
- @all_names
77
- end
78
-
79
- # Searches for the description of a name and shows it using +display+.
80
- def show(name_descriptor, width)
81
- @display.width = width
82
- # narrow down namespace
83
- namespace = @reader.top_level_namespace
84
- name_descriptor.class_names.each do |classname|
85
- namespace = @reader.lookup_namespace_in(classname, namespace)
86
- if namespace.empty?
87
- raise RiError.new("Nothing known about #{name_descriptor}")
88
- end
89
- end
90
-
91
- # At this point, if we have multiple possible namespaces, but one
92
- # is an exact match for our requested class, prune down to just it
93
- # PS: this comment is shamlessly stolen from ri_driver.rb
94
- entries = namespace.find_all {|m| m.full_name == name_descriptor.full_class_name}
95
- namespace = entries if entries.size == 1
96
-
97
- if name_descriptor.method_name
98
- methods = @reader.find_methods(name_descriptor.method_name, name_descriptor.is_class_method, namespace)
99
- report_method_stuff(name_descriptor.method_name, methods)
100
- else
101
- report_class_stuff(namespace)
102
- end
103
- end
104
-
105
- def report_class_stuff(namespace)
106
- raise RiError.new("namespace") unless namespace.size==1
107
- @display.display_class_info @reader.get_class(namespace[0])
108
- end
109
-
110
- def report_method_stuff(requested_method_name, methods)
111
- if methods.size == 1
112
- method = @reader.get_method(methods[0])
113
- @display.display_method_info(method)
114
- else
115
- entries = methods.find_all {|m| m.name == requested_method_name}
116
- if entries.size == 1
117
- method = @reader.get_method(entries[0])
118
- @display.display_method_info(method)
119
- else
120
- puts methods.map {|m| m.full_name}.join(", ")
121
- end
122
- end
123
- =begin
124
-
125
- method = if (methods.size == 1)
126
- @reader.get_method(methods[0])
127
- else
128
- entries = methods.find_all {|m| m.name == requested_method_name}
129
- entries.size
130
- # there really should be just *one* method that matches.
131
- raise RiError.new("got a strange method") unless entries.size == 1
132
- @reader.get_method(entries[0])
133
- end
134
- @display.display_method_info(method)
135
- =end
136
- end
137
- end
138
-
139
- if __FILE__ == $0
140
- display = Displayer.new
141
- ri = RiManager.new(display)
142
- ri.all_names.each do |name|
143
- p [name.type, name.to_s] if name.type==0
144
- end
145
- end
146
-
147
-
148
- =begin
149
- # iterate through everything
150
- reader.full_class_names.sort.each do |class_name|
151
- classDesc = reader.find_class_by_name(class_name)
152
-
153
- if class_name=="Integer"
154
- pp classDesc.instance_methods
155
- puts classDesc.to_yaml
156
- #puts classDesc.methods
157
- gets
158
- end
159
- end
1
+ require "yaml"
2
+ require 'rdoc/ri/ri_driver'
3
+ require 'pp'
4
+
5
+ class NameDescriptor
6
+ CLASS = 0
7
+ INSTANCE_METHOD = 1
8
+ CLASS_METHOD = 2
9
+ def type
10
+ @method_name ||= false
11
+ @is_class_method ||= false
12
+ if @method_name
13
+ if @is_class_method
14
+ CLASS_METHOD
15
+ else
16
+ INSTANCE_METHOD
17
+ end
18
+ else
19
+ CLASS
20
+ end
21
+ end
22
+
23
+ def to_s
24
+ str = ""
25
+ str << @class_names.join("::")
26
+ if @method_name && str != ""
27
+ str << (@is_class_method ? "::" : "#")
28
+ end
29
+ str << @method_name if @method_name
30
+ str
31
+ end
32
+ end
33
+
34
+ # This basically is a stripped down version of RiDriver.
35
+ # I cannot use RiDriver directly, because I need to set the driver.
36
+ class RiManager
37
+ def initialize(display, path = RI::Paths::PATH)
38
+ # See if search_paths exists, if so, append it to path
39
+ begin
40
+ path << $cfg.search_paths.split(';')
41
+ rescue
42
+ end
43
+ @reader = RI::RiReader.new(RI::RiCache.new(path))
44
+ @display = display
45
+ @display.reader = @reader
46
+ # prepare all names
47
+ @all_names = prepare_all_names
48
+ end
49
+
50
+ def prepare_all_names
51
+ names = Array.new
52
+ @reader.all_names.each do |name|
53
+ begin
54
+ names.push NameDescriptor.new(name)
55
+ rescue RiError => e
56
+ # silently ignore errors
57
+ end
58
+ end
59
+ names
60
+ end
61
+
62
+ def check_names
63
+ @reader.all_names.each do |name|
64
+ begin
65
+ if (NameDescriptor.new(name).to_s != name)
66
+ p [name, NameDescriptor.new(name).to_s, NameDescriptor.new(name)]
67
+ end
68
+ rescue RiError => e
69
+ puts e
70
+ end
71
+ end
72
+ end
73
+
74
+ # Returns all fully names as name descriptors
75
+ def all_names
76
+ @all_names
77
+ end
78
+
79
+ # Searches for the description of a name and shows it using +display+.
80
+ def show(name_descriptor, width)
81
+ @display.width = width
82
+ # narrow down namespace
83
+ namespace = @reader.top_level_namespace
84
+ name_descriptor.class_names.each do |classname|
85
+ namespace = @reader.lookup_namespace_in(classname, namespace)
86
+ if namespace.empty?
87
+ raise RiError.new("Nothing known about #{name_descriptor}")
88
+ end
89
+ end
90
+
91
+ # At this point, if we have multiple possible namespaces, but one
92
+ # is an exact match for our requested class, prune down to just it
93
+ # PS: this comment is shamlessly stolen from ri_driver.rb
94
+ entries = namespace.find_all {|m| m.full_name == name_descriptor.full_class_name}
95
+ namespace = entries if entries.size == 1
96
+
97
+ if name_descriptor.method_name
98
+ methods = @reader.find_methods(name_descriptor.method_name, name_descriptor.is_class_method, namespace)
99
+ report_method_stuff(name_descriptor.method_name, methods)
100
+ else
101
+ report_class_stuff(namespace)
102
+ end
103
+ end
104
+
105
+ def report_class_stuff(namespace)
106
+ raise RiError.new("namespace") unless namespace.size==1
107
+ @display.display_class_info @reader.get_class(namespace[0])
108
+ end
109
+
110
+ def report_method_stuff(requested_method_name, methods)
111
+ if methods.size == 1
112
+ method = @reader.get_method(methods[0])
113
+ @display.display_method_info(method)
114
+ else
115
+ entries = methods.find_all {|m| m.name == requested_method_name}
116
+ if entries.size == 1
117
+ method = @reader.get_method(entries[0])
118
+ @display.display_method_info(method)
119
+ else
120
+ puts methods.map {|m| m.full_name}.join(", ")
121
+ end
122
+ end
123
+ =begin
124
+
125
+ method = if (methods.size == 1)
126
+ @reader.get_method(methods[0])
127
+ else
128
+ entries = methods.find_all {|m| m.name == requested_method_name}
129
+ entries.size
130
+ # there really should be just *one* method that matches.
131
+ raise RiError.new("got a strange method") unless entries.size == 1
132
+ @reader.get_method(entries[0])
133
+ end
134
+ @display.display_method_info(method)
135
+ =end
136
+ end
137
+ end
138
+
139
+ if __FILE__ == $0
140
+ display = Displayer.new
141
+ ri = RiManager.new(display)
142
+ ri.all_names.each do |name|
143
+ p [name.type, name.to_s] if name.type==0
144
+ end
145
+ end
146
+
147
+
148
+ =begin
149
+ # iterate through everything
150
+ reader.full_class_names.sort.each do |class_name|
151
+ classDesc = reader.find_class_by_name(class_name)
152
+
153
+ if class_name=="Integer"
154
+ pp classDesc.instance_methods
155
+ puts classDesc.to_yaml
156
+ #puts classDesc.methods
157
+ gets
158
+ end
159
+ end
160
160
  =end
File without changes
metadata CHANGED
@@ -1,73 +1,80 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
3
- specification_version: 1
4
2
  name: fxri
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.3.6
7
- date: 2006-12-18 00:00:00 +01:00
8
- summary: Graphical interface to the RI documentation, with search engine.
9
- require_paths:
10
- - lib
11
- email: markus.prinz@qsig.org
12
- homepage: http://rubyforge.org/projects/fxri/
13
- rubyforge_project: fxri
14
- description: FxRi is an FXRuby interface to the RI documentation, with a search engine that allows for search-on-typing.
15
- autorequire:
16
- default_executable:
17
- bindir: .
18
- has_rdoc: false
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.3.7
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors: []
30
7
 
8
+ autorequire:
9
+ bindir: .
10
+ cert_chain: []
11
+
12
+ date: 2008-09-20 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: fxruby
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.0
24
+ version:
25
+ description: FxRi is an FXRuby interface to the RI documentation, with a search engine that allows for search-on-typing.
26
+ email: markus.prinz@qsig.org
27
+ executables:
28
+ - fxri
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
31
33
  files:
32
- - lib
33
34
  - fxri
34
35
  - fxri.gemspec
35
- - fxri-0.3.6.tar.gz
36
36
  - fxri.rb
37
+ - lib
38
+ - lib/Empty_Text_Field_Handler.rb
37
39
  - lib/FoxDisplayer.rb
40
+ - lib/FoxTextFormatter.rb
41
+ - lib/fxirb.rb
42
+ - lib/Globals.rb
43
+ - lib/Icon_Loader.rb
38
44
  - lib/icons
45
+ - lib/icons/class.png
46
+ - lib/icons/method.png
47
+ - lib/icons/module.png
48
+ - lib/Packet_Item.rb
49
+ - lib/Packet_List.rb
39
50
  - lib/Recursive_Open_Struct.rb
40
51
  - lib/RiManager.rb
41
- - lib/Globals.rb
42
- - lib/fxirb.rb
43
- - lib/Packet_Item.rb
44
52
  - lib/Search_Engine.rb
45
- - lib/Empty_Text_Field_Handler.rb
46
- - lib/FoxTextFormatter.rb
47
- - lib/Packet_List.rb
48
- - lib/Icon_Loader.rb
49
- - lib/icons/module.png
50
- - lib/icons/method.png
51
- - lib/icons/class.png
52
- test_files: []
53
-
53
+ has_rdoc: false
54
+ homepage: http://rubyforge.org/projects/fxri/
55
+ post_install_message:
54
56
  rdoc_options: []
55
57
 
56
- extra_rdoc_files: []
57
-
58
- executables:
59
- - fxri
60
- extensions: []
61
-
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ version:
62
72
  requirements: []
63
73
 
64
- dependencies:
65
- - !ruby/object:Gem::Dependency
66
- name: fxruby
67
- version_requirement:
68
- version_requirements: !ruby/object:Gem::Version::Requirement
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 1.2.0
73
- version:
74
+ rubyforge_project: fxri
75
+ rubygems_version: 1.2.0
76
+ signing_key:
77
+ specification_version: 2
78
+ summary: Graphical interface to the RI documentation, with search engine.
79
+ test_files: []
80
+
Binary file