domotics-core 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/domotics-core.gemspec +11 -11
- data/lib/domotics/core/device/file_camera_device.rb +14 -11
- data/lib/domotics/core/version.rb +1 -1
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 496c77cad00dcf7c93cb0659382eb6dfef98c73d
|
4
|
+
data.tar.gz: a8067b3c443b9a8302f39b3567cafed8ff32eecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bebb0937ced5a8521f4383a5ae5ba3fd4918f3bad54892a4a4f8e778fcb1ba6f60efa91fd892f6fa89c332fb5cd6eb96d1bd5802ab884b16750b76baeb54f173
|
7
|
+
data.tar.gz: 4da311d4d4df74b9a3bb062c38dd9e02b932c0f69004a558ab9645d9e251152fab9ccde375e41c8d18b1dd6710e923c67558dc980eb3f47f16fcf14397a973c6
|
data/domotics-core.gemspec
CHANGED
@@ -18,16 +18,16 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "domotics-arduino"
|
22
|
-
spec.add_runtime_dependency "redis"
|
23
|
-
spec.add_runtime_dependency "hiredis"
|
24
|
-
spec.add_runtime_dependency "mongo"
|
25
|
-
spec.add_runtime_dependency "bson_ext"
|
26
|
-
spec.add_runtime_dependency "rack"
|
27
|
-
spec.add_runtime_dependency "rb-inotify"
|
21
|
+
spec.add_runtime_dependency "domotics-arduino", '~> 0'
|
22
|
+
spec.add_runtime_dependency "redis", '~> 0'
|
23
|
+
spec.add_runtime_dependency "hiredis", '~> 0'
|
24
|
+
spec.add_runtime_dependency "mongo", '~> 0'
|
25
|
+
spec.add_runtime_dependency "bson_ext", '~> 0'
|
26
|
+
spec.add_runtime_dependency "rack", '~> 0'
|
27
|
+
spec.add_runtime_dependency "rb-inotify", '~> 0'
|
28
28
|
|
29
|
-
spec.add_development_dependency "bundler"
|
30
|
-
spec.add_development_dependency "rake"
|
31
|
-
spec.add_development_dependency "test-unit"
|
32
|
-
spec.add_development_dependency "rack-test"
|
29
|
+
spec.add_development_dependency "bundler", '~> 0'
|
30
|
+
spec.add_development_dependency "rake", '~> 0'
|
31
|
+
spec.add_development_dependency "test-unit", '~> 0'
|
32
|
+
spec.add_development_dependency "rack-test", '~> 0'
|
33
33
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Domotics::Core
|
2
2
|
class FileCameraDevice < Device #__as__ :file_camera
|
3
3
|
def initialize(args = {})
|
4
|
+
@current_name = nil
|
4
5
|
# Emulate element
|
5
|
-
@current_link = "xxx"
|
6
6
|
@camera_element = Element.new args
|
7
7
|
s = self
|
8
8
|
image_lambda = lambda { s.current_link }
|
@@ -27,21 +27,24 @@ module Domotics::Core
|
|
27
27
|
end
|
28
28
|
def event_handler(event)
|
29
29
|
filename = "#{@path}/#{event.name}"
|
30
|
+
@current_name = "#{@path}/#{Time.now.to_i}#{@file_ext}"
|
30
31
|
# Wait untill close file and rename it
|
31
|
-
inot = INotify::Notifier.new
|
32
|
-
inot.watch(filename, :close_write) do |file|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
inot.process
|
38
|
-
inot.close
|
32
|
+
#inot = INotify::Notifier.new
|
33
|
+
#inot.watch(filename, :close_write) do |file|
|
34
|
+
# @current_name = "#{@path}/#{Time.now.to_i}#{@file_ext}"
|
35
|
+
# sleep 0.1
|
36
|
+
# File.rename filename, @current_name
|
37
|
+
#end
|
38
|
+
#inot.process
|
39
|
+
#inot.close
|
40
|
+
sleep 0.5
|
41
|
+
File.rename filename, @current_name
|
39
42
|
end
|
40
43
|
def current_link
|
41
44
|
"#{@camera_element.room.name}/#{@camera_element.name}/file/#{Time.now.to_i}#{@file_ext}"
|
42
45
|
end
|
43
|
-
def current_file
|
44
|
-
IO.read @current_name
|
46
|
+
def current_file
|
47
|
+
IO.read @current_name if @current_name
|
45
48
|
end
|
46
49
|
end
|
47
50
|
end
|
metadata
CHANGED
@@ -1,167 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domotics-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- goredar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: domotics-arduino
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hiredis
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mongo
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bson_ext
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rack
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rb-inotify
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: bundler
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rake
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: test-unit
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rack-test
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - "
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - "
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
description: Main core elements
|