em-filewatcher 1.0.0
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 +7 -0
- data/lib/em-filewatcher.rb +24 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e96290d3c5a798f399b0855793065bf97fd127a3
|
4
|
+
data.tar.gz: 7bb27f56ea0c78895f4b7650ea16b029180fa958
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8b2e07d17345e8fb7744e7ba3033e23812956234edf8b54c16007e929419cc13b22f18b33f3dda9f675e87a0f19898dc4dcf7abca2ceaaa33a9663165a888f0f
|
7
|
+
data.tar.gz: 7f731a512228b5c6bb0068a617ff8a94fcc5ce0128fb617e0600518f08f75bd7e1c31f0e2a14a917cfcfa8bc217310ce5360299727b37e00e6555148df4bb58d
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'filewatcher'
|
2
|
+
require 'eventmachine'
|
3
|
+
|
4
|
+
module EM
|
5
|
+
class FileWatcher
|
6
|
+
def self.start_watch path, &callback
|
7
|
+
FileWatcher.new(path, &callback)
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize path, &callback
|
11
|
+
@filewatcher = ::FileWatcher.new([path])
|
12
|
+
|
13
|
+
t = Thread.new(@filewatcher) do |fw|
|
14
|
+
fw.watch do |path|
|
15
|
+
EM::next_tick {callback.call(path)}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
def stop
|
20
|
+
@filewatcher.stop
|
21
|
+
@filewatcher.finalize
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: em-filewatcher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- pjc0247
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: eventmachine
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: filewatcher
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: em-filewatcher
|
42
|
+
email: pjc0247@naver.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/em-filewatcher.rb
|
48
|
+
homepage:
|
49
|
+
licenses: []
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 2.5.1
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: em-filewatcher
|
71
|
+
test_files: []
|