zeiger 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 442832a4d75e16a51b1e2027039324b7376468b3
4
- data.tar.gz: 2604766d571fd65babebd7a45d3c036e80f3c05b
3
+ metadata.gz: 2a73c749b3299f33069881b6dbce308ab82976d2
4
+ data.tar.gz: 1494b56d2f8de2fa8045b5358bff5436a94db85a
5
5
  SHA512:
6
- metadata.gz: e53fac91ddc9b472842068ab533271d9ec89cfa66a32dd358f8b39185d4e79e001a63f7c089815bd5ec52d4c99187fec99e5d8a696a0c983b5d9474ccc84844b
7
- data.tar.gz: e7574635be1aa14bb86a7a2a5b346fccca3599905eb39b61a8b2691127df67a78f1ef418217ed441f97ceac3af996e857b555e3ffd202cf4c2bdf56b38178c98
6
+ metadata.gz: '087bf80d091ccabafd6f1d7643aa56f2c32cd1010332b10e124d8ad36590a382b609cdf88f888d3601bc17138bbdfec6086e12871c4886f016d5381f5daf67d0'
7
+ data.tar.gz: 25f5270d857b6e8c2dc3a4bcf34d8aa0787b180ef6a1823c4be9b64b7e38627db2eedebd9fa13eaa2b8938ddff168b387e7ada28906e57a56d622c1127ca805a
@@ -13,6 +13,7 @@ module Zeiger
13
13
  %w{ lib LICENSE },
14
14
  %w{ lib spec },
15
15
  %w{ lib MIT-LICENSE },
16
+ %w{ lib README.md },
16
17
  ]
17
18
  NGRAM_SIZE = 3
18
19
 
@@ -4,16 +4,19 @@ module Zeiger
4
4
  SOCKET_NAME = "/tmp/zeiger-index"
5
5
 
6
6
  class Server
7
- def run command, *args
7
+ def run command, sleepytime=nil, *args
8
+ sleepytime = (sleepytime || 10).to_f
9
+ raise "sleep time must be greater than zero, got #{sleepytime.inspect}" unless sleepytime > 0.0
10
+ puts "starting server with sleep interval of #{sleepytime} seconds"
8
11
  Thread.new do
9
12
  begin
10
13
  while true do
11
14
  indices = Zeiger::INDICES.values
12
15
  indices.each do |index|
13
- puts "scanning #{index.name} at #{index.dir}"
16
+ puts "#{Time.now} scanning #{index.name} at #{index.dir}"
14
17
  index.rescan
15
18
  end
16
- sleep 8
19
+ sleep sleepytime
17
20
  end
18
21
  rescue Exception => e
19
22
  puts e.message
@@ -29,15 +32,21 @@ module Zeiger
29
32
  puts incoming.to_yaml
30
33
 
31
34
  index = Index.from_path incoming[:pwd]
32
- puts "querying index #{index.name}"
33
-
34
- case incoming[:command]
35
- when :search
36
- index.query(incoming[:search]).each { |res| sock.puts res.to_s }
37
- when :stats
38
- sock.puts index.stats.stats.to_yaml
39
- when :files
40
- index.file_list(incoming[:files]).each { |f| sock.puts f.local_filename }
35
+
36
+ if index
37
+ puts "querying index #{index.name}"
38
+
39
+ case incoming[:command]
40
+ when :search
41
+ index.query(incoming[:search]).each { |res| sock.puts res.to_s }
42
+ when :stats
43
+ sock.puts index.stats.stats.to_yaml
44
+ when :files
45
+ index.file_list(incoming[:files]).each { |f| sock.puts f.local_filename }
46
+ end
47
+
48
+ else
49
+ puts "no index found for path #{incoming[:pwd].inspect}"
41
50
  end
42
51
 
43
52
  ensure
@@ -1,3 +1,3 @@
1
1
  module Zeiger
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeiger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - conanite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-13 00:00:00.000000000 Z
11
+ date: 2020-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version: '0'
85
85
  requirements: []
86
86
  rubyforge_project:
87
- rubygems_version: 2.2.2
87
+ rubygems_version: 2.5.2.3
88
88
  signing_key:
89
89
  specification_version: 4
90
90
  summary: Provide text index of files in current directory tree and a unix socket to