rubyserial 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30f5682667203460ddee1ffb89b1e17f7612ead5
4
- data.tar.gz: 199f8b32f58167d17f2a9c830ae02bf06d031bd3
3
+ metadata.gz: 9ce647d8e2524f7be9f9eab6f12341b475a3e072
4
+ data.tar.gz: d4cc73f4f41c8795d4737671cd2a6d437c0d122c
5
5
  SHA512:
6
- metadata.gz: 12653189783500239bd2928e6ac2e077bde3ffcdb90bfb01fd4d1acff963d25ce4f0aa324ec17b93addc2d13bbacd5fe77eee037ed7ba312e654eb580676b015
7
- data.tar.gz: 2402e22dc4f6013e9b6fee9287b0bfb98544cf0d9a471572d853ce18e9e492ee13fa91fcf033dc46ee9e9b68f5e8fdd80284f57f39392372b85edecb443214a8
6
+ metadata.gz: 879d9a30a186a56a896e05ae4b62201dba1be9e1d55b68f7c167411cd251f626bba1d66dcba87251af86fe6e32fccc787739e944d482f623f468107dd67bfe63
7
+ data.tar.gz: a5111483592217d45747b19bc1ba2fe99f33e262bb20165ccb3b4ddef34d076e899e1855e212a5592890a7789de75fb1c1af26b1331345c7097d4730db0170dc
data/README.md CHANGED
@@ -7,6 +7,7 @@ Unlike other Ruby serial port implementations, it supports all of the most popul
7
7
  The interface to RubySerial should be (mostly) compatible with other Ruby serialport gems, so you should be able to drop in the new gem, change the `require` and use it as a replacement. If not, please let us know so we can address any issues.
8
8
 
9
9
  [![Build Status](https://travis-ci.org/hybridgroup/rubyserial.svg)](https://travis-ci.org/hybridgroup/rubyserial)
10
+ [![Build status](https://ci.appveyor.com/api/projects/status/946nlaqy4443vb99/branch/master?svg=true)](https://ci.appveyor.com/project/zankich/rubyserial/branch/master)
10
11
 
11
12
  ## Installation
12
13
 
@@ -0,0 +1,25 @@
1
+ platform:
2
+ - x64
3
+
4
+ install:
5
+ - SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
6
+ - ruby -v
7
+ - gem install bundler
8
+ - bundle install
9
+ - ps: Start-FileDownload https://github.com/hybridgroup/rubyserial/raw/appveyor_deps/com0com.cer
10
+ - ps: C:\"Program Files"\"Microsoft SDKs"\Windows\v7.1\Bin\CertMgr.exe /add com0com.cer /s /r localMachine root
11
+ - ps: C:\"Program Files"\"Microsoft SDKs"\Windows\v7.1\Bin\CertMgr.exe /add com0com.cer /s /r localMachine trustedpublisher
12
+ - ps: Start-FileDownload https://github.com/hybridgroup/rubyserial/raw/appveyor_deps/setup_com0com_W7_x64_signed.exe
13
+ - ps: $env:CNC_INSTALL_CNCA0_CNCB0_PORTS="YES"
14
+ - ps: .\setup_com0com_W7_x64_signed.exe /S
15
+ - ps: sleep 60
16
+
17
+ test_script:
18
+ - ps: rspec spec -fd
19
+
20
+ environment:
21
+ matrix:
22
+ - ruby_version: "200-x64"
23
+ - ruby_version: "21-x64"
24
+
25
+ build: off
@@ -78,7 +78,7 @@ class Serial
78
78
  if i == 0
79
79
  nil
80
80
  else
81
- buff.read_string.unpack('C').first
81
+ buff.get_bytes(0,1).bytes.first
82
82
  end
83
83
  end
84
84
 
@@ -1,5 +1,5 @@
1
1
  module RubySerial
2
2
  unless const_defined?('VERSION')
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@ require 'ffi'
3
3
  class Serial
4
4
  def initialize(address, baude_rate=9600, data_bits=8)
5
5
  file_opts = RubySerial::Win32::GENERIC_READ | RubySerial::Win32::GENERIC_WRITE
6
- @fd = RubySerial::Win32.CreateFileA(address, file_opts, 0, nil, RubySerial::Win32::OPEN_EXISTING, 0, nil)
6
+ @fd = RubySerial::Win32.CreateFileA("\\\\.\\#{address}", file_opts, 0, nil, RubySerial::Win32::OPEN_EXISTING, 0, nil)
7
7
  err = FFI.errno
8
8
  if err != 0
9
9
  raise RubySerial::Exception, RubySerial::Win32::ERROR_CODES[err]
@@ -83,7 +83,7 @@ class Serial
83
83
  loop do
84
84
  current_byte = getbyte
85
85
  bytes << current_byte unless current_byte.nil?
86
- break if (bytes.last(sep.bytes.to_a.size) == sep.bytes) || ((bytes.size == limit) if limit)
86
+ break if (bytes.last(sep.bytes.to_a.size) == sep.bytes.to_a) || ((bytes.size == limit) if limit)
87
87
  end
88
88
 
89
89
  bytes.map { |e| e.chr }.join
@@ -5,29 +5,15 @@ describe "rubyserial" do
5
5
  @ports = []
6
6
  require 'rbconfig'
7
7
  if RbConfig::CONFIG['host_os'] =~ /mswin|windows|mingw/i
8
- @command_output = `powershell "Get-WmiObject Win32_SerialPort | Select-Object DeviceID, Description"`
9
- @prefix = "\\\\.\\"
10
- @coms = @command_output.scan(/COM\d*/).uniq
11
- @file_array = @command_output.split("\n")
12
- @file_array.each do |line|
13
- if line.include?('com0com')
14
- @coms.each do |e|
15
- if line =~ /#{e}/
16
- @ports << "#{@prefix}#{e}"
17
- end
18
- end
19
- end
20
- end
21
-
22
- if @ports[0].nil?
23
- puts "Heya mister (or miss(es)). For this to work you need com0com "\
24
- "installed. It doesn't look like you have it so rerun this after you"\
25
- "install it from here: https://code.google.com/p/powersdr-iq/download"\
26
- "s/detail?name=setup_com0com_W7_x64_signed.exe&can=2&q="
27
- end
8
+ # NOTE: Tests on windows require com0com
9
+ # https://github.com/hybridgroup/rubyserial/raw/appveyor_deps/setup_com0com_W7_x64_signed.exe
10
+ @ports[0] = "\\\\.\\CNCA0"
11
+ @ports[1] = "\\\\.\\CNCB0"
28
12
  else
29
13
  File.delete('socat.log') if File.file?('socat.log')
30
14
 
15
+ raise 'socat not found' unless (`socat -h` && $? == 0)
16
+
31
17
  Thread.new do
32
18
  system('socat -lf socat.log -d -d pty,raw,echo=0 pty,raw,echo=0')
33
19
  end
@@ -84,6 +70,12 @@ describe "rubyserial" do
84
70
  expect(@sp.getbyte).to be_nil
85
71
  end
86
72
 
73
+ it 'should give me a zero byte from getbyte' do
74
+ @sp2.write("\x00")
75
+ sleep 0.1
76
+ expect(@sp.getbyte).to eql(0)
77
+ end
78
+
87
79
  it "should give me bytes" do
88
80
  @sp2.write('hello')
89
81
  # small delay so it can write to the other port.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyserial
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Zankich
@@ -10,20 +10,20 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-01-16 00:00:00.000000000 Z
13
+ date: 2015-05-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
21
  version: 1.9.3
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - "~>"
26
+ - - ~>
27
27
  - !ruby/object:Gem::Version
28
28
  version: 1.9.3
29
29
  description: FFI Ruby library for RS-232 serial port communication
@@ -32,13 +32,14 @@ executables: []
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
- - ".gitignore"
36
- - ".rspec"
37
- - ".travis.yml"
35
+ - .gitignore
36
+ - .rspec
37
+ - .travis.yml
38
38
  - Gemfile
39
39
  - LICENSE
40
40
  - README.md
41
41
  - Rakefile
42
+ - appveyor.yml
42
43
  - lib/rubyserial.rb
43
44
  - lib/rubyserial/linux_constants.rb
44
45
  - lib/rubyserial/osx_constants.rb
@@ -59,18 +60,19 @@ require_paths:
59
60
  - lib
60
61
  required_ruby_version: !ruby/object:Gem::Requirement
61
62
  requirements:
62
- - - ">="
63
+ - - '>='
63
64
  - !ruby/object:Gem::Version
64
65
  version: '0'
65
66
  required_rubygems_version: !ruby/object:Gem::Requirement
66
67
  requirements:
67
- - - ">="
68
+ - - '>='
68
69
  - !ruby/object:Gem::Version
69
70
  version: '0'
70
71
  requirements: []
71
72
  rubyforge_project:
72
- rubygems_version: 2.2.2
73
+ rubygems_version: 2.2.1
73
74
  signing_key:
74
75
  specification_version: 4
75
76
  summary: FFI Ruby library for RS-232 serial port communication
76
77
  test_files: []
78
+ has_rdoc: