betabrite 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -1,3 +1,9 @@
1
+ === 1.0.4
2
+
3
+ * 1 Bugfix:
4
+
5
+ * Fixed windows platform detection.
6
+
1
7
  === 1.0.3
2
8
 
3
9
  * 1 Bugfix:
@@ -1,13 +1,13 @@
1
1
  .autotest
2
+ CHANGELOG.rdoc
2
3
  EXAMPLES
3
- History.txt
4
4
  LICENSE
5
5
  Manifest.txt
6
- README.txt
6
+ README.rdoc
7
7
  Rakefile
8
8
  lib/betabrite.rb
9
9
  lib/betabrite/autotest.rb
10
- lib/betabrite/base.rb
10
+ lib/betabrite/device.rb
11
11
  lib/betabrite/files.rb
12
12
  lib/betabrite/files/dots.rb
13
13
  lib/betabrite/files/file_dsl.rb
@@ -27,7 +27,7 @@ file displayed on the sign is labeled 'A'.
27
27
 
28
28
  Here is an example of modifying the default sign text:
29
29
 
30
- bb = BetaBrite::Serial.new('/dev/ttyUSB0') do |sign|
30
+ bb = BetaBrite::USB.new do |sign|
31
31
  sign.textfile do
32
32
  print ARGV[0]
33
33
  end
@@ -35,6 +35,7 @@ Here is an example of modifying the default sign text:
35
35
  bb.write!
36
36
 
37
37
  == Autotest Support
38
+
38
39
  Here is an example of a .autotest file using the BetaBrite module:
39
40
 
40
41
  require 'betabrite/autotest'
@@ -48,13 +49,14 @@ You don't need to give the hook method a block, but you can if you'd like to
48
49
  customize your messages.
49
50
 
50
51
  == Allocating Memory
52
+
51
53
  The memory in the BetaBrite sign should be configured before anything is
52
54
  written to it. You only have to configure the memory once before writing to
53
- it. So subsequent executions of your script do not require allocating memory.
55
+ it. Subsequent executions of your script do not require allocating memory.
54
56
 
55
57
  Here is an example of allocating memory on the sign:
56
58
 
57
- bb = BetaBrite::Serial.new('/dev/ttyUSB0') do |sign|
59
+ bb = BetaBrite::USB.new do |sign|
58
60
  sign.allocate do |memory|
59
61
  memory.text('A', 4096)
60
62
  memory.string('0', 64)
@@ -65,7 +67,9 @@ Here is an example of allocating memory on the sign:
65
67
  For more examples, see the EXAMPLES file.
66
68
 
67
69
  == Different File Types
70
+
68
71
  === Text Files
72
+
69
73
  The data stored in a text file is not supposed to change frequently. If the
70
74
  data in a text file is changed, the sign will go blank before anything is
71
75
  displayed. This is not good for applications like a stock ticker which
@@ -73,13 +77,14 @@ update data quite frequently. This problem can be avoided by having the
73
77
  text file reference more volitile files like String Files.
74
78
 
75
79
  === String Files
80
+
76
81
  String files contain more volitile memory. The contents of a String File
77
82
  can be changed without the screen going blank. String Files, however, cannot
78
83
  be displayed unless referenced from a Text File.
79
84
 
80
85
  Here is an example of referencing a String File from a Text File:
81
86
 
82
- bb = BetaBrite::Serial.new('/dev/ttyUSB0') do |sign|
87
+ bb = BetaBrite::USB.new do |sign|
83
88
  sign.stringfile('0') do
84
89
  print string("cruel").red
85
90
  end
data/Rakefile CHANGED
@@ -1,11 +1,9 @@
1
1
  require 'hoe'
2
2
 
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "lib")
4
- require 'betabrite'
3
+ Hoe.spec 'betabrite' do |p|
4
+ developer 'Aaron Patterson', 'aaron@tenderlovemaking.com'
5
5
 
6
- Hoe.new('betabrite', BetaBrite::VERSION) do |p|
7
- p.rubyforge_name = 'betabrite'
8
- p.author = 'Aaron Patterson'
9
- p.email = 'aaronp@rubyforge.org'
10
- p.summary = "Provides a Ruby interface to BetaBrite LED signs"
6
+ self.extra_rdoc_files = Dir['*.rdoc']
7
+ self.history_file = 'CHANGELOG.rdoc'
8
+ self.readme_file = 'README.rdoc'
11
9
  end
@@ -1,6 +1,6 @@
1
1
  require 'betabrite/string'
2
2
  require 'betabrite/files'
3
- require 'betabrite/base'
3
+ require 'betabrite/device'
4
4
  require 'betabrite/usb'
5
5
  require 'betabrite/serial'
6
6
  require 'betabrite/memory'
@@ -1,7 +1,7 @@
1
1
  module BetaBrite
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
 
4
- class Base
4
+ class Device
5
5
  include BetaBrite::Files
6
6
 
7
7
  # = Synopsis
@@ -14,9 +14,9 @@ module BetaBrite
14
14
  end
15
15
 
16
16
  def to_s
17
- string = "#{BetaBrite::Base::STX}#{COMMAND_CODE}#{@label.to_s}" +
17
+ string = "#{BetaBrite::Device::STX}#{COMMAND_CODE}#{@label.to_s}" +
18
18
  "#{sprintf('%02x', @rows)}#{sprintf('%02x', @columns)}" +
19
- "#{picture.join(BetaBrite::Base::CR)}#{BetaBrite::Base::CR}"
19
+ "#{picture.join(BetaBrite::Device::CR)}#{BetaBrite::Device::CR}"
20
20
  end
21
21
  alias :to_str :to_s
22
22
  end
@@ -13,8 +13,8 @@ module BetaBrite
13
13
  end
14
14
 
15
15
  def to_s
16
- "#{BetaBrite::Base::STX}#{COMMAND_CODE}#{@label.to_s}" +
17
- "#{@message.to_s}#{BetaBrite::Base::ETX}"
16
+ "#{BetaBrite::Device::STX}#{COMMAND_CODE}#{@label.to_s}" +
17
+ "#{@message.to_s}#{BetaBrite::Device::ETX}"
18
18
  end
19
19
  alias :to_str :to_s
20
20
  end
@@ -76,11 +76,11 @@ module BetaBrite
76
76
  end
77
77
 
78
78
  def stringfile(label)
79
- "#{BetaBrite::Base::DLE}#{label}"
79
+ "#{BetaBrite::Device::DLE}#{label}"
80
80
  end
81
81
 
82
82
  def dotsfile(label)
83
- "#{BetaBrite::Base::STRING}#{label}"
83
+ "#{BetaBrite::Device::STRING}#{label}"
84
84
  end
85
85
 
86
86
  def to_s
@@ -114,8 +114,8 @@ module BetaBrite
114
114
 
115
115
  private
116
116
  def combine
117
- "#{BetaBrite::Base::STX}#{WRITE}#{@label}#{BetaBrite::Base::ESC}" +
118
- "#{@position}#{@mode}#{@message}#{BetaBrite::Base::ETX}"
117
+ "#{BetaBrite::Device::STX}#{WRITE}#{@label}#{BetaBrite::Device::ESC}" +
118
+ "#{@position}#{@mode}#{@message}#{BetaBrite::Device::ETX}"
119
119
  end
120
120
  end
121
121
  end
@@ -7,7 +7,7 @@ module BetaBrite
7
7
  LOCKED = 'L'
8
8
  UNLOCKED = 'U'
9
9
  def self.clear
10
- BetaBrite::Base::STX << COMMAND_CODE
10
+ BetaBrite::Device::STX << COMMAND_CODE
11
11
  end
12
12
 
13
13
  attr_accessor :label, :type, :locked, :size, :time
