activerecord-jdbc-alt-adapter 50.3.0-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.
Files changed (198) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +35 -0
  3. data/.travis.yml +100 -0
  4. data/.yardopts +4 -0
  5. data/CONTRIBUTING.md +50 -0
  6. data/Gemfile +92 -0
  7. data/History.md +1191 -0
  8. data/LICENSE.txt +26 -0
  9. data/README.md +240 -0
  10. data/RUNNING_TESTS.md +127 -0
  11. data/Rakefile +336 -0
  12. data/Rakefile.jdbc +20 -0
  13. data/activerecord-jdbc-adapter.gemspec +55 -0
  14. data/activerecord-jdbc-alt-adapter.gemspec +56 -0
  15. data/lib/active_record/connection_adapters/as400_adapter.rb +2 -0
  16. data/lib/active_record/connection_adapters/db2_adapter.rb +1 -0
  17. data/lib/active_record/connection_adapters/derby_adapter.rb +1 -0
  18. data/lib/active_record/connection_adapters/firebird_adapter.rb +1 -0
  19. data/lib/active_record/connection_adapters/h2_adapter.rb +1 -0
  20. data/lib/active_record/connection_adapters/hsqldb_adapter.rb +1 -0
  21. data/lib/active_record/connection_adapters/informix_adapter.rb +1 -0
  22. data/lib/active_record/connection_adapters/jdbc_adapter.rb +1 -0
  23. data/lib/active_record/connection_adapters/jndi_adapter.rb +1 -0
  24. data/lib/active_record/connection_adapters/mariadb_adapter.rb +1 -0
  25. data/lib/active_record/connection_adapters/mssql_adapter.rb +1 -0
  26. data/lib/active_record/connection_adapters/mysql2_adapter.rb +1 -0
  27. data/lib/active_record/connection_adapters/mysql_adapter.rb +1 -0
  28. data/lib/active_record/connection_adapters/postgresql_adapter.rb +1 -0
  29. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +1 -0
  30. data/lib/active_record/connection_adapters/sqlserver_adapter.rb +1 -0
  31. data/lib/activerecord-jdbc-adapter.rb +1 -0
  32. data/lib/arel/visitors/compat.rb +60 -0
  33. data/lib/arel/visitors/db2.rb +137 -0
  34. data/lib/arel/visitors/derby.rb +112 -0
  35. data/lib/arel/visitors/firebird.rb +79 -0
  36. data/lib/arel/visitors/h2.rb +25 -0
  37. data/lib/arel/visitors/hsqldb.rb +32 -0
  38. data/lib/arel/visitors/postgresql_jdbc.rb +6 -0
  39. data/lib/arel/visitors/sql_server.rb +225 -0
  40. data/lib/arel/visitors/sql_server/ng42.rb +294 -0
  41. data/lib/arel/visitors/sqlserver.rb +214 -0
  42. data/lib/arjdbc.rb +19 -0
  43. data/lib/arjdbc/abstract/connection_management.rb +35 -0
  44. data/lib/arjdbc/abstract/core.rb +74 -0
  45. data/lib/arjdbc/abstract/database_statements.rb +64 -0
  46. data/lib/arjdbc/abstract/statement_cache.rb +58 -0
  47. data/lib/arjdbc/abstract/transaction_support.rb +86 -0
  48. data/lib/arjdbc/db2.rb +4 -0
  49. data/lib/arjdbc/db2/adapter.rb +789 -0
  50. data/lib/arjdbc/db2/as400.rb +130 -0
  51. data/lib/arjdbc/db2/column.rb +167 -0
  52. data/lib/arjdbc/db2/connection_methods.rb +44 -0
  53. data/lib/arjdbc/derby.rb +3 -0
  54. data/lib/arjdbc/derby/active_record_patch.rb +13 -0
  55. data/lib/arjdbc/derby/adapter.rb +540 -0
  56. data/lib/arjdbc/derby/connection_methods.rb +20 -0
  57. data/lib/arjdbc/derby/schema_creation.rb +15 -0
  58. data/lib/arjdbc/discover.rb +104 -0
  59. data/lib/arjdbc/firebird.rb +4 -0
  60. data/lib/arjdbc/firebird/adapter.rb +434 -0
  61. data/lib/arjdbc/firebird/connection_methods.rb +23 -0
  62. data/lib/arjdbc/h2.rb +3 -0
  63. data/lib/arjdbc/h2/adapter.rb +303 -0
  64. data/lib/arjdbc/h2/connection_methods.rb +27 -0
  65. data/lib/arjdbc/hsqldb.rb +3 -0
  66. data/lib/arjdbc/hsqldb/adapter.rb +297 -0
  67. data/lib/arjdbc/hsqldb/connection_methods.rb +28 -0
  68. data/lib/arjdbc/hsqldb/explain_support.rb +35 -0
  69. data/lib/arjdbc/hsqldb/schema_creation.rb +11 -0
  70. data/lib/arjdbc/informix.rb +5 -0
  71. data/lib/arjdbc/informix/adapter.rb +162 -0
  72. data/lib/arjdbc/informix/connection_methods.rb +9 -0
  73. data/lib/arjdbc/jdbc.rb +59 -0
  74. data/lib/arjdbc/jdbc/adapter.rb +475 -0
  75. data/lib/arjdbc/jdbc/adapter_require.rb +46 -0
  76. data/lib/arjdbc/jdbc/base_ext.rb +15 -0
  77. data/lib/arjdbc/jdbc/callbacks.rb +53 -0
  78. data/lib/arjdbc/jdbc/column.rb +97 -0
  79. data/lib/arjdbc/jdbc/connection.rb +14 -0
  80. data/lib/arjdbc/jdbc/connection_methods.rb +37 -0
  81. data/lib/arjdbc/jdbc/error.rb +65 -0
  82. data/lib/arjdbc/jdbc/extension.rb +59 -0
  83. data/lib/arjdbc/jdbc/java.rb +13 -0
  84. data/lib/arjdbc/jdbc/railtie.rb +2 -0
  85. data/lib/arjdbc/jdbc/rake_tasks.rb +3 -0
  86. data/lib/arjdbc/jdbc/serialized_attributes_helper.rb +3 -0
  87. data/lib/arjdbc/jdbc/type_cast.rb +166 -0
  88. data/lib/arjdbc/jdbc/type_converter.rb +142 -0
  89. data/lib/arjdbc/mssql.rb +7 -0
  90. data/lib/arjdbc/mssql/adapter.rb +384 -0
  91. data/lib/arjdbc/mssql/column.rb +29 -0
  92. data/lib/arjdbc/mssql/connection_methods.rb +79 -0
  93. data/lib/arjdbc/mssql/database_statements.rb +134 -0
  94. data/lib/arjdbc/mssql/errors.rb +6 -0
  95. data/lib/arjdbc/mssql/explain_support.rb +129 -0
  96. data/lib/arjdbc/mssql/extensions.rb +36 -0
  97. data/lib/arjdbc/mssql/limit_helpers.rb +231 -0
  98. data/lib/arjdbc/mssql/lock_methods.rb +77 -0
  99. data/lib/arjdbc/mssql/old_adapter.rb +804 -0
  100. data/lib/arjdbc/mssql/old_column.rb +200 -0
  101. data/lib/arjdbc/mssql/quoting.rb +101 -0
  102. data/lib/arjdbc/mssql/schema_creation.rb +31 -0
  103. data/lib/arjdbc/mssql/schema_definitions.rb +74 -0
  104. data/lib/arjdbc/mssql/schema_statements.rb +329 -0
  105. data/lib/arjdbc/mssql/transaction.rb +69 -0
  106. data/lib/arjdbc/mssql/types.rb +52 -0
  107. data/lib/arjdbc/mssql/types/binary_types.rb +33 -0
  108. data/lib/arjdbc/mssql/types/date_and_time_types.rb +134 -0
  109. data/lib/arjdbc/mssql/types/deprecated_types.rb +40 -0
  110. data/lib/arjdbc/mssql/types/numeric_types.rb +71 -0
  111. data/lib/arjdbc/mssql/types/string_types.rb +56 -0
  112. data/lib/arjdbc/mssql/utils.rb +66 -0
  113. data/lib/arjdbc/mysql.rb +3 -0
  114. data/lib/arjdbc/mysql/adapter.rb +140 -0
  115. data/lib/arjdbc/mysql/connection_methods.rb +166 -0
  116. data/lib/arjdbc/oracle/adapter.rb +863 -0
  117. data/lib/arjdbc/postgresql.rb +3 -0
  118. data/lib/arjdbc/postgresql/adapter.rb +687 -0
  119. data/lib/arjdbc/postgresql/base/array_decoder.rb +26 -0
  120. data/lib/arjdbc/postgresql/base/array_encoder.rb +25 -0
  121. data/lib/arjdbc/postgresql/base/array_parser.rb +95 -0
  122. data/lib/arjdbc/postgresql/base/pgconn.rb +11 -0
  123. data/lib/arjdbc/postgresql/column.rb +51 -0
  124. data/lib/arjdbc/postgresql/connection_methods.rb +67 -0
  125. data/lib/arjdbc/postgresql/name.rb +24 -0
  126. data/lib/arjdbc/postgresql/oid_types.rb +266 -0
  127. data/lib/arjdbc/railtie.rb +11 -0
  128. data/lib/arjdbc/sqlite3.rb +3 -0
  129. data/lib/arjdbc/sqlite3/adapter.rb +678 -0
  130. data/lib/arjdbc/sqlite3/connection_methods.rb +59 -0
  131. data/lib/arjdbc/sybase.rb +2 -0
  132. data/lib/arjdbc/sybase/adapter.rb +47 -0
  133. data/lib/arjdbc/tasks.rb +13 -0
  134. data/lib/arjdbc/tasks/database_tasks.rb +31 -0
  135. data/lib/arjdbc/tasks/databases.rake +48 -0
  136. data/lib/arjdbc/tasks/db2_database_tasks.rb +104 -0
  137. data/lib/arjdbc/tasks/derby_database_tasks.rb +95 -0
  138. data/lib/arjdbc/tasks/h2_database_tasks.rb +31 -0
  139. data/lib/arjdbc/tasks/hsqldb_database_tasks.rb +70 -0
  140. data/lib/arjdbc/tasks/jdbc_database_tasks.rb +169 -0
  141. data/lib/arjdbc/tasks/mssql_database_tasks.rb +46 -0
  142. data/lib/arjdbc/util/quoted_cache.rb +60 -0
  143. data/lib/arjdbc/util/serialized_attributes.rb +98 -0
  144. data/lib/arjdbc/util/table_copier.rb +110 -0
  145. data/lib/arjdbc/version.rb +3 -0
  146. data/lib/generators/jdbc/USAGE +9 -0
  147. data/lib/generators/jdbc/jdbc_generator.rb +17 -0
  148. data/lib/jdbc_adapter.rb +2 -0
  149. data/lib/jdbc_adapter/rake_tasks.rb +4 -0
  150. data/lib/jdbc_adapter/version.rb +4 -0
  151. data/pom.xml +114 -0
  152. data/rails_generators/jdbc_generator.rb +15 -0
  153. data/rails_generators/templates/config/initializers/jdbc.rb +10 -0
  154. data/rails_generators/templates/lib/tasks/jdbc.rake +11 -0
  155. data/rakelib/01-tomcat.rake +51 -0
  156. data/rakelib/02-test.rake +132 -0
  157. data/rakelib/bundler_ext.rb +11 -0
  158. data/rakelib/db.rake +75 -0
  159. data/rakelib/rails.rake +223 -0
  160. data/src/java/arjdbc/ArJdbcModule.java +276 -0
  161. data/src/java/arjdbc/db2/DB2Module.java +76 -0
  162. data/src/java/arjdbc/db2/DB2RubyJdbcConnection.java +126 -0
  163. data/src/java/arjdbc/derby/DerbyModule.java +178 -0
  164. data/src/java/arjdbc/derby/DerbyRubyJdbcConnection.java +152 -0
  165. data/src/java/arjdbc/firebird/FirebirdRubyJdbcConnection.java +174 -0
  166. data/src/java/arjdbc/h2/H2Module.java +50 -0
  167. data/src/java/arjdbc/h2/H2RubyJdbcConnection.java +85 -0
  168. data/src/java/arjdbc/hsqldb/HSQLDBModule.java +73 -0
  169. data/src/java/arjdbc/informix/InformixRubyJdbcConnection.java +75 -0
  170. data/src/java/arjdbc/jdbc/AdapterJavaService.java +43 -0
  171. data/src/java/arjdbc/jdbc/Callable.java +44 -0
  172. data/src/java/arjdbc/jdbc/ConnectionFactory.java +45 -0
  173. data/src/java/arjdbc/jdbc/DataSourceConnectionFactory.java +156 -0
  174. data/src/java/arjdbc/jdbc/DriverConnectionFactory.java +63 -0
  175. data/src/java/arjdbc/jdbc/DriverWrapper.java +119 -0
  176. data/src/java/arjdbc/jdbc/JdbcResult.java +130 -0
  177. data/src/java/arjdbc/jdbc/RubyConnectionFactory.java +61 -0
  178. data/src/java/arjdbc/jdbc/RubyJdbcConnection.java +3979 -0
  179. data/src/java/arjdbc/mssql/MSSQLModule.java +90 -0
  180. data/src/java/arjdbc/mssql/MSSQLRubyJdbcConnection.java +508 -0
  181. data/src/java/arjdbc/mysql/MySQLModule.java +152 -0
  182. data/src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java +294 -0
  183. data/src/java/arjdbc/oracle/OracleModule.java +80 -0
  184. data/src/java/arjdbc/oracle/OracleRubyJdbcConnection.java +455 -0
  185. data/src/java/arjdbc/postgresql/ByteaUtils.java +157 -0
  186. data/src/java/arjdbc/postgresql/PgDateTimeUtils.java +52 -0
  187. data/src/java/arjdbc/postgresql/PostgreSQLModule.java +77 -0
  188. data/src/java/arjdbc/postgresql/PostgreSQLResult.java +192 -0
  189. data/src/java/arjdbc/postgresql/PostgreSQLRubyJdbcConnection.java +948 -0
  190. data/src/java/arjdbc/sqlite3/SQLite3Module.java +73 -0
  191. data/src/java/arjdbc/sqlite3/SQLite3RubyJdbcConnection.java +525 -0
  192. data/src/java/arjdbc/util/CallResultSet.java +826 -0
  193. data/src/java/arjdbc/util/DateTimeUtils.java +699 -0
  194. data/src/java/arjdbc/util/ObjectSupport.java +65 -0
  195. data/src/java/arjdbc/util/QuotingUtils.java +137 -0
  196. data/src/java/arjdbc/util/StringCache.java +63 -0
  197. data/src/java/arjdbc/util/StringHelper.java +145 -0
  198. metadata +269 -0
