traffic_light 0.1.0 → 0.2.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.
- data/Rakefile +3 -2
- data/lib/traffic_light.rb +11 -0
- data/spec/traffic_light_spec.rb +6 -0
- data/traffic_light.gemspec +5 -2
- metadata +19 -3
data/Rakefile
CHANGED
@@ -2,13 +2,14 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('traffic_light', '0.
|
5
|
+
Echoe.new('traffic_light', '0.2.0') do |p|
|
6
6
|
p.description = "Drive a traffic light with an Arduino."
|
7
7
|
p.url = "http://github.com/nledez/traffic_light"
|
8
8
|
p.author = "Nicolas Ledez"
|
9
9
|
p.email = "rubygems@ledez.net"
|
10
10
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
11
11
|
p.development_dependencies = []
|
12
|
+
p.runtime_dependencies = [ "serialport" ]
|
12
13
|
end
|
13
14
|
|
14
|
-
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
15
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
data/lib/traffic_light.rb
CHANGED
@@ -13,9 +13,20 @@ class TrafficLight
|
|
13
13
|
@sp = SerialPort.new(@port_str, @baud_rate, @data_bits, @stop_bits, @parity)
|
14
14
|
@sp.read_timeout = 1000
|
15
15
|
|
16
|
+
@opened = true
|
17
|
+
|
16
18
|
clear
|
17
19
|
end
|
18
20
|
|
21
|
+
def open?
|
22
|
+
@opened
|
23
|
+
end
|
24
|
+
|
25
|
+
def close!
|
26
|
+
@sp.close
|
27
|
+
@opened = false
|
28
|
+
end
|
29
|
+
|
19
30
|
def read
|
20
31
|
@message = @sp.read.chomp
|
21
32
|
end
|
data/spec/traffic_light_spec.rb
CHANGED
data/traffic_light.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "traffic_light"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.2.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Nicolas Ledez"]
|
9
|
-
s.date = "2012-07-
|
9
|
+
s.date = "2012-07-29"
|
10
10
|
s.description = "Drive a traffic light with an Arduino."
|
11
11
|
s.email = "rubygems@ledez.net"
|
12
12
|
s.extra_rdoc_files = ["README.rdoc", "lib/traffic_light.rb"]
|
@@ -22,8 +22,11 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.specification_version = 3
|
23
23
|
|
24
24
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
+
s.add_runtime_dependency(%q<serialport>, [">= 0"])
|
25
26
|
else
|
27
|
+
s.add_dependency(%q<serialport>, [">= 0"])
|
26
28
|
end
|
27
29
|
else
|
30
|
+
s.add_dependency(%q<serialport>, [">= 0"])
|
28
31
|
end
|
29
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traffic_light
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
13
|
-
dependencies:
|
12
|
+
date: 2012-07-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: serialport
|
16
|
+
requirement: !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: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
14
30
|
description: Drive a traffic light with an Arduino.
|
15
31
|
email: rubygems@ledez.net
|
16
32
|
executables: []
|