beezwax 0.6.1 → 0.6.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{beezwax}
8
- s.version = "0.6.1"
8
+ s.version = "0.6.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Patrick Lardin"]
12
- s.date = %q{2010-12-20}
12
+ s.date = %q{2010-12-21}
13
13
  s.description = %q{Access Btrieve database files through a ruby API.}
14
14
  s.email = %q{plardin@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -2,7 +2,7 @@
2
2
  class BtrieveSession
3
3
  include Btrieve
4
4
  attr_reader :client_id, :cache, :btrieve_schema
5
- attr_accessor :host, :data_share
5
+ attr_accessor :db
6
6
  private_class_method :new
7
7
  @@instance=nil
8
8
 
@@ -11,9 +11,9 @@ class BtrieveSession
11
11
  # The 'host' argument can be a named server or its IP address.
12
12
  # The 'data_share' argument is typically the share name of the data folder.
13
13
  # The 'data_share' argument can also be the database name when "IDS" is used on the client.
14
- def BtrieveSession.create_session(host, data_share)
14
+ def BtrieveSession.create_session(db)
15
15
  raise "Cannot create more than one instance of session." if(@@instance != nil)
16
- @@instance = new(host, data_share)
16
+ @@instance = new(db)
17
17
  @@instance.set_schema(BtrieveSchema.new())
18
18
  end
19
19
 
@@ -68,9 +68,8 @@ class BtrieveSession
68
68
 
69
69
  private
70
70
 
71
- def initialize(host, data_share)
72
- @host = host
73
- @data_share = data_share
71
+ def initialize(db)
72
+ @db = db
74
73
  @client_id = "#{0.chr*12}#{[0x5257].pack('S')}#{rand(65535)}"
75
74
  @cache = {}
76
75
  end
@@ -17,7 +17,7 @@ class BtrieveTable
17
17
  # If a block is passed to the call, the table is closed automatically.
18
18
  # If a block is NOT passed to the call, the client code has to make sure to close the file.
19
19
  def open(mode=NORMAL_MODE, &block)
20
- file_unc="//#{session.host}/#{session.data_share}/#{@schema[:filename]}"
20
+ file_unc="//#{session.db}/#{@schema[:filename]}"
21
21
  btr_op(OPEN, @pos_buffer, NULL_BUFFER, file_unc, mode)
22
22
  if block_given?
23
23
  yield
@@ -3,7 +3,7 @@ require 'helper'
3
3
  class TestBeezwax < Test::Unit::TestCase
4
4
  context "when a BtrieveSession is initialized" do
5
5
  setup do
6
- BtrieveSession.create_session(DB_SERVER,"Demodata")
6
+ BtrieveSession.create_session(PSQL_DB)
7
7
  end
8
8
 
9
9
  teardown do
@@ -11,7 +11,7 @@ class TestBeezwax < Test::Unit::TestCase
11
11
  end
12
12
 
13
13
  should "not allow the creation of another session" do
14
- assert_raise(RuntimeError){BtrieveSession.create_session(DB_SERVER,"Demodata")}
14
+ assert_raise(RuntimeError){BtrieveSession.create_session(PSQL_DB)}
15
15
  end
16
16
 
17
17
  should "return a handle to the session singleton" do
@@ -255,7 +255,7 @@ class TestBeezwax < Test::Unit::TestCase
255
255
 
256
256
  context "A destroyed BtrieveSession" do
257
257
  setup do
258
- BtrieveSession.create_session(DB_SERVER,"Demodata")
258
+ BtrieveSession.create_session(PSQL_DB)
259
259
  @table = BtrieveTable.new(:course)
260
260
  BtrieveSession.destroy_session
261
261
  end
@@ -8,11 +8,13 @@ require 'beezwax'
8
8
 
9
9
 
10
10
  class Test::Unit::TestCase
11
- #DB_SERVER=nil
12
- DB_SERVER="10.211.55.4"
13
- context "The database server name DB_SERVER" do
11
+ # Make sure to define an entry in your idshosts file (found in /usr/local/psql/etc/ on Linux)
12
+ # The line appened to the file should look like this
13
+ # //demodata 10.211.55.4 DEMODATA
14
+ PSQL_DB="demodata"
15
+ context "The database server name PSQL_DB" do
14
16
  should "be defined to match your environment" do
15
- assert_not_nil DB_SERVER
17
+ assert_not_nil PSQL_DB
16
18
  end
17
19
  end
18
20
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 1
9
- version: 0.6.1
8
+ - 2
9
+ version: 0.6.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Patrick Lardin
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-20 00:00:00 -08:00
17
+ date: 2010-12-21 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency