ctapi 0.2.2 → 0.2.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.
@@ -0,0 +1,8 @@
1
+ module CTAPI
2
+ # CTAPI version
3
+ VERSION = '0.2.3'
4
+ VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
+ VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
+ VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
7
+ VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
8
+ end
@@ -1,55 +1,55 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'test/unit'
4
+ $:.unshift 'lib'
5
+ $:.unshift '../lib'
4
6
  require 'ctapi'
5
7
 
6
8
  class TC_CTAPI < Test::Unit::TestCase
7
-
8
9
  include CTAPI
9
- @@ct = Cardterminal.init(PORT_COM1)
10
+ CT = Cardterminal.init(PORT_COM1)
10
11
 
11
12
  def test_preconditions
12
- assert_instance_of(Cardterminal, @@ct)
13
- assert_instance_of(Cardterminal::Manufacturer, @@ct.manufacturer)
14
- assert(@@ct.card_inserted?)
15
- assert_instance_of(Cardterminal::Card, @@ct.card)
16
- assert(@@ct.card.atr_ok?)
17
- assert(@@ct.card.memory_size >= 255) # I hope there is no smaller size
18
- assert(@@ct.card.structure)
19
- assert(@@ct.card.protocol)
13
+ assert_instance_of(Cardterminal, CT)
14
+ assert_instance_of(Cardterminal::Manufacturer, CT.manufacturer)
15
+ assert(CT.card_inserted?)
16
+ assert_instance_of(Cardterminal::Card, CT.card)
17
+ assert(CT.card.atr_ok?)
18
+ assert(CT.card.memory_size >= 255) # I hope there is no smaller size
19
+ assert(CT.card.structure)
20
+ assert(CT.card.protocol)
20
21
  end
21
22
 
22
23
  def test_read
23
- assert(!@@ct.read(0, 0))
24
- assert(@@ct.read(0, 255).size == 255)
25
- assert(@@ct.read.size == @@ct.card.memory_size)
26
- assert(@@ct.read(100).size == @@ct.card.memory_size - 100)
27
- old_cs = @@ct.chunk_size
28
- @@ct.chunk_size = 23
29
- assert(!@@ct.read(0, 0))
30
- assert(@@ct.read(0, 255).size == 255)
31
- assert(@@ct.read.size == @@ct.card.memory_size)
32
- assert(@@ct.read(100).size == @@ct.card.memory_size - 100)
33
- @@ct.chunk_size = old_cs
24
+ assert(!CT.read(0, 0))
25
+ assert(CT.read(0, 255).size == 255)
26
+ assert(CT.read.size == CT.card.memory_size)
27
+ assert(CT.read(100).size == CT.card.memory_size - 100)
28
+ old_cs = CT.chunk_size
29
+ CT.chunk_size = 23
30
+ assert(!CT.read(0, 0))
31
+ assert(CT.read(0, 255).size == 255)
32
+ assert(CT.read.size == CT.card.memory_size)
33
+ assert(CT.read(100).size == CT.card.memory_size - 100)
34
+ CT.chunk_size = old_cs
34
35
  end
35
36
 
36
37
  def test_write
37
38
  data = (1..255).to_a
38
- big = "A" * @@ct.card.memory_size
39
- assert(!@@ct.write(''))
40
- assert(@@ct.write(data))
41
- assert_equal(data.pack("C*"), @@ct.read(0, 255))
42
- assert(@@ct.write(big))
43
- assert_equal(@@ct.read, big)
44
- old_cs = @@ct.chunk_size
45
- @@ct.chunk_size = 23
46
- assert(!@@ct.write(''))
47
- assert(@@ct.write(data))
48
- assert_equal(data.pack("C*"), @@ct.read(0, 255))
49
- assert(@@ct.write(big))
50
- assert_equal(@@ct.read, big)
51
- @@ct.chunk_size = old_cs
39
+ big = "A" * CT.card.memory_size
40
+ assert(!CT.write(''))
41
+ assert(CT.write(data))
42
+ assert_equal(data.pack("C*"), CT.read(0, 255))
43
+ assert(CT.write(big))
44
+ assert_equal(CT.read, big)
45
+ old_cs = CT.chunk_size
46
+ CT.chunk_size = 23
47
+ assert(!CT.write(''))
48
+ assert(CT.write(data))
49
+ assert_equal(data.pack("C*"), CT.read(0, 255))
50
+ assert(CT.write(big))
51
+ assert_equal(CT.read, big)
52
+ CT.chunk_size = old_cs
52
53
  end
53
-
54
54
  end
55
55
  # vim: set et sw=2 ts=2:
metadata CHANGED
@@ -1,53 +1,76 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.1
3
- specification_version: 1
4
2
  name: ctapi
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.2.2
7
- date: 2004-10-01
8
- summary: Ruby extension for Chipcard Cardterminal-API (CTAPI)
9
- require_paths:
10
- - lib
11
- author: Florian Frank
12
- email: flori@ping.de
13
- homepage: http://ctapi.rubyforge.org
14
- rubyforge_project: ctapi
15
- description: "These are Ruby bindings to a library that supports the Cardterminal-API (CTAPI) for chipcards. It should be possible to link this against any carddriver library that supports this standard, but I have actually only tested with libtowitoko."
16
- autorequire: ctapi
17
- default_executable:
4
+ version: 0.2.3
5
+ platform: ruby
6
+ authors:
7
+ - Florian Frank
8
+ autorequire:
18
9
  bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-26 00:00:00 +02:00
13
+ default_executable: ctsh.rb
14
+ dependencies: []
15
+
16
+ description: |
17
+ These are Ruby bindings to a library that supports the Cardterminal-API (CTAPI)
18
+ for chipcards. It should be possible to link this against any carddriver
19
+ library that supports this standard, but I have actually only tested with
20
+ libtowitoko.
21
+
22
+ email: flori@ping.de
23
+ executables:
24
+ - cardinfo.rb
25
+ - ctsh.rb
26
+ extensions:
27
+ - ext/extconf.rb
28
+ extra_rdoc_files:
29
+ - doc-main.txt
30
+ files:
31
+ - CHANGES
32
+ - COPYING
33
+ - README
34
+ - Rakefile
35
+ - VERSION
36
+ - bin/cardinfo.rb
37
+ - bin/ctsh.rb
38
+ - ctapi.gemspec
39
+ - ext/ctapicore.c
40
+ - ext/extconf.rb
41
+ - install.rb
42
+ - lib/ctapi.rb
43
+ - lib/ctapi/version.rb
44
+ - tests/test.rb
45
+ - doc-main.txt
19
46
  has_rdoc: true
20
- required_ruby_version: !ruby/object:Gem::Version::Requirement
47
+ homepage: http://ctapi.rubyforge.org
48
+ licenses: []
49
+
50
+ post_install_message:
51
+ rdoc_options:
52
+ - --main
53
+ - doc-main.txt
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
21
57
  requirements:
22
- -
23
- - ">"
24
- - !ruby/object:Gem::Version
25
- version: 0.0.0
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
26
67
  version:
27
- platform: ruby
28
- files:
29
- - README.en
30
- - CHANGES
31
- - GPL
32
- - examples
33
- - Rakefile
34
- - VERSION
35
- - install.rb
36
- - make_doc.rb
37
- - ext
38
- - lib
39
- - tests
40
- - examples/cardinfo.rb
41
- - examples/ctsh.rb
42
- - ext/ctapicore.c
43
- - ext/extconf.rb
44
- - lib/ctapi.rb
45
- - tests/test.rb
46
- test_files: []
47
- rdoc_options: []
48
- extra_rdoc_files: []
49
- executables: []
50
- extensions:
51
- - ext/extconf.rb
52
68
  requirements: []
53
- dependencies: []
69
+
70
+ rubyforge_project: ctapi
71
+ rubygems_version: 1.3.2
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: Ruby extension for Chipcard Cardterminal-API (CTAPI)
75
+ test_files:
76
+ - tests/test.rb
data/README.en DELETED
@@ -1,31 +0,0 @@
1
- Installation
2
- ============
3
-
4
- Just type into the command line as root:
5
-
6
- # ruby install.rb LIBRARYNAME
7
-
8
- where LIBRARYNAME is the name of the ctapi driver library to use. If you want
9
- to link against the towitoko library, this would be, e. g.,
10
-
11
- # ruby install.rb towitoko
12
-
13
- Documentation
14
- =============
15
-
16
- To generate the documentation in doc/ type:
17
- $ ruby make_doc.rb
18
-
19
- There is also an example of how to use this library in the examples
20
- subdirectory.
21
-
22
- Author
23
- ======
24
-
25
- Florian Frank <flori@ping.de>
26
-
27
- License
28
- =======
29
-
30
- GNU General Public License (GPL)
31
-
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'irb'
4
- require 'irb/completion'
5
- require 'ctapi'
6
-
7
- include CTAPI
8
- $ct = Cardterminal.new(PORT_COM1)
9
- IRB.start
10
- # vim: set et sw=2 ts=2:
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $outdir = 'doc/'
4
- puts "Creating documentation in '#$outdir'."
5
- system "rdoc -o #$outdir lib/ctapi.rb ext/ctapicore.c"
6
- # vim: set et sw=2 ts=2: