ihelp 0.4.2 → 0.4.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.
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'rubygems'
4
+ require 'ihelp'
5
+ begin
6
+ require 'ferret'
7
+ rescue Exception
8
+ STDERR.puts "Unable to load Ferret, can't update full text index."
9
+ STDERR.puts "Try `gem install ferret' if you don't have already."
10
+ exit 1
11
+ end
12
+
13
+ IHelp::IHelpIndex.reindex_when_needed = true
14
+ idx = IHelp::IHelpIndex.new
15
+ if idx.path == IHelp::IHelpIndex::GLOBAL_INDEX_PATH
16
+ begin
17
+ STDERR.puts
18
+ STDERR.puts 'Making global index at '+idx.path+' readable'
19
+ Dir[File.join(idx.path,"*")].each{|n| File.chmod 0644, n }
20
+ end
21
+ end
@@ -110,7 +110,7 @@ end
110
110
  # Author: Ilmari Heikkinen <kig misfiring net>
111
111
  #
112
112
  module IHelp
113
- HELP_VERSION = "0.4.2"
113
+ HELP_VERSION = "0.4.3"
114
114
  end
115
115
 
116
116
 
@@ -656,6 +656,10 @@ module IHelp
656
656
  STDERR.puts str if level >= @log_level
657
657
  end
658
658
 
659
+ def path
660
+ @index_path
661
+ end
662
+
659
663
  def time
660
664
  t = Time.now
661
665
  rv = yield
@@ -721,14 +725,14 @@ module IHelp
721
725
  @index << {
722
726
  :name => hd.full_name,
723
727
  :full_name => n,
724
- :content => hd.to_text
728
+ :content => wrap_str(hd.to_text)
725
729
  }
726
730
  }
727
731
  if @log_level == DEFAULT_LOG_LEVEL
728
732
  amt_done = (i.to_f / names.size)
729
733
  pct = ("%.1f" % [100*amt_done]).rjust(5)
730
734
  STDERR.write "\r #{pct}% (#{i.to_s.rjust(nsz.size)}/#{nsz}) #{names.last}".ljust(80)[0,80]
731
- STDERR.flush
735
+ STDERR.puts
732
736
  end
733
737
  if start_size != @index.size
734
738
  log "Optimizing index... (old size #{start_size}, current size #{@index.size})"
@@ -761,6 +765,15 @@ module IHelp
761
765
  display.formatter.wrap(str)
762
766
  end
763
767
 
768
+ def wrap_str(str)
769
+ $stdout = StringIO.new
770
+ wrap(str)
771
+ $stdout.rewind
772
+ s = $stdout.read
773
+ $stdout = STDOUT
774
+ s
775
+ end
776
+
764
777
  def init_display
765
778
  display
766
779
  end
@@ -790,9 +803,10 @@ module IHelp
790
803
  #puts hit.score
791
804
  puts "#{name_start}#{@index[id][:full_name]}#{name_end}"
792
805
  puts
793
- wrap @index.highlight(query, id, :field => :content,
806
+ puts @index.highlight(query, id, :field => :content,
794
807
  :pre_tag => pre_tag,
795
- :post_tag => post_tag).to_s
808
+ :post_tag => post_tag,
809
+ :ellipsis => "...\n").to_s
796
810
  puts
797
811
  display.formatter.draw_line
798
812
  puts
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ihelp
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.2
6
+ version: 0.4.3
7
7
  date: 2006-11-17 00:00:00 +02:00
8
8
  summary: Interactive help
9
9
  require_paths:
@@ -30,26 +30,17 @@ authors:
30
30
  - Ilmari Heikkinen
31
31
  files:
32
32
  - lib/ihelp.rb
33
- - lib/ihelp_reindex.rb
34
33
  test_files: []
35
34
 
36
35
  rdoc_options: []
37
36
 
38
37
  extra_rdoc_files: []
39
38
 
40
- executables: []
41
-
39
+ executables:
40
+ - ihelp_reindex.rb
42
41
  extensions: []
43
42
 
44
43
  requirements: []
45
44
 
46
- dependencies:
47
- - !ruby/object:Gem::Dependency
48
- name: ferret
49
- version_requirement:
50
- version_requirements: !ruby/object:Gem::Version::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 0.10.13
55
- version:
45
+ dependencies: []
46
+
@@ -1,12 +0,0 @@
1
- load File.join(File.expand_path(File.dirname(__FILE__)), 'ihelp.rb')
2
-
3
- IHelp::IHelpIndex.reindex_when_needed = true
4
- IHelp::IHelpIndex.new(true)
5
- begin
6
- path = IHelp::IHelpIndex::GLOBAL_INDEX_PATH
7
- STDERR.puts
8
- STDERR.puts 'Making global index at '+path+' readable'
9
- Dir[File.join(path,"*")].each{|n| File.chmod 0644, n }
10
- File.open("Makefile",'w'){|f| f.puts "install:" }
11
- end
12
-