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 +4 -4
- data/lib/zeiger/index.rb +1 -0
- data/lib/zeiger/server.rb +21 -12
- data/lib/zeiger/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a73c749b3299f33069881b6dbce308ab82976d2
|
4
|
+
data.tar.gz: 1494b56d2f8de2fa8045b5358bff5436a94db85a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '087bf80d091ccabafd6f1d7643aa56f2c32cd1010332b10e124d8ad36590a382b609cdf88f888d3601bc17138bbdfec6086e12871c4886f016d5381f5daf67d0'
|
7
|
+
data.tar.gz: 25f5270d857b6e8c2dc3a4bcf34d8aa0787b180ef6a1823c4be9b64b7e38627db2eedebd9fa13eaa2b8938ddff168b387e7ada28906e57a56d622c1127ca805a
|
data/lib/zeiger/index.rb
CHANGED
data/lib/zeiger/server.rb
CHANGED
@@ -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
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
data/lib/zeiger/version.rb
CHANGED
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
|
+
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:
|
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.
|
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
|