evesync 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +25 -0
  3. data/Rakefile +83 -0
  4. data/bin/evedatad +34 -0
  5. data/bin/evehand +36 -0
  6. data/bin/evemond +42 -0
  7. data/bin/evesync +164 -0
  8. data/bin/evesyncd +44 -0
  9. data/bin/start +16 -0
  10. data/config/example.conf +58 -0
  11. data/lib/evesync/config.rb +63 -0
  12. data/lib/evesync/constants.rb +17 -0
  13. data/lib/evesync/database.rb +107 -0
  14. data/lib/evesync/discover.rb +77 -0
  15. data/lib/evesync/err.rb +25 -0
  16. data/lib/evesync/handler/file.rb +28 -0
  17. data/lib/evesync/handler/package.rb +30 -0
  18. data/lib/evesync/handler.rb +89 -0
  19. data/lib/evesync/ipc/client.rb +37 -0
  20. data/lib/evesync/ipc/data/file.rb +64 -0
  21. data/lib/evesync/ipc/data/hashable.rb +74 -0
  22. data/lib/evesync/ipc/data/ignore.rb +22 -0
  23. data/lib/evesync/ipc/data/package.rb +58 -0
  24. data/lib/evesync/ipc/data/utils.rb +14 -0
  25. data/lib/evesync/ipc/data.rb +50 -0
  26. data/lib/evesync/ipc/ipc.rb +42 -0
  27. data/lib/evesync/ipc/server.rb +56 -0
  28. data/lib/evesync/log.rb +66 -0
  29. data/lib/evesync/ntp.rb +16 -0
  30. data/lib/evesync/os/linux/arch/package_manager.rb +29 -0
  31. data/lib/evesync/os/linux/arch/package_watcher.rb +59 -0
  32. data/lib/evesync/os/linux/arch.rb +2 -0
  33. data/lib/evesync/os/linux/base_package_manager.rb +80 -0
  34. data/lib/evesync/os/linux/deb/dpkg.rb +30 -0
  35. data/lib/evesync/os/linux/deb/package_manager.rb +38 -0
  36. data/lib/evesync/os/linux/deb/package_watcher.rb +32 -0
  37. data/lib/evesync/os/linux/deb.rb +2 -0
  38. data/lib/evesync/os/linux/rhel/package_manager.rb +42 -0
  39. data/lib/evesync/os/linux/rhel/package_watcher.rb +32 -0
  40. data/lib/evesync/os/linux/rhel/rpm.rb +41 -0
  41. data/lib/evesync/os/linux/rhel.rb +3 -0
  42. data/lib/evesync/os/linux.rb +9 -0
  43. data/lib/evesync/os.rb +2 -0
  44. data/lib/evesync/sync.rb +209 -0
  45. data/lib/evesync/trigger/base.rb +56 -0
  46. data/lib/evesync/trigger/file.rb +20 -0
  47. data/lib/evesync/trigger/package.rb +20 -0
  48. data/lib/evesync/trigger.rb +106 -0
  49. data/lib/evesync/utils.rb +51 -0
  50. data/lib/evesync/watcher/file.rb +156 -0
  51. data/lib/evesync/watcher/interface.rb +21 -0
  52. data/lib/evesync/watcher/package.rb +8 -0
  53. data/lib/evesync/watcher.rb +68 -0
  54. data/lib/evesync.rb +3 -0
  55. metadata +198 -0