@@ -91,7 +91,7 @@ module BetaBrite
91
91
 
92
92
  class Clear < Memory
93
93
  def to_s
94
- "#{BetaBrite::Base::STX}#{COMMAND_CODE}"
94
+ "#{BetaBrite::Device::STX}#{COMMAND_CODE}"
95
95
  end
96
96
  end
97
97
  end
@@ -1,5 +1,5 @@
1
1
  module BetaBrite
2
- class Serial < Base
2
+ class Serial < Device
3
3
  def initialize(serialport)
4
4
  @serialport = serialport
5
5
  super()
@@ -1,12 +1,12 @@
1
1
  module BetaBrite
2
- class USB < Base
2
+ class USB < Device
3
3
  # USB Device Codes
4
4
  PRODUCT_ID = 0x1234
5
5
  VENDOR_ID = 0x8765
6
6
  INTERFACE = 0x00
7
7
  RECV_LENGTH = 0x40 # Max Packet Size of 64
8
8
  SEND_LENGTH = 0x40 # Max Packet Size of 64
9
- WRITE_ENDPOINT = 0x02
9
+ WRITE_ENDPOINT = 0x02
10
10
  READ_ENDPOINT = 0x82
11
11
  WRITE_TIMEOUT = 5000
12
12
  READ_TIMEOUT = 5000
@@ -44,15 +44,15 @@ module BetaBrite
44
44
 
45
45
  retries = 0
46
46
  begin
47
- if PLATFORM =~ /mswin/
47
+ if RUBY_PLATFORM =~ /mswin/
48
48
  # http://osdir.com/ml/lib.libusb.devel.windows/2004-06/msg00001.html
49
- handle.set_configuration(0x01)
49
+ handle.set_configuration(0x01)
50
50
  end
51
51
  error_code = handle.usb_claim_interface(INTERFACE)
52
52
  raise unless error_code.nil?
53
53
  rescue
54
54
  handle.usb_detach_kernel_driver_np(INTERFACE);
55
- if retries.zero?
55
+ if retries.zero?
56
56
  retries += 1
57
57
  retry
58
58
  else
@@ -1,6 +1,2 @@
1
- %w{ ../lib }.each do |path|
2
- $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), path)))
3
- end
4
-
5
1
  require 'test/unit'
6
2
  require 'betabrite'
@@ -1,12 +1,8 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
- $:.unshift File.join(File.dirname(__FILE__), "..", "test")
3
-
4
- require 'test/unit'
5
- require 'betabrite'
1
+ require 'helper'
6
2
 
7
3
  class ManyMemoryAllocTest < Test::Unit::TestCase
8
4
  def setup
9
- @sign = BetaBrite::Base.new
5
+ @sign = BetaBrite::Device.new
10
6
  @sign.sleep_time = 0
11
7
  end
12
8
 
@@ -1,12 +1,6 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
- $:.unshift File.join(File.dirname(__FILE__), "..", "test")
3
-
4
- require 'test/unit'
5
- require 'betabrite'
6
-
7
1
  class MemoryAllocTest < Test::Unit::TestCase
8
2
  def setup
9
- @sign = BetaBrite::Base.new
3
+ @sign = BetaBrite::Device.new
10
4
  @sign.sleep_time = 0
11
5
  end
12
6
 
@@ -1,12 +1,6 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
- $:.unshift File.join(File.dirname(__FILE__), "..", "test")
3
-
4
- require 'test/unit'
5
- require 'betabrite'
6
-
7
1
  class SetStringTest < Test::Unit::TestCase
8
2
  def setup
9
- @sign = BetaBrite::Base.new
3
+ @sign = BetaBrite::Device.new
10
4
  @sign.sleep_time = 0
11
5
  end
12
6
 
@@ -1,9 +1,3 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
- $:.unshift File.join(File.dirname(__FILE__), "..", "test")
3
-
4
- require 'test/unit'
5
- require 'betabrite'
6
-
7
1
  class StringTest < Test::Unit::TestCase
