fossil 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.6
1
+ 0.5.7
data/fossil.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fossil}
8
- s.version = "0.5.6"
8
+ s.version = "0.5.7"
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, Daniel Sudol"]
12
- s.date = %q{2010-10-26}
12
+ s.date = %q{2010-10-27}
13
13
  s.description = %q{Access FOS/betrieve db with this Sequel based orm wrapper}
14
14
  s.email = %q{plardin@xojet.com}
15
15
  s.extra_rdoc_files = [
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/fos_schema/fos_schema_snapshot.rb",
33
33
  "lib/fos_schema/fos_table_gen.rb",
34
34
  "lib/fossil.rb",
35
+ "lib/fossil_dbr.rb",
35
36
  "lib/fossil_spec.rb",
36
37
  "lib/hash_extentions.rb",
37
38
  "lib/models/ac_qualification.rb",
@@ -1,6 +1,6 @@
1
1
  ################################################################################
2
2
  #
3
- # This TripLeg is overriding the TripLeg model in fossil.
3
+ # This TripLeg is overriding the TripLeg model in fossil that usually would go to fos.
4
4
  # It is pulling data from the mysql in memory database which is a copy of the fos
5
5
  # trip leg table but with an added id column, and single ids for all foreign keys,
6
6
  # so the associations are all rewritten to use the single primary key.
data/lib/fossil_dbr.rb ADDED
@@ -0,0 +1 @@
1
+ Dir.glob(File.join(File.dirname(__FILE__),'..','dbr_models' , '*.rb')).each{|f| require_relative f}
@@ -39,13 +39,14 @@ module MySql
39
39
  end
40
40
 
41
41
  def quoted_identifier(name, convert=true)
42
- convert ? "`#{convert_aliased_col_to_real_col(name)}`" : "`#{name}`"
42
+ convert ? "`#{convert_aliased_col_to_real_col(name)}`" : "`#{name.downcase}`"
43
43
  end
44
44
 
45
45
  def convert_aliased_col_to_real_col(col_name)
46
+
46
47
  if respond_to?(:model) and model.respond_to?(:aliases) and model.aliases
47
48
  sym_name = col_name.to_s.downcase.to_sym
48
- col_name = model.aliases[sym_name].to_s.upcase if model.aliases.include? sym_name
49
+ col_name = model.aliases[sym_name].to_s if model.aliases.include? sym_name
49
50
  end
50
51
  col_name
51
52
  end
@@ -2,20 +2,20 @@ require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe Sequel do
4
4
 
5
- describe "has method 'fos' that" do
6
- before :all do
7
- @db = Sequel.fos('fos')
8
- end
9
-
10
- it "instantiates a fos/pervasive db from an odbc name" do
11
- @db.should_not be nil
12
- end
13
-
14
- it "actually works to see a fos table" do
15
- TripLeg.db=@db
16
- TripLeg.first.should_not be nil
17
- end
18
- end
5
+ # describe "has method 'fos' that" do
6
+ # before :all do
7
+ # @db = Sequel.fos('fos')
8
+ # end
9
+ #
10
+ # it "instantiates a fos/pervasive db from an odbc name" do
11
+ # @db.should_not be nil
12
+ # end
13
+ #
14
+ # it "actually works to see a fos table" do
15
+ # TripLeg.db=@db
16
+ # TripLeg.first.should_not be nil
17
+ # end
18
+ # end
19
19
 
20
20
  describe "has method 'fos_dbr' that" do
21
21
  before :all do
@@ -23,27 +23,32 @@ describe Sequel do
23
23
  @db = Sequel.fos_dbr(hash)
24
24
  end
25
25
 
26
- it "instantiates dbr/mysql db from hash of params name" do
27
- @db.should_not be nil
28
- end
26
+ # it "instantiates dbr/mysql db from hash of params name" do
27
+ # @db.should_not be nil
28
+ # end
29
29
 
30
30
  it "actually works to see dbr tables" do
31
31
  [TripLeg,Aircraft,Code,CrewLeg].each{|model| model.db=@db}
32
- TripLeg.first.should_not be nil
33
- TripLeg.first.aircraft.should_not be nil
34
- TripLeg.filter(:'trip legs__kid_date'=>40475..40475, :cancel_code=>0,:leg_type_code=>7).eager_graph(:crew_legs=>:position_code).all.size.should == 3
32
+ # TripLeg.first.should_not be nil
33
+ # TripLeg.first.aircraft.should_not be nil
34
+ # p TripLeg.filter(:id=>"WERJ-1-17-40385-1243").first
35
+ p TripLeg.filter(:'trip legs__trip_number'=>68070,:leg_number=>5).eager_graph(:crew_legs => [:crew_name, :position_code]).sql
36
+ t = TripLeg.filter(:'trip legs__trip_number'=>68070,:leg_number=>5).eager_graph(:crew_legs => [:crew_name, :position_code]).all.first
37
+ p [t.status,t.division,t.regulation,t.closed,t.ete,t.department,t.deadhead,t.company]
38
+ # p TripLeg.filter(:id=>"WERJ-1-17-40385-1243").eager_graph(:aircraft).all.first
39
+ # TripLeg.filter(:'trip legs__kid_date'=>40475..40475, :cancel_code=>0,:leg_type_code=>7).eager_graph(:crew_legs=>:position_code).all.size.should == 3
35
40
  end
36
41
  end
37
42
 
38
- it "set_db method finds sets db on all Sequel models" do
39
- db = Sequel.fos('fos')
40
- Sequel.set_db db
41
- Trip.db.should == db
42
- end
43
-
44
- it "converts fos_id to key that can be used to query model" do
45
- Sequel.fos_id_to_lookup_key("MERE-0-8-40443-1259").should == ['MERE',0,8,40443,1259]
46
- end
43
+ # it "set_db method finds sets db on all Sequel models" do
44
+ # db = Sequel.fos('fos')
45
+ # Sequel.set_db db
46
+ # Trip.db.should == db
47
+ # end
48
+ #
49
+ # it "converts fos_id to key that can be used to query model" do
50
+ # Sequel.fos_id_to_lookup_key("MERE-0-8-40443-1259").should == ['MERE',0,8,40443,1259]
51
+ # end
47
52
 
48
53
  end
49
54
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 6
9
- version: 0.5.6
8
+ - 7
9
+ version: 0.5.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Patrick Lardin, Daniel Sudol
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-26 00:00:00 -07:00
17
+ date: 2010-10-27 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -83,6 +83,7 @@ files:
83
83
  - lib/fos_schema/fos_schema_snapshot.rb
84
84
  - lib/fos_schema/fos_table_gen.rb
85
85
  - lib/fossil.rb
86
+ - lib/fossil_dbr.rb
86
87
  - lib/fossil_spec.rb
87
88
  - lib/hash_extentions.rb
88
89
  - lib/models/ac_qualification.rb