saal 0.2.21 → 0.2.22
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +8 -8
- data/bin/saal_daemon +2 -1
- data/bin/saal_daemon~ +31 -0
- data/lib/daemon.rb +2 -2
- data/lib/saal.rb +1 -1
- data/saal.gemspec +3 -3
- data/test/sensors_test.rb +1 -1
- metadata +55 -80
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ require 'rubygems'
|
|
4
4
|
require 'rake'
|
5
5
|
require 'date'
|
6
6
|
require 'rdoc'
|
7
|
-
require 'rcov/rcovtask'
|
7
|
+
#require 'rcov/rcovtask'
|
8
8
|
require 'rake/testtask'
|
9
9
|
require 'rdoc/task'
|
10
10
|
|
@@ -57,13 +57,13 @@ Rake::TestTask.new(:test) do |test|
|
|
57
57
|
test.verbose = true
|
58
58
|
end
|
59
59
|
|
60
|
-
Rcov::RcovTask.new(:coverage) do |t|
|
61
|
-
t.libs << "test"
|
62
|
-
t.test_files = FileList['test/*_test.rb']
|
63
|
-
t.rcov_opts << ['--exclude "^/"', '--include "lib/.*\.rb"']
|
64
|
-
t.output_dir = 'coverage'
|
65
|
-
t.verbose = true
|
66
|
-
end
|
60
|
+
#Rcov::RcovTask.new(:coverage) do |t|
|
61
|
+
# t.libs << "test"
|
62
|
+
# t.test_files = FileList['test/*_test.rb']
|
63
|
+
# t.rcov_opts << ['--exclude "^/"', '--include "lib/.*\.rb"']
|
64
|
+
# t.output_dir = 'coverage'
|
65
|
+
# t.verbose = true
|
66
|
+
#end
|
67
67
|
|
68
68
|
Rake::RDocTask.new do |rdoc|
|
69
69
|
rdoc.rdoc_dir = 'rdoc'
|
data/bin/saal_daemon
CHANGED
@@ -19,7 +19,8 @@ else
|
|
19
19
|
d = SAAL::Daemon.new(:interval => SENSOR_INTERVAL,
|
20
20
|
:sensorconf => SENSORSCONF,
|
21
21
|
:dbconf => DBCONF,
|
22
|
-
:foreground => foreground
|
22
|
+
:foreground => foreground,
|
23
|
+
:keep_stdin => false)
|
23
24
|
pid = d.run
|
24
25
|
if !foreground
|
25
26
|
File.open(pidfile, 'w') do |f|
|
data/bin/saal_daemon~
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
SENSOR_INTERVAL = 60 # seconds between consecutive measurements of the sensors
|
4
|
+
DBCONF = "/etc/saal/database.yml"
|
5
|
+
SENSORSCONF = "/etc/saal/sensors.yml"
|
6
|
+
|
7
|
+
require File.dirname(__FILE__)+'/../lib/saal.rb'
|
8
|
+
|
9
|
+
def usage
|
10
|
+
$stderr.puts "Usage: saal_daemon <pidfile|--foreground>"
|
11
|
+
end
|
12
|
+
|
13
|
+
if ARGV.size != 1
|
14
|
+
usage
|
15
|
+
exit 2
|
16
|
+
else
|
17
|
+
pidfile = ARGV[0]
|
18
|
+
foreground = (ARGV[0] == '--foreground')
|
19
|
+
d = SAAL::Daemon.new(:interval => SENSOR_INTERVAL,
|
20
|
+
:sensorconf => SENSORSCONF,
|
21
|
+
:dbconf => DBCONF,
|
22
|
+
:foreground => foreground,
|
23
|
+
:keep_stdin => true)
|
24
|
+
pid = d.run
|
25
|
+
if !foreground
|
26
|
+
File.open(pidfile, 'w') do |f|
|
27
|
+
f.write(pid)
|
28
|
+
f.close
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/daemon.rb
CHANGED
@@ -7,9 +7,9 @@ module SAAL
|
|
7
7
|
else
|
8
8
|
fork do
|
9
9
|
if not opts[:keep_stdin]
|
10
|
-
$
|
11
|
-
$stdin.reopen "/dev/null", "a"
|
10
|
+
$stdin.reopen "/dev/null"
|
12
11
|
$stdout.reopen "/dev/null", "a"
|
12
|
+
$stderr.reopen "/dev/null", "a"
|
13
13
|
end
|
14
14
|
yield ForkedRunner.new
|
15
15
|
end
|
data/lib/saal.rb
CHANGED
data/saal.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
|
8
8
|
s.name = 'saal'
|
9
|
-
s.version = '0.2.
|
10
|
-
s.date = '2013-
|
9
|
+
s.version = '0.2.22'
|
10
|
+
s.date = '2013-05-16'
|
11
11
|
|
12
12
|
s.summary = "Thin abstraction layer for interfacing and recording sensors (currently onewire) and actuators (currently dinrelay)"
|
13
13
|
s.description = <<EOF
|
@@ -28,7 +28,7 @@ EOF
|
|
28
28
|
|
29
29
|
s.executables = Dir.glob("bin/*").map{|f| f.gsub('bin/','')}
|
30
30
|
|
31
|
-
s.add_dependency('ownet', [">= 0.2.
|
31
|
+
s.add_dependency('ownet', [">= 0.2.1"])
|
32
32
|
s.add_dependency('nokogiri')
|
33
33
|
s.add_dependency('mysql')
|
34
34
|
|
data/test/sensors_test.rb
CHANGED
@@ -70,7 +70,7 @@ class TestSensors < Test::Unit::TestCase
|
|
70
70
|
assert_equal 1, res.num_rows
|
71
71
|
row = res.fetch_row
|
72
72
|
assert_equal "fake_temp", row[0]
|
73
|
-
assert_in_delta Time.now.utc.to_i, row[1], 100
|
73
|
+
assert_in_delta Time.now.utc.to_i, row[1].to_i, 100
|
74
74
|
assert_instance_of Float, row[2].to_f
|
75
75
|
end
|
76
76
|
end
|
metadata
CHANGED
@@ -1,87 +1,68 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: saal
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.22
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 21
|
10
|
-
version: 0.2.21
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
7
|
+
authors:
|
8
|
+
- Pedro Côrte-Real
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-05-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: ownet
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &72850210 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 2
|
32
|
-
- 0
|
33
|
-
version: 0.2.0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.2.1
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: nokogiri
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *72850210
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: nokogiri
|
27
|
+
requirement: &72849690 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
48
33
|
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: mysql
|
52
34
|
prerelease: false
|
53
|
-
|
35
|
+
version_requirements: *72849690
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: mysql
|
38
|
+
requirement: &72848430 !ruby/object:Gem::Requirement
|
54
39
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
62
44
|
type: :runtime
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *72848430
|
47
|
+
description: ! "A daemon and libraries to create an abstraction layer that interfaces
|
48
|
+
with \nsensors and actuators, recording their state, responding to requests \nfor
|
49
|
+
current and historical values, and allowing changes of state.\n"
|
69
50
|
email: pedro@pedrocr.net
|
70
|
-
executables:
|
51
|
+
executables:
|
71
52
|
- saal_chart~
|
72
53
|
- dinrelaystatus
|
73
54
|
- saal_readall
|
74
55
|
- saal_dump_database
|
75
56
|
- saal_daemon
|
76
57
|
- saal_chart
|
58
|
+
- saal_daemon~
|
77
59
|
- dinrelayset
|
78
60
|
- saal_import_mysql
|
79
61
|
extensions: []
|
80
|
-
|
81
|
-
extra_rdoc_files:
|
62
|
+
extra_rdoc_files:
|
82
63
|
- README.rdoc
|
83
64
|
- LICENSE
|
84
|
-
files:
|
65
|
+
files:
|
85
66
|
- LICENSE
|
86
67
|
- README.rdoc
|
87
68
|
- Rakefile
|
@@ -124,43 +105,37 @@ files:
|
|
124
105
|
- test/test_sensor_cleanups.yml
|
125
106
|
- test/test_sensors.yml
|
126
107
|
- bin/saal_chart~
|
108
|
+
- bin/saal_daemon~
|
127
109
|
homepage: https://github.com/pedrocr/saal
|
128
110
|
licenses: []
|
129
|
-
|
130
111
|
post_install_message:
|
131
|
-
rdoc_options:
|
112
|
+
rdoc_options:
|
132
113
|
- -S
|
133
114
|
- -w 2
|
134
115
|
- -N
|
135
116
|
- -c utf8
|
136
|
-
require_paths:
|
117
|
+
require_paths:
|
137
118
|
- lib
|
138
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
120
|
none: false
|
140
|
-
requirements:
|
141
|
-
- -
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
|
144
|
-
|
145
|
-
- 0
|
146
|
-
version: "0"
|
147
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ! '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
126
|
none: false
|
149
|
-
requirements:
|
150
|
-
- -
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
|
153
|
-
segments:
|
154
|
-
- 0
|
155
|
-
version: "0"
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
156
131
|
requirements: []
|
157
|
-
|
158
132
|
rubyforge_project:
|
159
|
-
rubygems_version: 1.8.
|
133
|
+
rubygems_version: 1.8.11
|
160
134
|
signing_key:
|
161
135
|
specification_version: 2
|
162
|
-
summary: Thin abstraction layer for interfacing and recording sensors (currently onewire)
|
163
|
-
|
136
|
+
summary: Thin abstraction layer for interfacing and recording sensors (currently onewire)
|
137
|
+
and actuators (currently dinrelay)
|
138
|
+
test_files:
|
164
139
|
- test/chart_data_test.rb
|
165
140
|
- test/chart_test.rb
|
166
141
|
- test/charts_test.rb
|