8
2
  def test_const_dsl
9
3
  s = BetaBrite::String.new("hello") { |a|
@@ -1,9 +1,3 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
2
- $:.unshift File.join(File.dirname(__FILE__), "..", "test")
3
-
4
- require 'test/unit'
5
- require 'betabrite'
6
-
7
1
  class TextFileTest < Test::Unit::TestCase
8
2
  include BetaBrite::Files
9
3
 
@@ -1,5 +1,3 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), "helper"))
2
-
3
1
  class USBBetaBriteTest < Test::Unit::TestCase
4
2
  def test_stringfile
5
3
  bb = BetaBrite::USB.new do |sign|
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betabrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 4
10
+ version: 1.0.4
5
11
  platform: ruby
6
12
  authors:
7
13
  - Aaron Patterson
@@ -9,40 +15,45 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2008-07-25 00:00:00 -07:00
13
- default_executable:
18
+ date: 2011-08-20 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: hoe
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
- - - ">="
26
+ - - ~>
22
27
  - !ruby/object:Gem::Version
23
- version: 1.7.0
24
- version:
28
+ hash: 27
29
+ segments:
30
+ - 2
31
+ - 12
32
+ version: "2.12"
33
+ type: :development
34
+ version_requirements: *id001
25
35
  description: Provides a Ruby interface to BetaBrite LED signs.
26
- email: aaronp@rubyforge.org
36
+ email:
37
+ - aaron@tenderlovemaking.com
27
38
  executables: []
28
39
 
29
40
  extensions: []
30
41
 
31
42
  extra_rdoc_files:
32
- - History.txt
33
43
  - Manifest.txt
34
- - README.txt
44
+ - CHANGELOG.rdoc
45
+ - README.rdoc
35
46
  files:
36
47
  - .autotest
48
+ - CHANGELOG.rdoc
37
49
  - EXAMPLES
38
- - History.txt
39
50
  - LICENSE
40
51
  - Manifest.txt
41
- - README.txt
52
+ - README.rdoc
42
53
  - Rakefile
43
54
  - lib/betabrite.rb
44
55
  - lib/betabrite/autotest.rb
45
- - lib/betabrite/base.rb
56
+ - lib/betabrite/device.rb
46
57
  - lib/betabrite/files.rb
47
58
  - lib/betabrite/files/dots.rb
48
59
  - lib/betabrite/files/file_dsl.rb
@@ -68,33 +79,41 @@ files:
68
79
  - test/test_string.rb
69
80
  - test/test_text_file.rb
70
81
  - test/test_usb_betabrite.rb
71
- has_rdoc: true
82
+ - .gemtest
72
83
  homepage: http://rubyforge.org/projects/betabrite/
84
+ licenses: []
85
+
73
86
  post_install_message:
74
87
  rdoc_options:
75
88
  - --main
76
- - README.txt
89
+ - README.rdoc
77
90
  require_paths:
78
91
  - lib
79
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
80
94
  requirements:
81
95
  - - ">="
82
96
  - !ruby/object:Gem::Version
97
+ hash: 3
98
+ segments:
99
+ - 0
83
100
  version: "0"
84
- version:
85
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
86
103
  requirements:
87
104
  - - ">="
88
105
  - !ruby/object:Gem::Version
106
+ hash: 3
107
+ segments:
108
+ - 0
89
109
  version: "0"
90
- version:
91
110
  requirements: []
92
111
 
93
112
  rubyforge_project: betabrite
94
- rubygems_version: 1.2.0
113
+ rubygems_version: 1.8.8
95
114
  signing_key:
96
- specification_version: 2
97
- summary: Provides a Ruby interface to BetaBrite LED signs
115
+ specification_version: 3
116
+ summary: Provides a Ruby interface to BetaBrite LED signs.
98
117
  test_files:
99
118
  - test/test_many_mem.rb
100
119
  - test/test_memory.rb