epub-search 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.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +4 -0
- data/README.markdown +3 -0
- data/app/watch.rb +10 -9
- data/epub-search.gemspec +2 -2
- data/lib/epub/search.rb +2 -0
- data/lib/epub/search/database/actor.rb +26 -0
- data/lib/epub/search/version.rb +1 -1
- metadata +21 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b13b7b323e7bac69c408b9fddae5c6a1032336b
|
4
|
+
data.tar.gz: 5b365484dc01ebb3e354e9997121f0df75bbefa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8c64c2c72bd1907bc4b20c1a4e66e147c3165a463dc9bbf7dd7bf7604e990bb2b566d1ca4e69af559bbafc9a310d964c851498b5696df6b584bf6b8313d82f0
|
7
|
+
data.tar.gz: 31067155ad835d1d717fadd98b64b0ede7d3accb9886d8a8dad7784fd5d08c5a83fd2a94ec1561757faa4476d6e7bbaf11c01515eaad5db89731f7c9aff8ae5b
|
data/CHANGELOG.markdown
CHANGED
data/README.markdown
CHANGED
data/app/watch.rb
CHANGED
@@ -26,17 +26,18 @@ class Watch
|
|
26
26
|
end
|
27
27
|
Process.daemon if @daemonize
|
28
28
|
write_pid_file
|
29
|
+
|
30
|
+
EPUB::Search::Database::Actor.supervise_as :db, @db
|
31
|
+
|
29
32
|
catch_up
|
30
33
|
begin
|
31
|
-
Listen.to *@directories, :filter => EPUB_RE do |modified, added, removed|
|
34
|
+
Listen.to! *@directories, :filter => EPUB_RE do |modified, added, removed|
|
32
35
|
modified.each do |file_path|
|
33
36
|
next unless file_path =~ EPUB_RE
|
34
37
|
file_path.force_encoding 'UTF-8'
|
35
38
|
begin
|
36
|
-
$stderr.puts "
|
37
|
-
|
38
|
-
$stderr.puts "add #{file_path}"
|
39
|
-
@db.add file_path
|
39
|
+
$stderr.puts "update #{file_path}"
|
40
|
+
Celluloid::Actor[:db].async.update file_path
|
40
41
|
title = EPUB::Parser.parse(file_path).title
|
41
42
|
notify %Q|UPDATED: #{title}\n#{file_path}|
|
42
43
|
FileUtils.touch exit_time_file
|
@@ -49,7 +50,7 @@ class Watch
|
|
49
50
|
next unless file_path =~ EPUB_RE
|
50
51
|
file_path.force_encoding 'UTF-8'
|
51
52
|
begin
|
52
|
-
|
53
|
+
Celluloid::Actor[:db].async.add file_path
|
53
54
|
title = EPUB::Parser.parse(file_path).title
|
54
55
|
notify %Q|ADDED: #{title}\n#{file_path}|
|
55
56
|
FileUtils.touch exit_time_file
|
@@ -62,7 +63,7 @@ class Watch
|
|
62
63
|
next unless file_path =~ EPUB_RE
|
63
64
|
file_path.force_encoding 'UTF-8'
|
64
65
|
begin
|
65
|
-
|
66
|
+
Celluloid::Actor[:db].async.remove file_path
|
66
67
|
notify %Q|REMOVED:\n#{file_path}|
|
67
68
|
FileUtils.touch exit_time_file
|
68
69
|
rescue => error
|
@@ -100,8 +101,8 @@ class Watch
|
|
100
101
|
Dir["#{dir}/**/*.epub"].each do |file_path|
|
101
102
|
next if File.file? exit_time_file and File.mtime(file_path) < exit_time
|
102
103
|
begin
|
103
|
-
removed =
|
104
|
-
|
104
|
+
removed = Celluloid::Actor[:db].remove(file_path)
|
105
|
+
Celluloid::Actor[:db].async.add file_path
|
105
106
|
operation = removed.zero? ? 'ADDED' : 'UPDATED'
|
106
107
|
title = EPUB::Parser.parse(file_path).title
|
107
108
|
notify "#{operation}: #{title}\n#{file_path}"
|
data/epub-search.gemspec
CHANGED
@@ -22,12 +22,12 @@ Gem::Specification.new do |gem|
|
|
22
22
|
gem.add_runtime_dependency 'epub-parser'
|
23
23
|
gem.add_runtime_dependency 'rroonga'
|
24
24
|
gem.add_runtime_dependency 'thor'
|
25
|
-
gem.add_runtime_dependency '
|
26
|
-
gem.add_runtime_dependency 'listen'
|
25
|
+
gem.add_runtime_dependency 'listen', '~> 1.0.0'
|
27
26
|
gem.add_runtime_dependency 'highline'
|
28
27
|
gem.add_runtime_dependency 'notify', '0.5.0'
|
29
28
|
gem.add_runtime_dependency 'rack'
|
30
29
|
gem.add_runtime_dependency 'tilt'
|
30
|
+
gem.add_runtime_dependency 'celluloid'
|
31
31
|
|
32
32
|
gem.add_development_dependency 'rake'
|
33
33
|
gem.add_development_dependency 'bundler'
|
data/lib/epub/search.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module EPUB
|
2
|
+
module Search
|
3
|
+
class Database
|
4
|
+
class Actor
|
5
|
+
include Celluloid
|
6
|
+
|
7
|
+
def initialize(db)
|
8
|
+
@db = db
|
9
|
+
end
|
10
|
+
|
11
|
+
def add(file_path)
|
12
|
+
@db.add file_path
|
13
|
+
end
|
14
|
+
|
15
|
+
def remove(file_path)
|
16
|
+
@db.remove file_path
|
17
|
+
end
|
18
|
+
|
19
|
+
def update(file_path)
|
20
|
+
@db.remove file_path
|
21
|
+
@db.add file_path
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/epub/search/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- KITAITI Makoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: epub-parser
|
@@ -52,34 +52,20 @@ dependencies:
|
|
52
52
|
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rb-inotify
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: listen
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - ~>
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: 1.0.0
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - ~>
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: 1.0.0
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: highline
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +122,20 @@ dependencies:
|
|
136
122
|
- - '>='
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: celluloid
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rake
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,6 +246,7 @@ files:
|
|
246
246
|
- epub-search.gemspec
|
247
247
|
- lib/epub/search.rb
|
248
248
|
- lib/epub/search/database.rb
|
249
|
+
- lib/epub/search/database/actor.rb
|
249
250
|
- lib/epub/search/formatter.rb
|
250
251
|
- lib/epub/search/formatter/cli.rb
|
251
252
|
- lib/epub/search/server.rb
|