rain8net 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +23 -0
- data/LICENSE.txt +20 -0
- data/README.md +37 -0
- data/Rakefile +54 -0
- data/VERSION +1 -0
- data/lib/rain8net.rb +1 -1
- data/test/helper.rb +17 -0
- data/test/test_rain8net.rb +1 -2
- metadata +109 -41
- data/README +0 -30
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "serialport"
|
4
|
+
|
5
|
+
# Add dependencies to develop your gem here.
|
6
|
+
# Include everything needed to run rake, tests, features, etc.
|
7
|
+
group :development do
|
8
|
+
gem "rdoc", "~> 3.12"
|
9
|
+
gem "bundler", ">= 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.8.3"
|
11
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.8.3)
|
6
|
+
bundler (~> 1.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rdoc
|
10
|
+
json (1.7.3)
|
11
|
+
rake (0.9.2.2)
|
12
|
+
rdoc (3.12)
|
13
|
+
json (~> 1.4)
|
14
|
+
serialport (1.1.0)
|
15
|
+
|
16
|
+
PLATFORMS
|
17
|
+
ruby
|
18
|
+
|
19
|
+
DEPENDENCIES
|
20
|
+
bundler (>= 1.0.0)
|
21
|
+
jeweler (~> 1.8.3)
|
22
|
+
rdoc (~> 3.12)
|
23
|
+
serialport
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2012 Adam Anderson
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
rain8net
|
2
|
+
========
|
3
|
+
|
4
|
+
The Rain8net device is an RS232 controlled sprinkler controller. The "net" in Rain8net refers to the device's
|
5
|
+
ability to be expanded with with several networked modules. This ruby library can be used to control any number
|
6
|
+
of Rain8net devices from your ruby app.
|
7
|
+
|
8
|
+
More information about the Rain8 series of products can be found at WGL Designs.
|
9
|
+
|
10
|
+
http://www.wgldesigns.com
|
11
|
+
|
12
|
+
NOTE: You must install ruby-serialport in order to use this library:
|
13
|
+
https://github.com/hparra/ruby-serialport
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
```bash
|
17
|
+
sudo gem install serialport
|
18
|
+
sudo gem install rain8net
|
19
|
+
```
|
20
|
+
or, put this in your Gemfile:
|
21
|
+
```ruby
|
22
|
+
gem 'serialport'
|
23
|
+
gem 'rain8net'
|
24
|
+
```
|
25
|
+
## Usage
|
26
|
+
```ruby
|
27
|
+
r8 = Rain8net.new(tty: 0)
|
28
|
+
r8.turn_on_zone(1)
|
29
|
+
sleep(30) # run for 30 seconds...
|
30
|
+
puts r8.zone_status(1) # => true
|
31
|
+
puts r8.zone_status(2) # => false
|
32
|
+
r8.turn_off_zone(1)
|
33
|
+
```
|
34
|
+
## Tips
|
35
|
+
|
36
|
+
* Be sure the user running your rails application has R/W access to the serial port. (try: chmod 777 /dev/ttyS0)
|
37
|
+
* If you have more than 1 module in your setup, be sure to configure the address of each device using the manufacturer's configuration program.
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "rain8net"
|
18
|
+
gem.homepage = "http://github.com/adamtao/rain8net"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Control Rain8net irrigation devices from ruby}
|
21
|
+
gem.description = %Q{Rain8net irrigation controllers are serial port RS-232 devices for remote control of irrigation zones. This gem provides a ruby interface to control them.}
|
22
|
+
gem.email = "adam@makeascene.com"
|
23
|
+
gem.authors = ["Adam Anderson"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
gem.add_dependency 'serialport'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
# require 'rcov/rcovtask'
|
37
|
+
# Rcov::RcovTask.new do |test|
|
38
|
+
# test.libs << 'test'
|
39
|
+
# test.pattern = 'test/**/test_*.rb'
|
40
|
+
# test.verbose = true
|
41
|
+
# test.rcov_opts << '--exclude "gems/*"'
|
42
|
+
# end
|
43
|
+
|
44
|
+
task :default => :test
|
45
|
+
|
46
|
+
require 'rdoc/task'
|
47
|
+
Rake::RDocTask.new do |rdoc|
|
48
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "rain8net #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.1.0
|
data/lib/rain8net.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# NOTE: You must install ruby-serialport in order to use this library.
|
6
6
|
# As of this writing, it is not available as a gem, but can be downloaded
|
7
7
|
# here:
|
8
|
-
#
|
8
|
+
# https://github.com/hparra/ruby-serialport
|
9
9
|
#
|
10
10
|
# Rain8net is an RS232 controlled sprinkler controller. The "net"
|
11
11
|
# in Rain8net refers to the device's ability to be expanded with
|
data/test/helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
|
12
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
13
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
|
+
require 'rain8net'
|
15
|
+
|
16
|
+
class Test::Unit::TestCase
|
17
|
+
end
|
data/test/test_rain8net.rb
CHANGED
metadata
CHANGED
@@ -1,48 +1,116 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
1
|
+
--- !ruby/object:Gem::Specification
|
4
2
|
name: rain8net
|
5
|
-
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.
|
7
|
-
|
8
|
-
summary: A library for interfacing with Rain8net irrigation controllers.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: adam@makeascene.com
|
12
|
-
homepage: http://rain8net.rubyforge.org
|
13
|
-
rubyforge_project:
|
14
|
-
description:
|
15
|
-
autorequire: rain8net
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
prerelease:
|
25
6
|
platform: ruby
|
26
|
-
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
|
-
authors:
|
7
|
+
authors:
|
30
8
|
- Adam Anderson
|
31
|
-
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: serialport
|
16
|
+
requirement: &2157038880 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2157038880
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rdoc
|
27
|
+
requirement: &2157037640 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.12'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157037640
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: bundler
|
38
|
+
requirement: &2157035440 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.0.0
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2157035440
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: jeweler
|
49
|
+
requirement: &2157034200 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.8.3
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2157034200
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: serialport
|
60
|
+
requirement: &2157032340 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2157032340
|
69
|
+
description: Rain8net irrigation controllers are serial port RS-232 devices for remote
|
70
|
+
control of irrigation zones. This gem provides a ruby interface to control them.
|
71
|
+
email: adam@makeascene.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files:
|
75
|
+
- LICENSE.txt
|
76
|
+
- README.md
|
77
|
+
files:
|
78
|
+
- .document
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- VERSION
|
32
85
|
- lib/rain8net.rb
|
86
|
+
- test/helper.rb
|
33
87
|
- test/test_rain8net.rb
|
34
|
-
|
35
|
-
|
36
|
-
-
|
88
|
+
homepage: http://github.com/adamtao/rain8net
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
post_install_message:
|
37
92
|
rdoc_options: []
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
segments:
|
102
|
+
- 0
|
103
|
+
hash: 831562812871913194
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
45
110
|
requirements: []
|
46
|
-
|
47
|
-
|
48
|
-
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 1.8.10
|
113
|
+
signing_key:
|
114
|
+
specification_version: 3
|
115
|
+
summary: Control Rain8net irrigation devices from ruby
|
116
|
+
test_files: []
|
data/README
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
= Rain8net library for Ruby.
|
2
|
-
|
3
|
-
Author: Adam Anderson (adam@makeascene.com)
|
4
|
-
|
5
|
-
NOTE: You must install ruby-serialport in order to use this library.
|
6
|
-
As of this writing, it is not available as a gem, but can be downloaded
|
7
|
-
here:
|
8
|
-
http://ruby-serialport.rubyforge.org
|
9
|
-
|
10
|
-
The Rain8net device is an RS232 controlled sprinkler controller. The
|
11
|
-
"net" in Rain8net refers to the device's ability to be expanded with
|
12
|
-
with several networked modules. This class can be used to control
|
13
|
-
one device or a whole network of devices.
|
14
|
-
|
15
|
-
Usage:
|
16
|
-
|
17
|
-
require 'rain8net'
|
18
|
-
r8 = Rain8net.new
|
19
|
-
r8.turn_on_zone(1)
|
20
|
-
sleep(30) # run for 30 seconds...
|
21
|
-
puts r8.zone_status(1) # => true
|
22
|
-
puts r8.zone_status(2) # => false
|
23
|
-
r8.turn_off_zone(1)
|
24
|
-
|
25
|
-
More information about the Rain8 series of products can be found on
|
26
|
-
the manufacturer's website at:
|
27
|
-
http://www.wgldesigns.com
|
28
|
-
|
29
|
-
Copyright (c) 2008 Make A Scene Media, Inc. All Rights Reserved.
|
30
|
-
Licensed under GPL
|