data/LICENSE.txt ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2017-2018 The JRuby Team
2
+ Copyright (c) 2012-2016 Karol Bucek <self@kares.org>
3
+ Copyright (c) 2006-2012 Nick Sieger <nick@nicksieger.com>
4
+ Copyright (c) 2006-2008 Ola Bini <ola.bini@gmail.com>
5
+
6
+ All rights reserved.
7
+
8
+ Redistribution and use in source and binary forms, with or without modification,
9
+ are permitted provided that the following conditions are met:
10
+
11
+ - Redistributions of source code must retain the above copyright notice, this
12
+ list of conditions and the following disclaimer.
13
+ - Redistributions in binary form must reproduce the above copyright notice, this
14
+ list of conditions and the following disclaimer in the documentation and/or
15
+ other materials provided with the distribution.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,240 @@
1
+ # ActiveRecord JDBC Alternative Adapter
2
+
3
+ This adapter is a fork of the ActiveRecord JDBC Adapter with basic support for
4
+ **SQL Server/Azure SQL** only, At this stage only works with JRuby on Rails 5.0
5
+ and support for Rails 5.1 is planned in the near future. This adapter may work
6
+ with other databases supported by the original adapter but it is advised to
7
+ use the [original adapter](https://github.com/jruby/activerecord-jdbc-adapter)
8
+
9
+
10
+ ### How to use it:
11
+
12
+ Add the following to your `Gemfile`:
13
+
14
+ ```
15
+ gem 'activerecord-jdbc-alt-adapter', '~> 50.3.0'
16
+
17
+ gem 'jdbc-mssql', '~> 0.6.0'
18
+ ```
19
+
20
+
21
+ ### Breaking changes
22
+
23
+ - This adapter let SQL Server be SQL Server, it does not make SQL Server to be
24
+ more like MySQL or PostgreSQL, The query will just fails if SQL Server does not
25
+ support that SQL dialect.
26
+ - This adapter uses the `datetime2` sql data type as the Rails logical `datetime` data type.
27
+ - This adapter needs the mssql jdbc driver version 7.0.0 onwards to work properly,
28
+ therefore you can use the gem `jdbc-mssql` version `0.5.0` onwards or the actual
29
+ driver jar file version `7.0.0`.
30
+
31
+
32
+ ### Recommendation
33
+
34
+ In order to avoid deadlocks it is advised to use `SET READ_COMMITTED_SNAPSHOT ON`
35
+ Make sure to run `ALTER DATABASE your_db SET READ_COMMITTED_SNAPSHOT ON` against
36
+ your database.
37
+
38
+ If you prefer to use the `READ_UNCOMMITED` transaction isolation level as your
39
+ default isolation level, add the `transaction_isolation: 'read_uncommitted'` in
40
+ your database config.
41
+
42
+ If you have slow queries on your background jobs and locking queries you can change the default
43
+ `lock_timeout` config, add the `lock_timeout: 10000` in your database config.
44
+
45
+ database config example (`database.yml`):
46
+
47
+ ```yml
48
+ # SQL Server (2012 or higher recommended)
49
+
50
+ default: &default
51
+ adapter: sqlserver
52
+ encoding: utf8
53
+
54
+ development:
55
+ <<: *default
56
+ host: localhost
57
+ database: jruby_development
58
+ username: dev
59
+ password: password
60
+ transaction_isolation: read_uncommitted
61
+ lock_timeout: 10000
62
+ ```
63
+
64
+ ### WARNING
65
+
66
+ Keep one eye in the Rails connection pool, we have not thoroughly tested that
67
+ part since we don't use the default Rails connection pool, other than that
68
+ this adapter should just work.
69
+
70
+
71
+
72
+ # ActiveRecord JDBC Adapter
73
+
74
+ [![Gem Version](https://badge.fury.io/rb/activerecord-jdbc-adapter.svg)][7]
75
+
76
+ ActiveRecord-JDBC-Adapter (AR-JDBC) is the main database adapter for Rails'
77
+ *ActiveRecord* component that can be used with [JRuby][0].
78
+ ActiveRecord-JDBC-Adapter provides full or nearly full support for:
79
+ **MySQL**, **PostgreSQL**, **SQLite3**. In the near future there are plans to
80
+ add support **MSSQL**. Unless we get more contributions we will not be going
81
+ beyond these four adapters. Note that the amount of work needed to get
82
+ another adapter is not huge but the amount of testing required to make sure
83
+ that adapter continues to work is not something we can do with the resources
84
+ we currently have.
85
+
86
+ For Oracle database users you are encouraged to use
87
+ https://github.com/rsim/oracle-enhanced.
88
+
89
+ Version **50.x** supports Rails version 5.0.x and it lives on branch 50-stable.
90
+ Version **51.x** supports Rails version 5.1.x and is currently on master until
91
+ its first release. The minimum version of JRuby for 50+ is JRuby **9.1.x** and
92
+ JRuby 9.1+ requires Java 7 or newer (we recommend Java 8 at minimum).
93
+
94
+ ## Using ActiveRecord JDBC
95
+
96
+ ### Inside Rails
97
+
98
+ To use AR-JDBC with JRuby on Rails:
99
+
100
+ 1. Choose the adapter you wish to gem install. The following pre-packaged
101
+ adapters are available:
102
+
103
+ - MySQL (`activerecord-jdbcmysql-adapter`)
104
+ - PostgreSQL (`activerecord-jdbcpostgresql-adapter`)
105
+ - SQLite3 (`activerecord-jdbcsqlite3-adapter`)
106
+
107
+ 2. If you're generating a new Rails application, use the following command:
108
+
109
+ jruby -S rails new sweetapp
110
+
111
+ 3. Configure your *database.yml* in the normal Rails style:
112
+
113
+ ```yml
114
+ development:
115
+ adapter: mysql2 # or mysql
116
+ database: blog_development
117
+ username: blog
118
+ password: 1234
119
+ ```
120
+
121
+ For JNDI data sources, you may simply specify the JNDI location as follows, it's
122
+ recommended to use the same adapter: setting as one would configure when using
123
+ "bare" (JDBC) connections e.g. :
124
+
125
+ ```yml
126
+ production:
127
+ adapter: postgresql
128
+ jndi: jdbc/PostgreDS
129
+ ```
130
+
131
+ **NOTE:** any other settings such as *database:*, *username:*, *properties:* make
132
+ no difference since everything is already configured on the JNDI DataSource end.
133
+
134
+ JDBC driver specific properties might be set if you use an URL to specify the DB
135
+ or preferably using the *properties:* syntax:
136
+
137
+ ```yml
138
+ production:
139
+ adapter: mysql
140
+ username: blog
141
+ password: blog
142
+ url: "jdbc:mysql://localhost:3306/blog?profileSQL=true"
143
+ properties: # specific to com.mysql.jdbc.Driver
144
+ socketTimeout: 60000
145
+ connectTimeout: 60000
146
+ ```
147
+
148
+ ### Standalone with ActiveRecord
149
+
150
+ Once the setup is made (see below) you can establish a JDBC connection like this
151
+ (e.g. for `activerecord-jdbcderby-adapter`):
152
+
153
+ ```ruby
154
+ ActiveRecord::Base.establish_connection(
155
+ adapter: 'sqlite3',
156
+ database: 'db/my-database'
157
+ )
158
+ ```
159
+
160
+ #### Using Bundler
161
+
162
+ Proceed as with Rails; specify `ActiveRecord` in your Bundle along with the
163
+ chosen JDBC adapter(s), this time sample *Gemfile* for MySQL:
164
+
165
+ ```ruby
166
+ gem 'activerecord', '~> 5.0.6'
167
+ gem 'activerecord-jdbcmysql-adapter', :platform => :jruby
168
+ ```
169
+
170
+ When you `require 'bundler/setup'` everything will be set up for you as expected.
171
+
172
+ #### Without Bundler
173
+
174
+ Install the needed gems with JRuby, for example:
175
+
176
+ gem install activerecord -v "~> 5.0.6"
177
+ gem install activerecord-jdbc-adapter --ignore-dependencies
178
+
179
+ If you wish to use the adapter for a specific database, you can install it
180
+ directly and the (jdbc-) driver gem (dependency) will be installed as well:
181
+
182
+ jruby -S gem install activerecord-jdbcmysql-adapter
183
+
184
+ Your program should include:
185
+
186
+ ```ruby
187
+ require 'active_record'
188
+ require 'activerecord-jdbc-adapter' if defined? JRUBY_VERSION
189
+ ```
190
+
191
+ ## Source
192
+
193
+ The source for activerecord-jdbc-adapter is available using git:
194
+
195
+ git clone git://github.com/jruby/activerecord-jdbc-adapter.git
196
+
197
+ Please note that the project manages multiple gems from a single repository,
198
+ if you're using *Bundler* >= 1.2 it should be able to locate all gemspecs from
199
+ the git repository. Sample *Gemfile* for running with (MySQL) master:
200
+
201
+ ```ruby
202
+ gem 'activerecord-jdbc-adapter', :github => 'jruby/activerecord-jdbc-adapter'
203
+ gem 'activerecord-jdbcmysql-adapter', :github => 'jruby/activerecord-jdbc-adapter'
204
+ ```
205
+
206
+ ## Getting Involved
207
+
208
+ Please read our [CONTRIBUTING](CONTRIBUTING.md) & [RUNNING_TESTS](RUNNING_TESTS.md)
209
+ guides for starters. You can always help us by maintaining AR-JDBC's [wiki][5].
210
+
211
+ ## Feedback
212
+
213
+ Please report bugs at our [issue tracker][3]. If you're not sure if
214
+ something's a bug, feel free to pre-report it on the [mailing lists][1] or
215
+ ask on the #JRuby IRC channel on http://freenode.net/ (try [web-chat][6]).
216
+
217
+ ## Authors
218
+
219
+ This project was originally written by [Nick Sieger](http://github.com/nicksieger)
220
+ and [Ola Bini](http://github.com/olabini) with lots of help from the JRuby community.
221
+ Polished 3.x compatibility and 4.x support (for AR-JDBC >= 1.3.0) was managed by
222
+ [Karol Bucek](http://github.com/kares) among others.
223
+
224
+ ## License
225
+
226
+ ActiveRecord-JDBC-Adapter is open-source released under the BSD/MIT license.
227
+ See [LICENSE.txt](LICENSE.txt) included with the distribution for details.
228
+
229
+ Open-source driver gems within AR-JDBC's sources are licensed under the same
230
+ license the database's drivers are licensed. See each driver gem's LICENSE.txt.
231
+
232
+ [0]: http://www.jruby.org/
233
+ [1]: http://jruby.org/community
234
+ [2]: http://github.com/jruby/activerecord-jdbc-adapter/blob/master/activerecord-jdbcmssql-adapter
235
+ [3]: https://github.com/jruby/activerecord-jdbc-adapter/issues
236
+ [4]: http://github.com/nicksieger/activerecord-cachedb-adapter
237
+ [5]: https://github.com/jruby/activerecord-jdbc-adapter/wiki
238
+ [6]: https://webchat.freenode.net/?channels=#jruby
239
+ [7]: http://badge.fury.io/rb/activerecord-jdbc-adapter
240
+ [8]: https://github.com/jruby/activerecord-jdbc-adapter/wiki/Migrating-from-1.2.x-to-1.3.0
data/RUNNING_TESTS.md ADDED
@@ -0,0 +1,127 @@
1
+ There are two sets of tests which we run in CI. Local (AR-JDBC) test and
2
+ Rails activerecord tests. The next two sections details how to run each
3
+ and customize behavior.
4
+
5
+
6
+ ## Running AR-JDBC's Tests
7
+
8
+ After you have built arjdbc (run rake), then you can try testing it (if you
9
+ do not build then adapter_java.jar is not put into the lib dir). If you
10
+ change any of the .java files you will need to rebuild.
11
+
12
+ Most DB specific unit tests hide under the **test/db** directory, the files
13
+ included in the *test* directory are mostly shared test modules and helpers.
14
+
15
+ Rake tasks are loaded from **rakelib/02-test-rake**, most adapters have a
16
+ corresponding test_[adapter] task e.g. `rake test_sqlite3` that run against DB.
17
+ To check all available (test related) tasks simply `rake -T | grep test`.
18
+
19
+ If the adapter supports creating a database it will try to do so automatically
20
+ (most embed databases such as SQLite3) for some adapters (MySQL, PostgreSQL) we
21
+ do this auto-magically (see the `rake db:create` tasks), but otherwise you'll
22
+ need to setup a database dedicated for tests (using the standard tools that come
23
+ with your DB installation).
24
+
25
+ Connection parameters: database, host etc. can usually be changed from the shell
26
+ `env` for adapters where there might be no direct control over the DB
27
+ instance/configuration, e.g. for Oracle (by looking at **test/db/oracle.rb**)
28
+ one might adapt the test database configuration using :
29
+ ```
30
+ export ORACLE_HOST=192.168.1.2
31
+ export ORACLE_USER=SAMPLE
32
+ export ORACLE_PASS=sample
33
+ export ORACLE_SID=MAIN
34
+ ```
35
+
36
+ Tests are run by calling the rake task corresponding the database adapter being
37
+ tested, e.g. for MySQL :
38
+
39
+ rake test_mysql TEST=test/db/mysql/rake_test.rb
40
+
41
+ Observe the **TEST** variable used to specify a single file to be used to resolve
42
+ test cases, you pick tests by matching their names as well using **TESTOPTS** :
43
+
44
+ rake test_postgres TESTOPTS="--name=/integer/"
45
+
46
+ Since 1.3.0 we also support prepared statements, these are enabled by default (AR)
47
+ but one can easily run tests with prepared statements disabled using env vars :
48
+
49
+ rake test_derby PREPARED_STATEMENTS=false
50
+
51
+
52
+ ### ActiveRecord (Rails) Tests
53
+
54
+ We also can run our adapters against Rails ActiveRecord tests. There are two
55
+ ways you can do this:
56
+
57
+ - Run against local clone (by setting RAILS environment variable). This is helpful when you are adding puts or hacking on activerecord code directly.
58
+
59
+ - Run against bundler provided clone (by setting AR_VERSION environment variable). This is useful when you want to submit to travis and want all the adapters to run against your code.
60
+
61
+ Note: RAILS will trump AR_VERSION and setting neither will assume version as
62
+ set in the gemspec.
63
+
64
+ ### Run against local clone
65
+
66
+ Make sure you have rails cloned somewhere:
67
+
68
+ ```text
69
+ git clone git://github.com/rails/rails.git
70
+ ```
71
+
72
+ Set up a fully qualified RAILS environment variable. For example, if you were
73
+ in activerecord direction you can just do something like:
74
+
75
+ ```ext
76
+ export RAILS=`pwd`/../rails
77
+ ```
78
+
79
+ Now that is this set up we may have changed the gems we need so we have
80
+ to run bundler:
81
+
82
+ ```text
83
+ bundle install
84
+ ```
85
+
86
+ Before you run tests you need to be aware that each support branch we have is
87
+ written to run with a single significant release of rails (50-stable will only
88
+ work well with rails 5.0.x). So you need to make sure you local copy of rails
89
+ is checked out to match whatever you are testing (e.g. git checkout v5.0.6).
90
+ Now you can run rails tests:
91
+
92
+ ```text
93
+ jruby -S rake rails:test_sqlite3
94
+ jruby -S rake rails:test_postgres
95
+ jruby -S rake rails:test_mysql
96
+ ```
97
+
98
+ ### Run against bundler provided clone
99
+
100
+ AR_VERSION is a very flexible variable. You can:
101
+
102
+ - specify tag (export AR_VERSION=v5.0.6)
103
+ - specify version (export AR_VERSION=5.0.6)
104
+ - specify SHA hash (export AR_VERSION=875bb788f56311ac4628402667187f755c1a331c)
105
+ - specify branch (export AR_VERSION=verify-release)
106
+ - specify nothing to assume LOADPATH has loaded it (export AR_VERSION=false)
107
+
108
+ Now that is this set up we may have changed the gems we need so we have
109
+ to run bundler:
110
+
111
+ ```text
112
+ bundle install
113
+ ```
114
+
115
+ Once you have picked what you want to test you can run:
116
+
117
+ ```text
118
+ jruby -S rake rails:test_sqlite3
119
+ jruby -S rake rails:test_postgres
120
+ jruby -S rake rails:test_mysql
121
+ ```
122
+
123
+ [![Build Status][0]](http://travis-ci.org/#!/jruby/activerecord-jdbc-adapter)
124
+
125
+ Happy Testing!
126
+
127
+ [0]: https://secure.travis-ci.org/jruby/activerecord-jdbc-adapter.png
data/Rakefile ADDED
@@ -0,0 +1,336 @@
1
+ require 'rake/clean'
2
+
3
+ CLEAN.include 'derby*', 'test.db.*', '*test.sqlite3', 'test/reports'
4
+ CLEAN.include 'lib/**/*.jar', 'MANIFEST.MF', '*.log', 'target/*'
5
+
6
+ task :default => :jar # RubyGems extention will do a bare `rake' e.g. :
7
+ # jruby" -rubygems /opt/local/rvm/gems/jruby-1.7.16@jdbc/gems/rake-10.3.2/bin/rake
8
+ # RUBYARCHDIR=/opt/local/rvm/gems/jruby-1.7.16@jdbc/gems/activerecord-jdbc-adapter-1.4.0.dev/lib
9
+ # RUBYLIBDIR=/opt/local/rvm/gems/jruby-1.7.16@jdbc/gems/activerecord-jdbc-adapter-1.4.0.dev/lib
10
+ #
11
+ # under Bundler it points those DIRs to an empty one where only built extensions are stored :
12
+ # jruby -rubygems /opt/local/rvm/gems/jruby-1.7.19@temp/gems/rake-10.4.2/bin/rake
13
+ # RUBYARCHDIR=/opt/local/rvm/gems/jruby-1.7.19@temp/bundler/gems/extensions/universal-java-1.7/1.9/activerecord-jdbc-adapter-472b5fddba43
14
+ # RUBYLIBDIR=/opt/local/rvm/gems/jruby-1.7.19@temp/bundler/gems/extensions/universal-java-1.7/1.9/activerecord-jdbc-adapter-472b5fddba43
15
+ #
16
+ # javac -target 1.6 -source 1.6 -Xlint:unchecked -g -cp
17
+ # "/opt/local/rvm/rubies/jruby-1.7.19/lib/jruby.jar:
18
+ # /opt/local/maven-repo/mysql/mysql-connector-java/5.1.33/mysql-connector-java-5.1.33.jar:
19
+ # /opt/local/maven-repo/org/postgresql/postgresql/9.4-1200-jdbc4/postgresql-9.4-1200-jdbc4.jar"
20
+ # -d /tmp/d20150417-32100-7mb1bk src/java/arjdbc/ArJdbcModule.java ...
21
+
22
+
23
+ base_dir = Dir.pwd
24
+ gem_name = 'activerecord-jdbc-alt-adapter'
25
+ gemspec_path = File.expand_path('activerecord-jdbc-alt-adapter.gemspec', File.dirname(__FILE__))
26
+ gemspec = lambda do
27
+ @_gemspec_ ||= Dir.chdir(File.dirname(__FILE__)) do
28
+ Gem::Specification.load(gemspec_path)
29
+ end
30
+ end
31
+ built_gem_path = lambda do
32
+ Dir[File.join(base_dir, "#{gem_name}-*.gem")].sort_by{ |f| File.mtime(f) }.last
33
+ end
34
+ current_version = lambda { gemspec.call.version }
35
+ rake = lambda { |task| ruby "-S", "rake", task }
36
+
37
+ # NOTE: avoid Bundler loading due native extension building!
38
+
39
+ desc "Build #{gem_name} gem into the pkg directory."
40
+ task :build => :jar do
41
+ sh("RELEASE=#{ENV['RELEASE']} gem build -V '#{gemspec_path}'") do
42
+ gem_path = built_gem_path.call
43
+ file_name = File.basename(gem_path)
44
+ FileUtils.mkdir_p(File.join(base_dir, 'pkg'))
45
+ FileUtils.mv(gem_path, 'pkg')
46
+ puts "\n#{gem_name} #{current_version.call} built to 'pkg/#{file_name}'"
47
+ end
48
+ end
49
+
50
+ desc "Build and install #{gem_name} gem into system gems."
51
+ task :install => :build do
52
+ gem_path = built_gem_path.call
53
+ sh("gem install '#{gem_path}' --local") do |ok|
54
+ raise "Couldn't install gem, run `gem install #{gem_path}' for more detailed output" unless ok
55
+ puts "\n#{gem_name} (#{current_version.call}) installed"
56
+ end
57
+ end
58
+
59
+ desc "Releasing AR-JDBC gems (use NOOP=true to disable gem pushing)"
60
+ task 'release:do' do
61
+ ENV['RELEASE'] = 'true' # so that .gemspec is built with adapter_java.jar
62
+ Rake::Task['build'].invoke
63
+ # Rake::Task['build:adapters'].invoke
64
+
65
+ noop = ENV.key?('NOOP') && (ENV['NOOP'] != 'false' && ENV['NOOP'] != '')
66
+
67
+ version = current_version.call; version_tag = "v#{version}"
68
+
69
+ sh("git diff --no-patch --exit-code", :noop => noop) { |ok| fail "git working dir is not clean" unless ok }
70
+ sh("git diff-index --quiet --cached HEAD", :noop => noop) { |ok| fail "git index is not clean" unless ok }
71
+
72
+ sh "git tag -a -m \"AR-JDBC #{version}\" #{version_tag}", :noop => noop
73
+ branch = `git rev-parse --abbrev-ref HEAD`.strip
74
+ puts "releasing from (current) branch #{branch.inspect}"
75
+ sh "for gem in `ls pkg/*-#{version}-java.gem`; do gem push $gem; done", :noop => noop do |ok|
76
+ sh "git push origin #{branch} --tags", :noop => noop if ok
77
+ end
78
+ end
79
+
80
+ task 'release:push' do
81
+ sh "for gem in `ls pkg/*-#{current_version.call}-java.gem`; do gem push $gem; done"
82
+ end
83
+
84
+ ADAPTERS = %w[mysql postgresql sqlite3].map { |a| "activerecord-jdbc#{a}-adapter" }
85
+ DRIVERS = %w[mysql postgres sqlite3].map { |a| "jdbc-#{a}" }
86
+ TARGETS = ( ADAPTERS + DRIVERS )
87
+
88
+ ADAPTERS.each do |target|
89
+ namespace target do
90
+ task :build do
91
+ version = current_version.call
92
+ Dir.chdir(target) { rake.call "build" }
93
+ cp FileList["#{target}/pkg/#{target}-#{version}-java.gem"], "pkg"
94
+ end
95
+ end
96
+ end
97
+ DRIVERS.each do |target|
98
+ namespace target do
99
+ task :build do
100
+ Dir.chdir(target) { rake.call "build" }
101
+ cp FileList["#{target}/pkg/#{target}-*.gem"], "pkg"
102
+ end
103
+ end
104
+ end
105
+ TARGETS.each do |target|
106
+ namespace target do
107
+ task :install do
108
+ Dir.chdir(target) { rake.call "install" }
109
+ end
110
+ #task :release do
111
+ # Dir.chdir(target) { rake.call "release" }
112
+ #end
113
+ end
114
+ end
115
+
116
+ # DRIVERS
117
+
118
+ desc "Build drivers"
119
+ task "build:drivers" => DRIVERS.map { |name| "#{name}:build" }
120
+ task "drivers:build" => 'build:drivers'
121
+
122
+ desc "Install drivers"
123
+ task "install:drivers" => DRIVERS.map { |name| "#{name}:install" }
124
+ task "drivers:install" => 'install:drivers'
125
+
126
+ # ADAPTERS
127
+
128
+ desc "Build adapters"
129
+ task "build:adapters" => [ 'build' ] + ADAPTERS.map { |name| "#{name}:build" }
130
+ task "adapters:build" => 'build:adapters'
131
+
132
+ desc "Install adapters"
133
+ task "install:adapters" => [ 'install' ] + ADAPTERS.map { |name| "#{name}:install" }
134
+ task "adapters:install" => 'install:adapters'
135
+
136
+ # ALL
137
+
138
+ task "build:all" => [ 'build' ] + TARGETS.map { |name| "#{name}:build" }
139
+ task "all:build" => 'build:all'
140
+ task "install:all" => [ 'install' ] + TARGETS.map { |name| "#{name}:install" }
141
+ task "all:install" => 'install:all'
142
+
143
+ require 'rake/testtask'
144
+
145
+ # native JRuby extension (adapter_java.jar) compilation :
146
+
147
+ if defined? JRUBY_VERSION
148
+ jar_file = 'lib/arjdbc/jdbc/adapter_java.jar'; CLEAN << jar_file
149
+ desc "Compile the native (Java) extension."
150
+ task :jar => jar_file
151
+
152
+ namespace :jar do
153
+ task :force do
154
+ rm jar_file if File.exist?(jar_file)
155
+ Rake::Task['jar'].invoke
156
+ end
157
+ end
158
+
159
+ #directory classes = 'pkg/classes'; CLEAN << classes
160
+
161
+ file jar_file => FileList[ 'src/java/**/*.java' ] do
162
+ source = target = '1.7'; debug = true
163
+
164
+ get_driver_jars_local = lambda do |*args|
165
+ driver_deps = args.empty? ? [ :Postgres, :MySQL ] : args
166
+ driver_jars = []
167
+ driver_deps.each do |name|
168
+ driver_jars << Dir.glob("jdbc-#{name.to_s.downcase}/lib/*.jar").sort.last
169
+ end
170
+ if driver_jars.empty? # likely on a `gem install ...'
171
+ # NOTE: we're currently assuming jdbc-xxx (compile) dependencies are
172
+ # installed, they are declared as gemspec.development_dependencies !
173
+ # ... the other option is to simply `mvn prepare-package'
174
+ driver_deps.each do |name|
175
+ #require "jdbc/#{name.to_s.downcase}"
176
+ #driver_jars << Jdbc.const_get(name).driver_jar
177
+ # thanks Bundler for mocking RubyGems completely :
178
+ #spec = Gem::Specification.find_by_name("jdbc-#{name.to_s.downcase}")
179
+ #driver_jars << Dir.glob(File.join(spec.gem_dir, 'lib/*.jar')).sort.last
180
+ gem_name = "jdbc-#{name.to_s.downcase}"; matched_gem_paths = []
181
+ Gem.paths.path.each do |path|
182
+ base_path = File.join(path, "gems/")
183
+ Dir.glob(File.join(base_path, "*")).each do |gem_path|
184
+ if gem_path.sub(base_path, '').start_with?(gem_name)
185
+ matched_gem_paths << gem_path
186
+ end
187
+ end
188
+ end
189
+ if gem_path = matched_gem_paths.sort.last
190
+ driver_jars << Dir.glob(File.join(gem_path, 'lib/*.jar')).sort.last
191
+ end
192
+ end
193
+ end
194
+ driver_jars
195
+ end
196
+
197
+ get_driver_jars_maven = lambda do
198
+ require 'jar_dependencies'
199
+
200
+ requirements = gemspec.call.requirements
201
+ match_driver_jars = lambda do
202
+ matched_jars = []
203
+ gemspec.call.requirements.each do |requirement|
204
+ if match = requirement.match(/^jar\s+([\w\-\.]+):([\w\-]+),\s+?([\w\.\-]+)?/)
205
+ matched_jar = Jars.send :to_jar, match[1], match[2], match[3], nil
206
+ matched_jar = File.join( Jars.home, matched_jar )
207
+ matched_jars << matched_jar if File.exists?( matched_jar )
208
+ end
209
+ end
210
+ matched_jars
211
+ end
212
+
213
+ driver_jars = match_driver_jars.call
214
+ if driver_jars.size < requirements.size
215
+ if (ENV['JARS_SKIP'] || ENV_JAVA['jars.skip']) == 'true'
216
+ warn "jar resolving skipped, extension might not compile"
217
+ else
218
+ require 'jars/installer'
219
+ ENV['JARS_QUIET'] = 'true'
220
+ puts "resolving jar dependencies to build extension (should only happen once) ..."
221
+ installer = Jars::Installer.new( gemspec_path )
222
+ installer.install_jars( false )
223
+
224
+ driver_jars = match_driver_jars.call
225
+ end
226
+ end
227
+
228
+ driver_jars
229
+ end
230
+
231
+ # TODO not good but since jar-dependencies doesn't do the job, let's default to local (for now)
232
+ if ENV['BUILD_EXT_MAVEN'] == 'true' # || ENV['RUBYARCHDIR']
233
+ driver_jars = get_driver_jars_maven.call
234
+ else
235
+ driver_jars = get_driver_jars_local.call
236
+ end
237
+
238
+ classpath = []
239
+ [ 'java.class.path', 'sun.boot.class.path' ].map { |key| ENV_JAVA[key] }.each do |v|
240
+ classpath += v.split(File::PATH_SEPARATOR).find_all { |jar| jar =~ /jruby/i } if v
241
+ end
242
+ # Using Java 9+. Let's try and infer jruby.jar location from rbconfig
243
+ if classpath.empty?; require 'rbconfig'
244
+ libdir = RbConfig::CONFIG['libdir']
245
+ if libdir.start_with? 'classpath:'
246
+ error "Cannot build activerecord-jdbc with jruby-complete"
247
+ end
248
+ classpath << File.join(libdir, 'jruby.jar')
249
+ end
250
+
251
+ classpath += driver_jars
252
+ classpath = classpath.compact.join(File::PATH_SEPARATOR)
253
+
254
+ source_files = FileList[ 'src/java/**/*.java' ]
255
+
256
+ version = lambda do
257
+ begin
258
+ require 'arjdbc/version'
259
+ rescue LoadError
260
+ path = File.expand_path('../lib', File.dirname(__FILE__))
261
+ unless $LOAD_PATH.include?(path)
262
+ $LOAD_PATH << path; retry
263
+ end
264
+ end
265
+
266
+ gem_version = Gem::Version.create(ArJdbc::VERSION)
267
+ if gem_version.segments.last == 'DEV'
268
+ gem_version.segments[0...-1] # 50.0.DEV -> 50.0
269
+ else
270
+ gem_version.segments.dup
271
+ end
272
+ end
273
+
274
+ require 'tmpdir'; Dir.mktmpdir do |classes_dir|
275
+ # Cross-platform way of finding an executable in the $PATH. Thanks to @mislav
276
+ which = lambda do |cmd|
277
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
278
+ ENV['PATH'].split(File::PATH_SEPARATOR).map do |path|
279
+ exts.map { |ext| File.join(path, "#{cmd}#{ext}") }
280
+ end.flatten.select{|f| File.executable? f}.first
281
+ end
282
+
283
+ args = [ '-Xlint:unchecked' ]
284
+
285
+ unless javac = which.call('javac')
286
+ warn "could not find javac, please make sure it's on the PATH"
287
+ end
288
+ javac = "#{javac} -target #{target} -source #{source} #{args.join(' ')}"
289
+ javac << " #{debug ? '-g' : ''}"
290
+ javac << " -cp \"#{classpath}\" -d #{classes_dir} #{source_files.join(' ')}"
291
+ sh(javac) do |ok|
292
+ raise 'could not build .jar extension - compilation failure' unless ok
293
+ end
294
+
295
+ # class_files = FileList["#{classes_dir}/**/*.class"].gsub("#{classes_dir}/", '')
296
+ # avoid environment variable expansion using backslash
297
+ # class_files.gsub!('$', '\$') unless windows?
298
+ # args = class_files.map { |path| [ "-C #{classes_dir}", path ] }.flatten
299
+
300
+ if ENV['RELEASE'] == 'true'; require 'tempfile'
301
+ manifest = "Built-Time: #{Time.now.utc.strftime('%Y-%m-%d %H:%M:%S')}\n"
302
+ manifest += "Built-JRuby: #{JRUBY_VERSION}\n"
303
+ manifest += "Specification-Title: ActiveRecord-JDBC\n"
304
+ manifest += "Specification-Vendor: JRuby\n"
305
+ manifest += "Specification-Version: #{version.call[0].to_s.split('').join('.')}\n" # AR VERSION (52 -> 5.2)
306
+ manifest += "Implementation-Vendor: The JRuby Team\n"
307
+ manifest += "Implementation-Version: #{version.call.join('.')}\n"
308
+ manifest = Tempfile.new('MANIFEST').tap { |f| f << manifest; f.close }.path
309
+ end
310
+
311
+ args = []; opts = '-cf'
312
+ if manifest
313
+ opts = "#{opts}m"
314
+ args = [ "#{manifest}" ]
315
+ end
316
+ args += [ '-C', "#{classes_dir}/ ." ]
317
+
318
+ jar_path = jar_file
319
+ if ext_lib_dir = ENV['RUBYLIBDIR']
320
+ jar_path = File.join(ext_lib_dir, File.basename(jar_file))
321
+ end
322
+
323
+ unless jar = which.call('jar')
324
+ warn "could not find jar tool, please make sure it's on the PATH"
325
+ end
326
+ sh("#{jar} #{opts} #{jar_path} #{args.join(' ')}") do |ok|
327
+ raise 'could not build .jar extension - packaging failure' unless ok
328
+ end
329
+ cp jar_path, jar_file if ext_lib_dir # NOTE: hopefully RG won't mind?!
330
+ end
331
+ end
332
+ else
333
+ task :jar do
334
+ warn "please run `rake jar' under JRuby to re-compile the native (Java) extension"
335
+ end
336
+ end