@@ -0,0 +1,68 @@
1
+ require 'timeout'
2
+ require 'evesync/log'
3
+ require 'evesync/config'
4
+ require 'evesync/ipc/client'
5
+ require 'evesync/watcher/file'
6
+ require 'evesync/watcher/package'
7
+
8
+ module Evesync
9
+
10
+ # *Watcher* class responds for starting all watchers (e.g.
11
+ # package and file). Watchers are initialized in their
12
+ # own threads. Watcher::Main supports start/stop methods
13
+ # or starting and stopping watchers.
14
+ #
15
+ # = Example:
16
+ #
17
+ # w = Evesync::Watcher.new
18
+ # w.start # so, all needful watchers are started
19
+ #
20
+ # = TODO:
21
+ # * Add ability to restart watchers if something happend
22
+ #
23
+ class Watcher
24
+ WATCHER_CLASSES = [
25
+ Watcher::Package,
26
+ Watcher::File
27
+ ].freeze
28
+
29
+ def initialize(queue)
30
+ # Creating subwatchers
31
+ Log.debug('Watcher initialization started...')
32
+ @queue = queue
33
+ @watchers = []
34
+ WATCHER_CLASSES.each do |w_class|
35
+ @watchers << w_class.new(@queue)
36
+ end
37
+ Log.debug('Watcher initialization done!')
38
+ end
39
+
40
+ # Starts watchers threads
41
+ #
42
+ # [*Returns*] self
43
+ def start
44
+ @threads ||= []
45
+ if @threads.empty?
46
+ @watchers.each do |watcher|
47
+ @threads << watcher.start
48
+ end
49
+ end
50
+
51
+ Log.debug('Watcher thread started')
52
+ self
53
+ end
54
+
55
+ # Stops all watcher threads
56
+ #
57
+ # [*Returns*] self
58
+ def stop
59
+ @watchers.each do |watcher|
60
+ @threads << watcher.stop
61
+ end
62
+ @threads.each(&:exit)
63
+
64
+ Log.debug('Watcher threads stopped')
65
+ self
66
+ end
67
+ end
68
+ end
data/lib/evesync.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Evesync
2
+ VERSION = '1.0.2'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: evesync
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Kiselev Valentine
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-02-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: full_dup
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashdiff
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.8
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.8
41
+ - !ruby/object:Gem::Dependency
42
+ name: lmdb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.4.8
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.4.8
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.9.9
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.9
69
+ - !ruby/object:Gem::Dependency
70
+ name: toml-rb
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.20.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.20.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubyzip
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.2.2
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.2.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: net-ntp
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 2.1.3
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 2.1.3
111
+ description: Daemons and utility for package and file changes synchronization.
112
+ email: mrexox@yahoo.com
113
+ executables:
114
+ - evemond
115
+ - evedatad
116
+ - evehand
117
+ - evesyncd
118
+ - evesync
119
+ extensions: []
120
+ extra_rdoc_files: []
121
+ files:
122
+ - LICENSE
123
+ - Rakefile
124
+ - bin/evedatad
125
+ - bin/evehand
126
+ - bin/evemond
127
+ - bin/evesync
128
+ - bin/evesyncd
129
+ - bin/start
130
+ - config/example.conf
131
+ - lib/evesync.rb
132
+ - lib/evesync/config.rb
133
+ - lib/evesync/constants.rb
134
+ - lib/evesync/database.rb
135
+ - lib/evesync/discover.rb
136
+ - lib/evesync/err.rb
137
+ - lib/evesync/handler.rb
138
+ - lib/evesync/handler/file.rb
139
+ - lib/evesync/handler/package.rb
140
+ - lib/evesync/ipc/client.rb
141
+ - lib/evesync/ipc/data.rb
142
+ - lib/evesync/ipc/data/file.rb
143
+ - lib/evesync/ipc/data/hashable.rb
144
+ - lib/evesync/ipc/data/ignore.rb
145
+ - lib/evesync/ipc/data/package.rb
146
+ - lib/evesync/ipc/data/utils.rb
147
+ - lib/evesync/ipc/ipc.rb
148
+ - lib/evesync/ipc/server.rb
149
+ - lib/evesync/log.rb
150
+ - lib/evesync/ntp.rb
151
+ - lib/evesync/os.rb
152
+ - lib/evesync/os/linux.rb
153
+ - lib/evesync/os/linux/arch.rb
154
+ - lib/evesync/os/linux/arch/package_manager.rb
155
+ - lib/evesync/os/linux/arch/package_watcher.rb
156
+ - lib/evesync/os/linux/base_package_manager.rb
157
+ - lib/evesync/os/linux/deb.rb
158
+ - lib/evesync/os/linux/deb/dpkg.rb
159
+ - lib/evesync/os/linux/deb/package_manager.rb
160
+ - lib/evesync/os/linux/deb/package_watcher.rb
161
+ - lib/evesync/os/linux/rhel.rb
162
+ - lib/evesync/os/linux/rhel/package_manager.rb
163
+ - lib/evesync/os/linux/rhel/package_watcher.rb
164
+ - lib/evesync/os/linux/rhel/rpm.rb
165
+ - lib/evesync/sync.rb
166
+ - lib/evesync/trigger.rb
167
+ - lib/evesync/trigger/base.rb
168
+ - lib/evesync/trigger/file.rb
169
+ - lib/evesync/trigger/package.rb
170
+ - lib/evesync/utils.rb
171
+ - lib/evesync/watcher.rb
172
+ - lib/evesync/watcher/file.rb
173
+ - lib/evesync/watcher/interface.rb
174
+ - lib/evesync/watcher/package.rb
175
+ homepage: https://mrexox.github.io
176
+ licenses:
177
+ - BSD-2-Clause
178
+ metadata: {}
179
+ post_install_message:
180
+ rdoc_options: []
181
+ require_paths:
182
+ - lib
183
+ required_ruby_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: 2.0.0
188
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ requirements: []
194
+ rubygems_version: 3.0.3
195
+ signing_key:
196
+ specification_version: 4
197
+ summary: Daemons and utility for package and file changes synchronization
198
+ test_files: []