open_lighting 0.1.2 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Open Lighting 0.1.2 ##
2
+
3
+ * fix nasty bug when calling named points multiple times
4
+ * DmxController.close! method for explicitly closing the read/write pipes
5
+
1
6
  ## Open Lighting 0.1.1 ##
2
7
 
3
8
  * add named points after initialization
@@ -55,6 +55,7 @@ module OpenLighting
55
55
 
56
56
  def write!(values=current_values)
57
57
  self.write_pipe ||= IO.popen(self.cmd, "w")
58
+ self.write_pipe.sync = true
58
59
 
59
60
  # DMX only wants integer inputs
60
61
  values.map!{|i| i.to_i}
@@ -99,7 +100,7 @@ module OpenLighting
99
100
  warn "[DEPRECATION] `transition!` is deprecated. Use `begin_animation!` instead."
100
101
  end
101
102
 
102
- def begin_animation!(options = {}, &block)
103
+ def animate!(options = {}, &block)
103
104
  previous = current_values
104
105
  buffer(options)
105
106
 
@@ -113,6 +114,10 @@ module OpenLighting
113
114
  end
114
115
  end
115
116
 
117
+ def begin_animation!(options = {}, &block)
118
+ animate!(options, &block)
119
+ end
120
+
116
121
  def interpolate(first, last, total, i)
117
122
  results = []
118
123
  first.count.times do |j|
@@ -138,7 +143,7 @@ module OpenLighting
138
143
  # causes controller.center! to convert to controller.instant!(:point => :center)
139
144
  instant! :point => meth_without_bang
140
145
  elsif capabilities.include? meth
141
- buffer meth => args
146
+ buffer meth => args.first
142
147
  elsif capabilities.include? meth_without_bang
143
148
  instant! meth_without_bang => args.first
144
149
  else
@@ -1,3 +1,3 @@
1
1
  module OpenLighting
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -191,7 +191,7 @@ module OpenLighting
191
191
  end
192
192
 
193
193
  it "should write interpolated values to the pipe" do
194
- @controller.begin_animation!(:seconds => 5, :pan => 25)
194
+ @controller.animate!(:seconds => 5, :pan => 25)
195
195
  @controller.read_pipe.gets.should == "5,0,0,5,0,0\n"
196
196
  @controller.read_pipe.gets.should == "10,0,0,10,0,0\n"
197
197
  @controller.read_pipe.gets.should == "15,0,0,15,0,0\n"
@@ -212,6 +212,13 @@ module OpenLighting
212
212
  @controller.read_pipe.gets.should == "25,0,0,50,0,0\n"
213
213
  @controller.write_pipe.close
214
214
  end
215
+
216
+ it "should allow sequential calls to method_missing and animate" do
217
+ @controller.dimmer(50)
218
+ @controller.to_dmx.should == "0,0,50,0,0,50"
219
+ @controller.animate!(:seconds => 1, :dimmer => 127)
220
+ @controller.read_pipe.gets.should == "0,0,127,0,0,127\n"
221
+ end
215
222
  end
216
223
  end
217
224
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_lighting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-04 00:00:00.000000000 Z
12
+ date: 2012-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json