activerecord-jdbcdbf-adapter 0.9.7-java

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/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010-2011 Nick Ricketts <nightshade427@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,7 @@
1
+ Manifest.txt
2
+ Rakefile
3
+ README.txt
4
+ LICENSE.txt
5
+ lib/active_record
6
+ lib/active_record/connection_adapters
7
+ lib/active_record/connection_adapters/jdbcdbf_adapter.rb
data/README.txt ADDED
@@ -0,0 +1,33 @@
1
+ = activerecord-jdbcdbf-adapter
2
+
3
+ * http://github.com/nightshade427/activerecord-jdbcdbf-adapter
4
+
5
+ == DESCRIPTION:
6
+
7
+ This is an ActiveRecord driver for DBF files [DBASE/FOXPRO/VFP] using
8
+ JDBC running under JRuby. It has been tested with HXTT DBF JDBC
9
+ Driver. It should work with any compliant JDBC DBF driver though.
10
+
11
+ == CONFIGURATION:
12
+
13
+ Until this is made into a gem. place into vendor directory and add it
14
+ to loadpath in environment.rb
15
+
16
+ config.load_paths += %W( #{Rails.root}/vendor/activerecord-jdbcdbf-adapter/lib )
17
+
18
+ * adapter: jdbcdbf
19
+ * driver: Java Class for DBF JDBC Driver
20
+ * url: url the driver needs to load the DBF databases (You can add
21
+ driver specific options to end of url, see examples below)
22
+
23
+ Example database.yml
24
+
25
+ * development:
26
+ adapter: jdbcdbf
27
+ driver: com.hxtt.sql.dbf.DBFDriver
28
+ url: jdbc:DBF:////my_data
29
+
30
+ * development:
31
+ adapter: jdbcdbf
32
+ driver: com.hxtt.sql.dbf.DBFDriver
33
+ url: jdbc:DBF:////Data?charSet=UTF8&lockType=FOXPRO&versionNumber=F5&ODBCTrimBehavior=true
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ MANIFEST = FileList["Manifest.txt", "Rakefile", "README.txt", "LICENSE.txt", "lib/**/*"]
2
+
3
+ file "Manifest.txt" => :manifest
4
+ task :manifest do
5
+ File.open("Manifest.txt", "w") {|f| MANIFEST.each {|n| f << "#{n}\n"} }
6
+ end
7
+ Rake::Task['manifest'].invoke
8
+
9
+ begin
10
+ require 'hoe'
11
+ Hoe.plugin :gemcutter
12
+ hoe = Hoe.spec("activerecord-jdbcdbf-adapter") do |p|
13
+ p.version = "0.9.7"
14
+ p.spec_extras[:platform] = Gem::Platform.new("java")
15
+ p.url = "http://github.com/nightshade427/activerecord-jdbcdbf-adapter"
16
+ p.author = "Nick Ricketts"
17
+ p.email = "nightshade427@gmail.com"
18
+ p.summary = "DBF JDBC adapter for JRuby on Rails."
19
+ p.description = "Install this gem to use DBF with JRuby on Rails."
20
+ p.extra_deps += [['activerecord-jdbc-adapter', "= 0.9.7"]]
21
+ end
22
+ task :gemspec do
23
+ File.open("#{hoe.name}.gemspec", "w") {|f| f << hoe.spec.to_ruby }
24
+ end
25
+ task :package => :gemspec
26
+ rescue LoadError
27
+ puts "You really need Hoe installed to be able to package this gem"
28
+ rescue => e
29
+ puts "ignoring error while loading hoe: #{e.to_s}"
30
+ end
@@ -0,0 +1,46 @@
1
+ tried_gem = false
2
+ begin
3
+ require "jdbc_adapter"
4
+ rescue LoadError
5
+ raise if tried_gem
6
+ require 'rubygems'
7
+ gem "activerecord-jdbc-adapter"
8
+ tried_gem = true
9
+ retry
10
+ end
11
+
12
+ require 'active_record/connection_adapters/jdbc_adapter'
13
+
14
+ module ActiveRecord
15
+ class Base
16
+ class << self
17
+ alias_method :jdbcdbf_connection, :jdbc_connection
18
+ end
19
+ end
20
+ end
21
+
22
+ module JdbcSpec
23
+ module FoxPro
24
+ def self.adapter_matcher(name, *)
25
+ name =~ /dbf/i ? self : false
26
+ end
27
+ def add_limit_offset!(sql, options) # :nodoc:
28
+ if options[:limit]
29
+ find_select = /\b(SELECT(?:\s+DISTINCT)?)\b(.*)/i
30
+ whole, select, rest = find_select.match(sql).to_a
31
+ "#{select} TOP #{options[:lmit]} #{rest}"
32
+ end
33
+ end
34
+ def columns(table_name, name = nil)
35
+ super.each { |column| column.name.downcase! }
36
+ end
37
+ def select(sql, name=nil)
38
+ (super sql, name).map { |row| row.inject({}) { |new_row, pair| new_row[pair[0].downcase] = pair[1]; new_row } }
39
+ end
40
+ def quoted_true; 'false'; end
41
+ def quoted_false; 'true'; end
42
+ def supports_migrations?; false; end
43
+ def quoted_date(value); "#{value.strftime("%Y-%m-%d")}"; end
44
+ end
45
+ end
46
+
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activerecord-jdbcdbf-adapter
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 9
8
+ - 7
9
+ version: 0.9.7
10
+ platform: java
11
+ authors:
12
+ - Nick Ricketts
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-07-08 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activerecord-jdbc-adapter
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 9
30
+ - 7
31
+ version: 0.9.7
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rubyforge
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 2
43
+ - 0
44
+ - 4
45
+ version: 2.0.4
46
+ type: :development
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: hoe
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 2
57
+ - 6
58
+ - 0
59
+ version: 2.6.0
60
+ type: :development
61
+ version_requirements: *id003
62
+ description: Install this gem to use DBF with JRuby on Rails.
63
+ email: nightshade427@gmail.com
64
+ executables: []
65
+
66
+ extensions: []
67
+
68
+ extra_rdoc_files:
69
+ - Manifest.txt
70
+ - README.txt
71
+ - LICENSE.txt
72
+ files:
73
+ - Manifest.txt
74
+ - Rakefile
75
+ - README.txt
76
+ - LICENSE.txt
77
+ - lib/active_record/connection_adapters/jdbcdbf_adapter.rb
78
+ has_rdoc: true
79
+ homepage: http://github.com/nightshade427/activerecord-jdbcdbf-adapter
80
+ licenses: []
81
+
82
+ post_install_message:
83
+ rdoc_options:
84
+ - --main
85
+ - README.txt
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ requirements: []
103
+
104
+ rubyforge_project: activerecord-jdbcdbf-adapter
105
+ rubygems_version: 1.3.6
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: DBF JDBC adapter for JRuby on Rails.
109
+ test_files: []
110
+