code_zauker 0.0.2 → 0.0.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.
- data/BUGS.org +4 -0
- data/CHANGELOG.org +15 -0
- data/LICENSE.txt +674 -0
- data/Rakefile +11 -2
- data/bin/czindexer +46 -39
- data/bin/czsearch +85 -4
- data/code_zauker.gemspec +1 -0
- data/doc/CodeZauker.html +42 -13
- data/doc/CodeZauker/FileScanner.html +373 -183
- data/doc/CodeZauker/Util.html +360 -0
- data/doc/Grep.html +344 -0
- data/doc/_index.html +31 -3
- data/doc/class_list.html +1 -1
- data/doc/frames.html +1 -1
- data/doc/index.html +31 -3
- data/doc/method_list.html +48 -0
- data/doc/top-level-namespace.html +3 -3
- data/lib/code_zauker.rb +182 -41
- data/lib/code_zauker/constants.rb +19 -7
- data/lib/code_zauker/grep.rb +17 -13
- data/lib/code_zauker/version.rb +1 -1
- data/readme.org +19 -8
- data/test/fixture/TEST_LICENSE.txt +0 -970
- data/test/fixture/kurukku.txt +3 -1
- data/test/fixture/testArchive.zip +0 -0
- data/test/test_search.rb +87 -12
- metadata +25 -8
    
        data/test/fixture/kurukku.txt
    CHANGED
    
    
| Binary file | 
    
        data/test/test_search.rb
    CHANGED
    
    | @@ -67,7 +67,7 @@ class FileScannerBasicSearch < Test::Unit::TestCase | |
| 67 67 | 
             
              def test_very_big_file
         | 
| 68 68 | 
             
                fs=CodeZauker::FileScanner.new()
         | 
| 69 69 | 
             
                fs.load("./test/fixture/TEST_LICENSE.txt",noReload=true)
         | 
| 70 | 
            -
                files=fs.search(" | 
| 70 | 
            +
                files=fs.search('"Commercial Use"')
         | 
| 71 71 | 
             
                assert files.include?("./test/fixture/TEST_LICENSE.txt")==true
         | 
| 72 72 | 
             
              end
         | 
| 73 73 |  | 
| @@ -81,19 +81,94 @@ class FileScannerBasicSearch < Test::Unit::TestCase | |
| 81 81 | 
             
                #assert(files[0].include?("test/fixture/kurukku.txt")==true)
         | 
| 82 82 | 
             
              end
         | 
| 83 83 |  | 
| 84 | 
            -
              def test_removeAll
         | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 84 | 
            +
              # def test_removeAll
         | 
| 85 | 
            +
              #   require 'redis/connection/hiredis'
         | 
| 86 | 
            +
              #   require 'redis'
         | 
| 87 | 
            +
              #   redis=Redis.new
         | 
| 88 | 
            +
              #   fs=CodeZauker::FileScanner.new(redis)
         | 
| 89 | 
            +
              #   fs.load("./test/fixture/kurukku.txt", noReload=true) 
         | 
| 90 | 
            +
              #   fs.removeAll()
         | 
| 91 | 
            +
              #   foundKeys=redis.keys "*"
         | 
| 92 | 
            +
              #   #puts "Keys at empty db:#{foundKeys}"
         | 
| 93 | 
            +
              #   assert foundKeys.length==0, "Expected empty db. Found instead #{foundKeys}"
         | 
| 94 | 
            +
              # end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
              # # 2012 Jan 30 New Case Insensitive Test cases
         | 
| 97 | 
            +
              def test_case_insensitive1
         | 
| 98 | 
            +
                fs=CodeZauker::FileScanner.new()
         | 
| 99 | 
            +
                fs.load("./test/fixture/kurukku.txt", noReload=true)
         | 
| 100 | 
            +
                flist=fs.isearch("caseinsensitive Search TEST.")
         | 
| 101 | 
            +
                assert flist.include?("./test/fixture/kurukku.txt"), "Case insensitive search failed. #{flist}"
         | 
| 102 | 
            +
              end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
              def test_case_insensitive2
         | 
| 105 | 
            +
                fs=CodeZauker::FileScanner.new()
         | 
| 106 | 
            +
                fs.load("./test/fixture/kurukku.txt", noReload=true)
         | 
| 107 | 
            +
                flist=fs.isearch("caSeinsenSitive Search TEST.")
         | 
| 108 | 
            +
                assert flist.include?("./test/fixture/kurukku.txt"), "Case insensitive search failed. #{flist}"
         | 
| 109 | 
            +
                assert fs.search("caSeinsenSitive").length==0, "Case Sensitive Search failed"
         | 
| 95 110 | 
             
              end
         | 
| 96 111 |  | 
| 112 | 
            +
              def test_case_insensitive3
         | 
| 113 | 
            +
                fs=CodeZauker::FileScanner.new()
         | 
| 114 | 
            +
                fs.load("./test/fixture/kurukku.txt", noReload=true)
         | 
| 115 | 
            +
                u=CodeZauker::Util.new()
         | 
| 116 | 
            +
                (u.mixCase("CaSeinsen")).each { |t|
         | 
| 117 | 
            +
                  #puts "Checking #{t}"
         | 
| 118 | 
            +
                  flist=fs.isearch(t)
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                  assert  flist.include?("./test/fixture/kurukku.txt"), "Case insensitive search failed for input: #{t}. #{flist}  do not ocntain kurukku.txt"
         | 
| 121 | 
            +
                }    
         | 
| 122 | 
            +
              end
         | 
| 123 | 
            +
             | 
| 124 | 
            +
              ### Here follows Generic utils test...
         | 
| 125 | 
            +
             | 
| 126 | 
            +
              def test_case_mixer1
         | 
| 127 | 
            +
                u=CodeZauker::Util.new()
         | 
| 128 | 
            +
                t1=u.mixCase("a")
         | 
| 129 | 
            +
                puts "test_case_mixer  #{t1}"
         | 
| 130 | 
            +
                assert t1[0]=="a"
         | 
| 131 | 
            +
                assert t1[1]=="A"
         | 
| 132 | 
            +
                w2=u.mixCase("ab")
         | 
| 133 | 
            +
                puts "#{w2}"
         | 
| 134 | 
            +
                assert "#{w2}" == '["ab", "aB", "Ab", "AB"]', "Failed expected permutation."
         | 
| 135 | 
            +
                w3=u.mixCase("abc")
         | 
| 136 | 
            +
                puts "#{w3}"
         | 
| 137 | 
            +
                assert "#{w3}" == '["abc", "abC", "aBc", "aBC", "Abc", "AbC", "ABc", "ABC"]', "Failed expected permutation. Got:#{w3}"
         | 
| 138 | 
            +
              end
         | 
| 139 | 
            +
             | 
| 140 | 
            +
              def test_case_mixer1
         | 
| 141 | 
            +
                u=CodeZauker::Util.new()
         | 
| 142 | 
            +
                t1=u.mixCase("abcd")
         | 
| 143 | 
            +
                assert t1.length==16, "Expected permutation is not of the correct size (16). Got:#{t1}"
         | 
| 144 | 
            +
              end
         | 
| 145 | 
            +
             | 
| 146 | 
            +
             | 
| 147 | 
            +
              def test_zip
         | 
| 148 | 
            +
                require 'zip/zip'
         | 
| 149 | 
            +
                require 'pp'
         | 
| 150 | 
            +
                # /d/ISP/REPS0/extra-sources/repsSRC201201.zip
         | 
| 151 | 
            +
                zf=Zip::ZipFile.new("test/fixture/testArchive.zip")
         | 
| 152 | 
            +
                pp(zf)
         | 
| 153 | 
            +
                zf.each_with_index {
         | 
| 154 | 
            +
                  |entry, index|
         | 
| 155 | 
            +
                  # entry.get_input_stream() get a  fancy Zip::ZipInputStream
         | 
| 156 | 
            +
                  print "#{index} -- #{entry.name} (#{entry.size} bytes):  "
         | 
| 157 | 
            +
                  pp(entry)
         | 
| 158 | 
            +
                  puts "------"
         | 
| 159 | 
            +
                  # puts "'#{zis.gets.chomp}'"
         | 
| 160 | 
            +
                  # entry = zis.get_next_entry
         | 
| 161 | 
            +
                  # print "First line of '#{entry.name} (#{entry.size} bytes):  "
         | 
| 162 | 
            +
                  # puts "'#{zis.gets.chomp}'"
         | 
| 163 | 
            +
                }
         | 
| 164 | 
            +
              end
         | 
| 165 | 
            +
             | 
| 166 | 
            +
              # BUG Sometimes a trailing nil is returned in the list
         | 
| 167 | 
            +
              # We try to push a non-existent id and get back an error
         | 
| 168 | 
            +
              def test_map_ids_to_file()
         | 
| 169 | 
            +
                fs=CodeZauker::FileScanner.new()
         | 
| 170 | 
            +
                assert_equal [],fs.map_ids_to_files([1234455677461])
         | 
| 171 | 
            +
              end
         | 
| 97 172 |  | 
| 98 173 | 
             
            end
         | 
| 99 174 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: code_zauker
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.3
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,11 +9,11 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2012- | 
| 12 | 
            +
            date: 2012-02-03 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: yard
         | 
| 16 | 
            -
              requirement: & | 
| 16 | 
            +
              requirement: &74500230 !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - ~>
         | 
| @@ -21,10 +21,10 @@ dependencies: | |
| 21 21 | 
             
                    version: '0.7'
         | 
| 22 22 | 
             
              type: :development
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: * | 
| 24 | 
            +
              version_requirements: *74500230
         | 
| 25 25 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 26 26 | 
             
              name: hiredis
         | 
| 27 | 
            -
              requirement: & | 
| 27 | 
            +
              requirement: &74499940 !ruby/object:Gem::Requirement
         | 
| 28 28 | 
             
                none: false
         | 
| 29 29 | 
             
                requirements:
         | 
| 30 30 | 
             
                - - ~>
         | 
| @@ -32,10 +32,10 @@ dependencies: | |
| 32 32 | 
             
                    version: '0.3'
         | 
| 33 33 | 
             
              type: :runtime
         | 
| 34 34 | 
             
              prerelease: false
         | 
| 35 | 
            -
              version_requirements: * | 
| 35 | 
            +
              version_requirements: *74499940
         | 
| 36 36 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 37 37 | 
             
              name: redis
         | 
| 38 | 
            -
              requirement: & | 
| 38 | 
            +
              requirement: &74499670 !ruby/object:Gem::Requirement
         | 
| 39 39 | 
             
                none: false
         | 
| 40 40 | 
             
                requirements:
         | 
| 41 41 | 
             
                - - ~>
         | 
| @@ -43,7 +43,18 @@ dependencies: | |
| 43 43 | 
             
                    version: '2.2'
         | 
| 44 44 | 
             
              type: :runtime
         | 
| 45 45 | 
             
              prerelease: false
         | 
| 46 | 
            -
              version_requirements: * | 
| 46 | 
            +
              version_requirements: *74499670
         | 
| 47 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 48 | 
            +
              name: rubyzip
         | 
| 49 | 
            +
              requirement: &74499420 !ruby/object:Gem::Requirement
         | 
| 50 | 
            +
                none: false
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - ~>
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '0.9'
         | 
| 55 | 
            +
              type: :runtime
         | 
| 56 | 
            +
              prerelease: false
         | 
| 57 | 
            +
              version_requirements: *74499420
         | 
| 47 58 | 
             
            description: Code Zauker is based from ideas taken by old Google Code Search and uses
         | 
| 48 59 | 
             
              Redis as a basic platform
         | 
| 49 60 | 
             
            email:
         | 
| @@ -56,7 +67,10 @@ extensions: [] | |
| 56 67 | 
             
            extra_rdoc_files: []
         | 
| 57 68 | 
             
            files:
         | 
| 58 69 | 
             
            - .gitignore
         | 
| 70 | 
            +
            - BUGS.org
         | 
| 71 | 
            +
            - CHANGELOG.org
         | 
| 59 72 | 
             
            - Gemfile
         | 
| 73 | 
            +
            - LICENSE.txt
         | 
| 60 74 | 
             
            - Rakefile
         | 
| 61 75 | 
             
            - bin/czindexer
         | 
| 62 76 | 
             
            - bin/czsearch
         | 
| @@ -65,6 +79,8 @@ files: | |
| 65 79 | 
             
            - devel.org
         | 
| 66 80 | 
             
            - doc/CodeZauker.html
         | 
| 67 81 | 
             
            - doc/CodeZauker/FileScanner.html
         | 
| 82 | 
            +
            - doc/CodeZauker/Util.html
         | 
| 83 | 
            +
            - doc/Grep.html
         | 
| 68 84 | 
             
            - doc/_index.html
         | 
| 69 85 | 
             
            - doc/class_list.html
         | 
| 70 86 | 
             
            - doc/css/common.css
         | 
| @@ -87,6 +103,7 @@ files: | |
| 87 103 | 
             
            - test/fixture/TEST_LICENSE.txt
         | 
| 88 104 | 
             
            - test/fixture/foolish.txt
         | 
| 89 105 | 
             
            - test/fixture/kurukku.txt
         | 
| 106 | 
            +
            - test/fixture/testArchive.zip
         | 
| 90 107 | 
             
            - test/test_search.rb
         | 
| 91 108 | 
             
            homepage: http://gioorgi.com/tag/code-zauker/
         | 
| 92 109 | 
             
            licenses: []
         |