sqlanywhere 0.1.3-i386-mswin32 → 0.1.4-i386-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +29 -25
- data/LICENSE +23 -23
- data/README +134 -130
- data/Rakefile +199 -196
- data/ext/Makefile +3 -3
- data/ext/extconf.rb +30 -30
- data/ext/sacapi.h +678 -678
- data/ext/sacapidll.c +167 -167
- data/ext/sacapidll.h +253 -253
- data/ext/sacapidll.obj +0 -0
- data/ext/sqlanywhere-i386-mswin32.exp +0 -0
- data/ext/sqlanywhere-i386-mswin32.lib +0 -0
- data/ext/sqlanywhere-i386-mswin32.pdb +0 -0
- data/ext/sqlanywhere.c +1686 -1686
- data/ext/sqlanywhere.obj +0 -0
- data/ext/sqlanywhere.so +0 -0
- data/ext/vc60.pdb +0 -0
- data/lib/sqlanywhere.so +0 -0
- data/test/sqlanywhere_test.rb +413 -413
- data/test/test.sql +87 -87
- metadata +4 -4
data/CHANGELOG
CHANGED
@@ -1,25 +1,29 @@
|
|
1
|
-
=CHANGE LOG
|
2
|
-
|
3
|
-
=====0.1.
|
4
|
-
-
|
5
|
-
-
|
6
|
-
|
7
|
-
=====0.1.
|
8
|
-
-
|
9
|
-
- Added
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
-
|
14
|
-
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
-
|
19
|
-
-
|
20
|
-
|
21
|
-
|
22
|
-
-
|
23
|
-
-
|
24
|
-
|
25
|
-
|
1
|
+
=CHANGE LOG
|
2
|
+
|
3
|
+
=====0.1.4 -- 2009/03/25
|
4
|
+
- Changed Rakefile to automatically create lib directory
|
5
|
+
- Fixed bug that tried to build native extensions on binary distsributions
|
6
|
+
|
7
|
+
=====0.1.3 -- 2008/12/31
|
8
|
+
- Removed 'hint file' in lib directory
|
9
|
+
- Added extensions to gemspec to force a local compile
|
10
|
+
|
11
|
+
=====0.1.2 -- 2008/12/18
|
12
|
+
- Fixed bug when trying to read input value from OUTPUT parameter
|
13
|
+
- Added error checking to C2RB
|
14
|
+
- Fixed Rake to handle .bundle on OSX
|
15
|
+
|
16
|
+
=====0.1.1 -- 2008/11/06
|
17
|
+
- Created a source gem rake task
|
18
|
+
- Created a 'hint' file if the source gem is used directly
|
19
|
+
- Changed file permissions on archives
|
20
|
+
- Changed archives to be specific to platform (.zip on windows, .tar.gz
|
21
|
+
otherwise)
|
22
|
+
- Changed default rake task to only build library, not gem
|
23
|
+
- Added a gem rake task
|
24
|
+
|
25
|
+
=====0.1.0 -- 2008/10/15
|
26
|
+
- Initial Release
|
27
|
+
- Wraps DBCAPI functionality
|
28
|
+
- Includes a simple unit test suite
|
29
|
+
|
data/LICENSE
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
/*====================================================
|
2
|
-
*
|
3
|
-
* Copyright 2008-2009 iAnywhere Solutions, Inc.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
*
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
*
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
*
|
16
|
-
* See the License for the specific language governing permissions and
|
17
|
-
* limitations under the License.
|
18
|
-
*
|
19
|
-
* While not a requirement of the license, if you do modify this file, we
|
20
|
-
* would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
|
21
|
-
*
|
22
|
-
*
|
23
|
-
*====================================================*/
|
1
|
+
/*====================================================
|
2
|
+
*
|
3
|
+
* Copyright 2008-2009 iAnywhere Solutions, Inc.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
*
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
*
|
19
|
+
* While not a requirement of the license, if you do modify this file, we
|
20
|
+
* would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
|
21
|
+
*
|
22
|
+
*
|
23
|
+
*====================================================*/
|
data/README
CHANGED
@@ -1,130 +1,134 @@
|
|
1
|
-
=SQL Anywhere Ruby Driver
|
2
|
-
|
3
|
-
This is a native SQL Anywhere driver for Ruby. This library wraps the
|
4
|
-
functionality provided by the SQL Anywhere DBCAPI library. This driver
|
5
|
-
is intended to be a base-level library to be used by interface libraries
|
6
|
-
such as Ruby-DBI and ActiveRecord.
|
7
|
-
|
8
|
-
This driver can be used with SQL Anywhere 11 and SQL Anywhere 10.
|
9
|
-
|
10
|
-
This driver is licensed under the Apache License, Version 2.
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
To build
|
27
|
-
|
28
|
-
rake
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
rake
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
1
|
+
=SQL Anywhere Ruby Driver
|
2
|
+
|
3
|
+
This is a native SQL Anywhere driver for Ruby. This library wraps the
|
4
|
+
functionality provided by the SQL Anywhere DBCAPI library. This driver
|
5
|
+
is intended to be a base-level library to be used by interface libraries
|
6
|
+
such as Ruby-DBI and ActiveRecord.
|
7
|
+
|
8
|
+
This driver can be used with SQL Anywhere 11 and SQL Anywhere 10.
|
9
|
+
|
10
|
+
This driver is licensed under the Apache License, Version 2.
|
11
|
+
|
12
|
+
The official code repository is located on GitHub. The repository can be cloned with:
|
13
|
+
|
14
|
+
git clone git://github.com/sqlanywhere/sqlanywhere.git
|
15
|
+
|
16
|
+
==Build Instructions
|
17
|
+
|
18
|
+
===Requirements
|
19
|
+
* C Compiler
|
20
|
+
* Ruby
|
21
|
+
* RubyGem Package manager
|
22
|
+
|
23
|
+
|
24
|
+
===All Platforms
|
25
|
+
|
26
|
+
To build the library (.so), use:
|
27
|
+
|
28
|
+
rake
|
29
|
+
|
30
|
+
To build and install the gem, use:
|
31
|
+
|
32
|
+
rake gem
|
33
|
+
rake install
|
34
|
+
|
35
|
+
The other rake tasks are
|
36
|
+
|
37
|
+
rake clean -> Cleans up all temp files (ex *.~)
|
38
|
+
rake clobber -> Cleans up all built files (ex *.gem, *.o, *.so)
|
39
|
+
|
40
|
+
===Additional Install Notes for Windows
|
41
|
+
|
42
|
+
The popular One-Click Ruby Installer for Windows (RubyInstaller) is built using
|
43
|
+
Microsoft Visual C++ 6.0. Since problems can arise by combining binaries from
|
44
|
+
different compilers, we advise you use this compiler.
|
45
|
+
|
46
|
+
If you want to use a more recent version of the MS C++ compiler, you will need to make a few changes:
|
47
|
+
|
48
|
+
1. Open the file: <RUBY DIR>\lib\ruby\1.8\i386-mswin32\config.h, and comment out the first three lines so they look like:
|
49
|
+
|
50
|
+
//#if _MSC_VER != 1200
|
51
|
+
//#error MSC version unmatch
|
52
|
+
//#endif
|
53
|
+
|
54
|
+
This removes the check for C++ Version 6.0
|
55
|
+
|
56
|
+
2. Open <tt>rakefile</tt> and set:
|
57
|
+
|
58
|
+
APPLY_MANIFEST = true
|
59
|
+
|
60
|
+
This will add the manifest to the compiled binaries.
|
61
|
+
|
62
|
+
By default, rake will attempt to use Microsoft <tt>nmake</tt> when building under Windows. To use another make program, set:
|
63
|
+
|
64
|
+
USE_NMAKE_ON_WIN = FALSE
|
65
|
+
|
66
|
+
==Running Unit Tests
|
67
|
+
|
68
|
+
1. Change to the the <tt>test</tt> directory
|
69
|
+
|
70
|
+
cd test
|
71
|
+
|
72
|
+
2. Create a testing database:
|
73
|
+
|
74
|
+
dbinit test
|
75
|
+
|
76
|
+
3. Start the testing database:
|
77
|
+
|
78
|
+
dbeng11 test.db
|
79
|
+
|
80
|
+
4. Create the test schema:
|
81
|
+
|
82
|
+
dbisql -c "eng=test;uid=dba;pwd=sql" test.sql
|
83
|
+
|
84
|
+
5. Run the unit tests:
|
85
|
+
|
86
|
+
ruby sqlanywhere_test.rb
|
87
|
+
|
88
|
+
<b>If the tests fail to run, make sure you have set up the SQL Anywhere environment variables correctly.</b> For more information
|
89
|
+
review the online documentation here[http://dcx.sybase.com/index.php#http%3A%2F%2Fdcx.sybase.com%2F1100en%2Fdbadmin_en11%2Fda-envvar-sect1-3672410.html].
|
90
|
+
|
91
|
+
==Sample
|
92
|
+
|
93
|
+
This script makes a connection, prints <tt>Successful Ruby Connection</tt> to the SQL
|
94
|
+
Anywhere console, then disconnects.
|
95
|
+
|
96
|
+
# load the SQLAnywhere gem
|
97
|
+
begin
|
98
|
+
require 'rubygems'
|
99
|
+
gem 'sqlanywhere'
|
100
|
+
unless defined? SQLAnywhere
|
101
|
+
require 'sqlanywhere'
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# create an interface
|
106
|
+
api = SQLAnywhere::SQLAnywhereInterface.new()
|
107
|
+
|
108
|
+
# initialize the interface (loads the DLL/SO)
|
109
|
+
SQLAnywhere::API.sqlany_initialize_interface( api )
|
110
|
+
|
111
|
+
# initialize our api object
|
112
|
+
api.sqlany_init()
|
113
|
+
|
114
|
+
# create a connection
|
115
|
+
conn = api.sqlany_new_connection()
|
116
|
+
|
117
|
+
# establish a connection
|
118
|
+
api.sqlany_connect(conn, "uid=dba;pwd=sql")
|
119
|
+
|
120
|
+
# execute a query without a result set
|
121
|
+
api.sqlany_execute_immediate(conn, "MESSAGE 'Successful Ruby Connection'")
|
122
|
+
|
123
|
+
# disconnect from the database
|
124
|
+
api.sqlany_disconnect(conn)
|
125
|
+
|
126
|
+
# free the connection resources
|
127
|
+
api.sqlany_free_connection(conn)
|
128
|
+
|
129
|
+
# free resources the api object uses
|
130
|
+
api.sqlany_fini()
|
131
|
+
|
132
|
+
# close the interface
|
133
|
+
SQLAnywhere::API.sqlany_finalize_interface( api )
|
134
|
+
|
data/Rakefile
CHANGED
@@ -1,196 +1,199 @@
|
|
1
|
-
#====================================================
|
2
|
-
#
|
3
|
-
# Copyright 2008-2009 iAnywhere Solutions, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
#
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
# While not a requirement of the license, if you do modify this file, we
|
20
|
-
# would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#====================================================
|
24
|
-
|
25
|
-
require 'ftools'
|
26
|
-
require 'rbconfig'
|
27
|
-
require 'rake/clean'
|
28
|
-
require 'rake/rdoctask'
|
29
|
-
require 'rubygems'
|
30
|
-
require 'rubygems/builder'
|
31
|
-
|
32
|
-
# By default, windows will try to use nmake instead of make. If you are on windows but using
|
33
|
-
# a different compiler that uses standard make, set this to false.
|
34
|
-
USE_NMAKE_ON_WIN = true
|
35
|
-
|
36
|
-
# By default on windows, ruby expects to be compiled by Visual Studio C++ 6.0. If you are using
|
37
|
-
# a newer version of Visual Studio, you will need to apply a manifest to the dll. To apply the
|
38
|
-
# manifest set this to true.
|
39
|
-
APPLY_MANIFEST = false
|
40
|
-
|
41
|
-
PACKAGE_NAME = "sqlanywhere"
|
42
|
-
ARCH=Config::CONFIG['arch']
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
spec.
|
65
|
-
spec.
|
66
|
-
spec.
|
67
|
-
|
68
|
-
EOF
|
69
|
-
|
70
|
-
|
71
|
-
spec.
|
72
|
-
spec.
|
73
|
-
spec.
|
74
|
-
spec.
|
75
|
-
spec.
|
76
|
-
spec.
|
77
|
-
spec.
|
78
|
-
spec.
|
79
|
-
spec.
|
80
|
-
|
81
|
-
'--
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
"test/
|
96
|
-
"
|
97
|
-
"
|
98
|
-
"
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
Gem::
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
"
|
115
|
-
"
|
116
|
-
"
|
117
|
-
|
118
|
-
|
119
|
-
#
|
120
|
-
spec.
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
puts "
|
152
|
-
FileUtils.
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
system "
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.
|
166
|
-
system "
|
167
|
-
|
168
|
-
puts "
|
169
|
-
system "
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
puts "
|
176
|
-
|
177
|
-
|
178
|
-
puts "
|
179
|
-
|
180
|
-
|
181
|
-
puts "
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
1
|
+
#====================================================
|
2
|
+
#
|
3
|
+
# Copyright 2008-2009 iAnywhere Solutions, Inc.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
#
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
# While not a requirement of the license, if you do modify this file, we
|
20
|
+
# would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
|
21
|
+
#
|
22
|
+
#
|
23
|
+
#====================================================
|
24
|
+
|
25
|
+
require 'ftools'
|
26
|
+
require 'rbconfig'
|
27
|
+
require 'rake/clean'
|
28
|
+
require 'rake/rdoctask'
|
29
|
+
require 'rubygems'
|
30
|
+
require 'rubygems/builder'
|
31
|
+
|
32
|
+
# By default, windows will try to use nmake instead of make. If you are on windows but using
|
33
|
+
# a different compiler that uses standard make, set this to false.
|
34
|
+
USE_NMAKE_ON_WIN = true
|
35
|
+
|
36
|
+
# By default on windows, ruby expects to be compiled by Visual Studio C++ 6.0. If you are using
|
37
|
+
# a newer version of Visual Studio, you will need to apply a manifest to the dll. To apply the
|
38
|
+
# manifest set this to true.
|
39
|
+
APPLY_MANIFEST = false
|
40
|
+
|
41
|
+
PACKAGE_NAME = "sqlanywhere"
|
42
|
+
ARCH=Config::CONFIG['arch']
|
43
|
+
|
44
|
+
Dir.mkdir('lib') unless File.directory?('lib')
|
45
|
+
|
46
|
+
pkg_version = ""
|
47
|
+
|
48
|
+
library_file = ARCH =~ /darwin/ ? "sqlanywhere.bundle" : "sqlanywhere.so"
|
49
|
+
|
50
|
+
# The package version of determined by parsing the c source file. This ensures the version is
|
51
|
+
# only ever specified ins a single place.
|
52
|
+
File.open(File.join("ext", "sqlanywhere.c") ) do |f|
|
53
|
+
f.grep( /const char\* VERSION/ ) do |line|
|
54
|
+
pkg_version = /\s*const char\* VERSION\s*=\s*["|']([^"']*)["|'];\s*/.match(line)[1]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# If we can't determine the version, throw up your hands and exit
|
59
|
+
raise RuntimeError, "Could not determine current package version!" if pkg_version.empty?
|
60
|
+
|
61
|
+
MAKE = (ARCH =~ /win32/ and USE_NMAKE_ON_WIN) ? 'nmake' : 'make'
|
62
|
+
|
63
|
+
spec = Gem::Specification.new do |spec|
|
64
|
+
spec.authors = ["Eric Farrar"]
|
65
|
+
spec.email = 'eric.farrar@ianywhere.com'
|
66
|
+
spec.name = 'sqlanywhere'
|
67
|
+
spec.summary = 'SQL Anywhere library for Ruby'
|
68
|
+
spec.description = <<-EOF
|
69
|
+
SQL Anywhere Driver for Ruby
|
70
|
+
EOF
|
71
|
+
spec.version = pkg_version
|
72
|
+
spec.autorequire = 'sqlanywhere'
|
73
|
+
spec.has_rdoc = true
|
74
|
+
spec.rubyforge_project = 'sqlanywhere'
|
75
|
+
spec.homepage = 'http://sqlanywhere.rubyforge.org'
|
76
|
+
spec.platform = Gem::Platform::CURRENT
|
77
|
+
spec.required_ruby_version = '>= 1.8.6'
|
78
|
+
spec.require_paths = ['lib']
|
79
|
+
spec.test_file = 'test/sqlanywhere_test.rb'
|
80
|
+
spec.rdoc_options << '--title' << 'SQL Anywhere Ruby Driver' <<
|
81
|
+
'--main' << 'README' <<
|
82
|
+
'--line-numbers'
|
83
|
+
spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE', 'ext/sqlanywhere.c']
|
84
|
+
end
|
85
|
+
|
86
|
+
# The default task is to build the library (.dll or .so)
|
87
|
+
desc "Build the library"
|
88
|
+
task :default => [File.join("lib", library_file)]
|
89
|
+
|
90
|
+
# Builds the binary gem for this platform
|
91
|
+
desc "Build the gem"
|
92
|
+
task :gem => ["sqlanywhere-#{pkg_version}-#{spec.platform}.gem"]
|
93
|
+
|
94
|
+
file "sqlanywhere-#{pkg_version}-#{spec.platform}.gem" => ["Rakefile",
|
95
|
+
"test/test.sql",
|
96
|
+
"test/sqlanywhere_test.rb",
|
97
|
+
"README",
|
98
|
+
"CHANGELOG",
|
99
|
+
"LICENSE",
|
100
|
+
File.join("lib", library_file)] do
|
101
|
+
# Get the updated list of files to include in the gem
|
102
|
+
spec.files = Dir['ext/**/*'] + Dir['lib/**/*'] + Dir['test/**/*'] + Dir['CHANGELOG'] + Dir['LICENSE'] + Dir['README'] + Dir['Rakefile']
|
103
|
+
# Set the gem to be platform specific since it includes compiled binaries
|
104
|
+
spec.platform = Gem::Platform::CURRENT
|
105
|
+
spec.extensions = ''
|
106
|
+
Gem::Builder.new(spec).build
|
107
|
+
end
|
108
|
+
|
109
|
+
# Builds the source gem for any platform
|
110
|
+
desc "Build the source gem"
|
111
|
+
task :source_gem => ["sqlanywhere-#{pkg_version}.gem"]
|
112
|
+
|
113
|
+
file "sqlanywhere-#{pkg_version}.gem" => ["Rakefile",
|
114
|
+
"test/test.sql",
|
115
|
+
"test/sqlanywhere_test.rb",
|
116
|
+
"README",
|
117
|
+
"CHANGELOG",
|
118
|
+
"LICENSE"] do
|
119
|
+
# Get the updated list of files to include in the gem
|
120
|
+
spec.files = Dir['ext/**/*'] + Dir['lib/**/*'] + Dir['test/**/*'] + Dir['CHANGELOG'] + Dir['LICENSE'] + Dir['README'] + Dir['Rakefile']
|
121
|
+
# Since this contains no compilked binaries, set it to be platform RUBY
|
122
|
+
spec.platform = Gem::Platform::RUBY
|
123
|
+
spec.extensions = 'ext/extconf.rb'
|
124
|
+
Gem::Builder.new(spec).build
|
125
|
+
end
|
126
|
+
|
127
|
+
file File.join("lib", library_file) => [File.join("ext", library_file)] do
|
128
|
+
File.copy(File.join("ext", library_file), "lib")
|
129
|
+
end
|
130
|
+
|
131
|
+
file File.join("ext", library_file) => ["ext/sqlanywhere.c"] do
|
132
|
+
sh "cd ext && ruby extconf.rb"
|
133
|
+
sh "cd ext && #{MAKE}"
|
134
|
+
sh "cd ext && mt -outputresource:sqlanywhere.so;2 -manifest sqlanywhere.so.manifest" if APPLY_MANIFEST
|
135
|
+
end
|
136
|
+
|
137
|
+
desc "Install the gem"
|
138
|
+
task :install => [:gem] do
|
139
|
+
sh "gem install sqlanywhere-#{pkg_version}-#{spec.platform}.gem"
|
140
|
+
end
|
141
|
+
|
142
|
+
# This builds the distributables. On windows it builds a platform specific gem, a source gem, and a souce zip archive.
|
143
|
+
# On other platforms this builds a platform specific gem, a source gem, and a source tar.gz archive.
|
144
|
+
desc "Build distributables (src zip, src tar.gz, gem)"
|
145
|
+
task :dist do |t|
|
146
|
+
puts "Cleaning Build Environment..."
|
147
|
+
Rake.application['clobber'].invoke
|
148
|
+
|
149
|
+
files = Dir.glob('*')
|
150
|
+
|
151
|
+
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version} directory..."
|
152
|
+
FileUtils.mkdir_p "#{File.join('build', PACKAGE_NAME)}-#{pkg_version}"
|
153
|
+
|
154
|
+
puts "Copying files to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}..."
|
155
|
+
FileUtils.cp_r files, "#{File.join('build', PACKAGE_NAME)}-#{pkg_version}"
|
156
|
+
|
157
|
+
if( ARCH =~ /win32/ ) then
|
158
|
+
system "attrib -R #{File.join('build', PACKAGE_NAME)}-#{pkg_version} /S"
|
159
|
+
else
|
160
|
+
system "find #{File.join('build', PACKAGE_NAME)}-#{pkg_version} -type d -exec chmod 755 {} \\;"
|
161
|
+
system "find #{File.join('build', PACKAGE_NAME)}-#{pkg_version} -type f -exec chmod 644 {} \\;"
|
162
|
+
end
|
163
|
+
|
164
|
+
if( ARCH =~ /win32/ ) then
|
165
|
+
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.zip..."
|
166
|
+
system "cd build && zip -q -r #{PACKAGE_NAME}-#{pkg_version}.zip #{PACKAGE_NAME}-#{pkg_version}"
|
167
|
+
else
|
168
|
+
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar..."
|
169
|
+
system "tar cf #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar -C build #{PACKAGE_NAME}-#{pkg_version}"
|
170
|
+
|
171
|
+
puts "GZipping to create #{File.join('build', PACKAGE_NAME, PACKAGE_NAME)}-#{pkg_version}.tar.gz..."
|
172
|
+
system "gzip #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar"
|
173
|
+
end
|
174
|
+
|
175
|
+
puts "Building GEM source distributable..."
|
176
|
+
Rake.application['source_gem'].invoke
|
177
|
+
|
178
|
+
puts "Copying source GEM to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.gem..."
|
179
|
+
FileUtils.cp "#{PACKAGE_NAME}-#{pkg_version}.gem", "build"
|
180
|
+
|
181
|
+
puts "Building GEM binary distributable..."
|
182
|
+
Rake.application['gem'].invoke
|
183
|
+
|
184
|
+
puts "Copying binary GEM to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}-#{spec.platform}.gem..."
|
185
|
+
FileUtils.cp "#{PACKAGE_NAME}-#{pkg_version}-#{spec.platform}.gem", "build"
|
186
|
+
end
|
187
|
+
|
188
|
+
Rake::RDocTask.new do |rd|
|
189
|
+
rd.title = "SQL Anywhere Ruby Driver"
|
190
|
+
rd.main = "README"
|
191
|
+
rd.rdoc_files.include('README', 'CHANGELOG', 'LICENSE', 'ext/sqlanywhere.c')
|
192
|
+
end
|
193
|
+
|
194
|
+
desc "Publish the RDOCs on RubyForge"
|
195
|
+
task :publish_rdoc => ["html/index.html"] do
|
196
|
+
system "pscp -r html/* efarrar@rubyforge.org:/var/www/gforge-projects/sqlanywhere/sqlanywhere"
|
197
|
+
end
|
198
|
+
|
199
|
+
CLOBBER.include("sqlanywhere-#{pkg_version}-#{spec.platform}.gem", "sqlanywhere-#{pkg_version}.gem", "lib/*", "ext/*.obj", "ext/*.def", "ext/*.so", "ext/*.bundle", "ext/*.log", "ext/*.exp", "ext/*.lib", "ext/*.pdb", "ext/Makefile", "ext/*.so.manifest", "ext/*.o", "build/**/*", "build")
|