proj4rb 1.0.0 → 2.0.0
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.
- checksums.yaml +5 -5
- data/ChangeLog +46 -0
- data/Gemfile +4 -0
- data/README.rdoc +158 -148
- data/Rakefile +26 -41
- data/lib/area.rb +32 -0
- data/lib/config.rb +70 -0
- data/lib/context.rb +103 -0
- data/lib/coordinate.rb +197 -0
- data/lib/crs.rb +206 -0
- data/lib/ellipsoid.rb +42 -0
- data/lib/error.rb +18 -0
- data/lib/operation.rb +43 -0
- data/lib/pj_object.rb +82 -0
- data/lib/point.rb +72 -0
- data/lib/prime_meridian.rb +40 -0
- data/lib/proj.rb +31 -0
- data/lib/proj4.rb +3 -469
- data/lib/projection.rb +207 -0
- data/lib/transformation.rb +61 -0
- data/lib/unit.rb +54 -0
- data/proj4rb.gemspec +31 -0
- data/test/abstract_test.rb +7 -0
- data/test/context_test.rb +82 -0
- data/test/coordinate_test.rb +35 -0
- data/test/crs_test.rb +373 -0
- data/test/ellipsoid_test.rb +34 -0
- data/test/operation_test.rb +29 -0
- data/test/prime_meridians_test.rb +33 -0
- data/test/proj_test.rb +17 -0
- data/test/projection_test.rb +224 -0
- data/test/transformation_test.rb +68 -0
- data/test/unit_test.rb +47 -0
- metadata +82 -77
- data/data/GL27 +0 -22
- data/data/MD +0 -0
- data/data/TN +0 -0
- data/data/WI +0 -0
- data/data/WO +0 -0
- data/data/conus +0 -0
- data/data/epsg +0 -5443
- data/data/epsg-deprecated +0 -2
- data/data/esri +0 -5937
- data/data/esri.extra +0 -948
- data/data/hawaii +0 -0
- data/data/nad.lst +0 -142
- data/data/nad27 +0 -809
- data/data/nad83 +0 -744
- data/data/ntv1_can.dat +0 -0
- data/data/null +0 -0
- data/data/other.extra +0 -49
- data/data/proj_def.dat +0 -17
- data/data/prvi +0 -0
- data/data/stgeorge +0 -0
- data/data/stlrnc +0 -0
- data/data/stpaul +0 -0
- data/data/world +0 -212
- data/example/basic.rb +0 -18
- data/example/list-datums.rb +0 -17
- data/example/list-ellipsoids.rb +0 -17
- data/example/list-errors.rb +0 -11
- data/example/list-prime-meridians.rb +0 -17
- data/example/list-projection-types.rb +0 -17
- data/example/list-units.rb +0 -17
- data/example/version.rb +0 -8
- data/ext/Makefile +0 -238
- data/ext/extconf.rb +0 -16
- data/ext/mkmf.log +0 -103
- data/ext/out.log +0 -0
- data/ext/proj4_ruby-x64-mingw32.def +0 -2
- data/ext/proj4_ruby.so +0 -0
- data/ext/projrb.c +0 -566
- data/ext/projrb.o +0 -0
- data/ext/vc/proj4_ruby.sln +0 -19
- data/ext/vc/proj4_ruby.vcproj +0 -208
- data/test/test_constants.rb +0 -18
- data/test/test_create_projection.rb +0 -63
- data/test/test_datums.rb +0 -45
- data/test/test_ellipsoids.rb +0 -46
- data/test/test_errors.rb +0 -66
- data/test/test_init_projection.rb +0 -109
- data/test/test_prime_meridians.rb +0 -45
- data/test/test_projection_type.rb +0 -44
- data/test/test_simple_projection.rb +0 -58
- data/test/test_suite.rb +0 -14
- data/test/test_transform.rb +0 -115
- data/test/test_units.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bdd77e892a3126bb4c0b4c984356e9ba6a32e73811813c2d5dcc5a2eb36a02ae
|
4
|
+
data.tar.gz: 0217052b386be354cd4b48c5bc0536c179336c5c73026a3cb544e9630ad66810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d0e577ede5260d24da9b474e10c52700f9179fe9a42e61728fba85f051be1b152af847c6c45c8df9ef9ad9f5b5ea71ca82ecbef977056b2361dfb2de3be7dac
|
7
|
+
data.tar.gz: 050366cf1ce478ee809a4d82af9a9ed0a9e54e3fd28d4fd58d4fac4b22c0ddbb431969a61581c8a5e3990525e567f2fb7f03b1f9a010b734867c67c9795f7369
|
data/ChangeLog
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
2.0.0 (December 30, 2019)
|
2
|
+
=========================
|
3
|
+
- Full rewrite to support API changes in Proj versions 5 and 6
|
4
|
+
- As part of rewrite switch bindings to use FFI versus a C extension
|
5
|
+
- Split Ruby code into multiple files based on classes
|
6
|
+
- Add in a bunch of new classes including Context, Crs, Coordinate, Ellipsoid, Prime Meridian and Transform
|
7
|
+
- Deprecate Projection and Point - these will stop working with Proj 7 since the use an older deprecated API
|
8
|
+
|
9
|
+
- Calling this 1.0.0 since its a very stable gem
|
10
|
+
|
11
|
+
1.0.0 (December 14, 2014)
|
12
|
+
=========================
|
13
|
+
- Calling this 1.0.0 since its a very stable gem
|
14
|
+
|
15
|
+
0.4.3 (August 30, 2011)
|
16
|
+
=========================
|
17
|
+
- Remove reference to now private projects.h header
|
18
|
+
|
19
|
+
0.4.2 (August 15, 2011)
|
20
|
+
=========================
|
21
|
+
- Minor build tweak to support MSVC++
|
22
|
+
|
23
|
+
0.4.1 (July 30, 2011)
|
24
|
+
=========================
|
25
|
+
- Search first for binaries when using windows gems
|
26
|
+
- Add # encoding to test files
|
27
|
+
- Reformat tests files to use standard ruby 2 space indenting
|
28
|
+
|
29
|
+
0.4.0 (July 30, 2011)
|
30
|
+
=========================
|
31
|
+
- Update to compile on Ruby 1.9.* (Fabio Renzo Panettieri)
|
32
|
+
- Add in gemspec file (Charlie Savage)
|
33
|
+
- Add rake-compiler as development dependency, remove older MinGW build system (Charlie Savage)
|
34
|
+
- Move to GitHub (Charlie Savage)
|
35
|
+
|
36
|
+
0.3.1 (December 23, 2009)
|
37
|
+
=========================
|
38
|
+
- Update extconf.conf file to be more flexible to make it easier to build
|
39
|
+
on OS X when using MacPorts
|
40
|
+
- Updated windows binary to link against proj4.7
|
41
|
+
|
42
|
+
0.3.0 (August 14, 2008)
|
43
|
+
=========================
|
44
|
+
- Removed Proj4::UV class which was previously deprecated
|
45
|
+
- New build infrastructure for Windows (Charlie Savage)
|
46
|
+
- Fixed memory leaks in forward() and inverse() methods (Charlie Savage)
|
data/Gemfile
ADDED
data/README.rdoc
CHANGED
@@ -1,160 +1,170 @@
|
|
1
1
|
=Proj4rb
|
2
|
+
This gem provides Ruby bindings for the Proj Library (https://proj.org). The Proj Library supports converting coordinates
|
3
|
+
between a number of different coordinate systems and projections.
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
number of geographic coordinate systems and datums.
|
5
|
+
== Installation
|
6
|
+
First install the gem in the usual manner:
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
gem install proj4rb
|
9
|
+
|
10
|
+
Next install the Proj Library. This of course varies per system, but you want to install the latest version Proj
|
11
|
+
possible. Once installed, you'll need to make sure that libproj is installed on your operating system's
|
12
|
+
load path.
|
13
|
+
|
14
|
+
== Usage
|
15
|
+
To get started first require the gem:
|
16
|
+
|
17
|
+
require 'proj'
|
18
|
+
|
19
|
+
If you are using the old Proj4 namespace, then you can do this:
|
11
20
|
|
12
|
-
== Operations
|
13
|
-
To load the library:
|
14
21
|
require 'proj4'
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Next, you need to create a projection:
|
20
|
-
proj = Projection.new( :proj => "utm", :zone => "21", :units => "m" )
|
21
|
-
|
22
|
-
This defines a UTM21 North projection in WGS84. Note that the <tt>proj</tt> /
|
23
|
-
<tt>proj.exe</tt> initialization arguments equivalent to the one above would
|
24
|
-
be:
|
25
|
-
+proj=utm +zone=21 +units=m
|
26
|
-
|
27
|
-
Note there are several alternative ways of specifying the arguments, see
|
28
|
-
the documentation for Proj4::Projection.new for details.
|
29
|
-
|
30
|
-
Once you've created the projection, you can tranform coordinates using either
|
31
|
-
the +forward+ or +inverse+ methods. +forward+ transforms the point in WGS84
|
32
|
-
lon/lat (in radians) to the coordinate system defined during the creation
|
33
|
-
of the Projection object. +inverse+ does the opposite. For example:
|
34
|
-
|
35
|
-
projected_point = proj.forward(lonlat_point)
|
36
|
-
lonlat_point = proj.inverse(projected_point)
|
37
|
-
|
38
|
-
There is also a +transform+ function which can transform between any two
|
39
|
-
projections including datum conversions:
|
40
|
-
|
41
|
-
point_in_projB = projA.transform(projB, point_in_projA)
|
42
|
-
|
43
|
-
The +forward+, +inverse+, and +transform+ methods all have an in-place
|
44
|
-
equivalent: <tt>forward!</tt>, <tt>inverse!</tt>, and <tt>transform!</tt>
|
45
|
-
which projects the given point in place. There are also +forwardDeg+
|
46
|
-
and +inverseDeg+ methods which work with longitudes and latitudes in
|
47
|
-
degrees rather than radians.
|
48
|
-
|
49
|
-
For the points you can use an object of the Proj4::Point class. It has
|
50
|
-
properties: +x+, +y+, and +z+, which can be set and retrieved. Aliases
|
51
|
-
+lon+ and +lat+ for +x+ and +y+, respectively, are also available.
|
52
|
-
(There used to be a UV class, but this has been removed in version 0.3.0.)
|
53
|
-
|
54
|
-
Instead of using the Proj4::Point object, you may use another class as long
|
55
|
-
as it responds to the methods +x+ and +y+ (and +z+ for 3D datum transformations
|
56
|
-
with the +transform+ method).
|
57
|
-
|
58
|
-
The methods +forward_all+, +inverse_all+, and +transform_all+ (and their
|
59
|
-
in-place versions <tt>forward_all!</tt>, <tt>inverse_all!</tt>, and
|
60
|
-
<tt>transform_all!</tt> work just like their simple counterparts, but
|
61
|
-
instead of transforming a single point they transform a collection of points
|
62
|
-
in a single call. They take an array as an argument or any object that responds
|
63
|
-
to the +each+ method (for the in-place versions) or +each+, +clear+, and
|
64
|
-
<tt><<</tt> methods (for the normal version).
|
65
|
-
|
66
|
-
The library also defines two constants to make it easy to convert between
|
67
|
-
degrees and radians:
|
68
|
-
+DEG_TO_RAD+ and +RAD_TO_DEG+
|
69
|
-
|
70
|
-
==Error handling
|
71
|
-
Projection initialization (Proj4::Projection.new) and transformation functions
|
72
|
-
(Proj4::Projection#forward/inverse/transform) all throw exceptions when
|
73
|
-
they encounter an error. This is done by mapping proj4's C error codes to
|
74
|
-
Ruby specific exception classes. See Proj4::Error for more information or
|
75
|
-
use the <tt>list-errors.rb</tt> program from the examples for a list.
|
76
|
-
|
77
|
-
==Definition lists
|
78
|
-
Proj.4 supports many different datums, ellipsoids, prime meridians,
|
79
|
-
projection types and length units. Use the Proj4::Datum, Proj4::Ellipsoid,
|
80
|
-
Proj4::PrimeMeridian, Proj4::ProjectionType, and Proj4::Unit classes
|
81
|
-
to access this information and get detailed information about each definition.
|
82
|
-
See the <i>list-*</i> files in the <i>example</i> directory for code
|
83
|
-
examples.
|
84
|
-
|
85
|
-
Note that these lists rquire version 449 or later of the Proj.4 C library.
|
86
|
-
|
87
|
-
==Installation
|
88
|
-
To install the gem simply type:
|
89
|
-
gem install proj4rb
|
23
|
+
=== Crs
|
24
|
+
If you are using Proj 6 create a coordinate system. To create a coordinate system, you can use CRS codes, well-known text (WKT) strings
|
25
|
+
or old-style Proj4 strings (which are deprecated).
|
90
26
|
|
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
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
to
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
The result is a proj4_ruby.so file which can be package into a GEM or
|
150
|
-
copied to the ruby/site-lib directory.
|
151
|
-
|
152
|
-
==License
|
153
|
-
Proj4rb is released under the MIT license.
|
27
|
+
crs1 = Proj::Crs.new('EPSG:4326')
|
28
|
+
|
29
|
+
crs2 = Proj::Crs.new('urn:ogc:def:crs:EPSG::4326')
|
30
|
+
|
31
|
+
crs3 = Proj::Crs.new('+proj=longlat +datum=WGS84 +no_defs +type=crs')
|
32
|
+
|
33
|
+
crs4 = Proj::Crs.new(<<~EOS)
|
34
|
+
GEOGCRS["WGS 84",
|
35
|
+
DATUM["World Geodetic System 1984",
|
36
|
+
ELLIPSOID["WGS 84",6378137,298.257223563,
|
37
|
+
LENGTHUNIT["metre",1]]],
|
38
|
+
PRIMEM["Greenwich",0,
|
39
|
+
ANGLEUNIT["degree",0.0174532925199433]],
|
40
|
+
CS[ellipsoidal,2],
|
41
|
+
AXIS["geodetic latitude (Lat)",north,
|
42
|
+
ORDER[1],
|
43
|
+
ANGLEUNIT["degree",0.0174532925199433]],
|
44
|
+
AXIS["geodetic longitude (Lon)",east,
|
45
|
+
ORDER[2],
|
46
|
+
ANGLEUNIT["degree",0.0174532925199433]],
|
47
|
+
USAGE[
|
48
|
+
SCOPE["unknown"],
|
49
|
+
AREA["World"],
|
50
|
+
BBOX[-90,-180,90,180]],
|
51
|
+
ID["EPSG",4326]]
|
52
|
+
EOS
|
53
|
+
|
54
|
+
Notice when using the old-style Proj4 string, the addition of the "+type=crs" value.
|
55
|
+
|
56
|
+
If you are using Proj 5, then you should create a transformation using epsg strings (see below). If you are using Proj 4,
|
57
|
+
you need to use the deprecated Projection class (see documentation).
|
58
|
+
|
59
|
+
=== Transformation
|
60
|
+
After you have created two coordinate systems, you can then create a transformation. For example, if you want to
|
61
|
+
convert coordinates from the "3-degree Gauss-Kruger zone 3" coordinate system to WGS84 (one version of lat-long)
|
62
|
+
first create a transformation:
|
63
|
+
|
64
|
+
crs_gk = Proj::Crs.new('epsg:31467')
|
65
|
+
crs_wgs84 = Proj::Crs.new('epsg:4326')
|
66
|
+
transform = Proj::Transformation.new(crs_gk, crs_wgs84)
|
67
|
+
|
68
|
+
Alternatively, or if you are using Proj 5, you can create a transformation without first
|
69
|
+
creating Crs instances. Instead, pass the EPSG information directly to the transformation:
|
70
|
+
|
71
|
+
transform = Proj::Transformation.new('epsg:31467', 'epsg:4326')
|
72
|
+
|
73
|
+
Once you've created the transformation, you can tranform coordinates using either
|
74
|
+
the +forward+ or +inverse+ methods. The forward transformation looks like this:
|
75
|
+
|
76
|
+
from = Proj::Coordinate.new(x: 5428192.0, y: 3458305.0, z: -5.1790915237)
|
77
|
+
to = transform.forward(from)
|
78
|
+
|
79
|
+
assert_in_delta(48.98963932450735, to.x, PRECISION)
|
80
|
+
assert_in_delta(8.429263044355544, to.y, PRECISION)
|
81
|
+
assert_in_delta(-5.1790915237, to.z, PRECISION)
|
82
|
+
assert_in_delta(0, to.t, PRECISION)
|
83
|
+
|
84
|
+
While the inverse transformation looks like this:
|
154
85
|
|
86
|
+
from = Proj::Coordinate.new(lam: 48.9906726079, phi: 8.4302123334)
|
87
|
+
to = transform.inverse(from)
|
88
|
+
|
89
|
+
assert_in_delta(5428306.389495558, to.x, PRECISION)
|
90
|
+
assert_in_delta(3458375.3367194114, to.y, PRECISION)
|
91
|
+
assert_in_delta(0, to.z, PRECISION)
|
92
|
+
assert_in_delta(0, to.t, PRECISION)
|
93
|
+
|
94
|
+
Transformation objects can also be created directly like this:
|
95
|
+
|
96
|
+
transform = Proj::Transformation.new('epsg:31467', 'epsg:4326')
|
97
|
+
|
98
|
+
=== Coordinate
|
99
|
+
Notice the examples above transform Coordinate objects. A Coordinate consists
|
100
|
+
of up to four double values to represent three directions plus time. In general
|
101
|
+
you will need to fill out at least the first two values:
|
102
|
+
|
103
|
+
from = Proj::Coordinate.new(x: 5428192.0, y: 3458305.0, z: -5.1790915237)
|
104
|
+
from = Proj::Coordinate.new(lam: 48.9906726079, phi: 8.4302123334)
|
105
|
+
|
106
|
+
Lam is longitude and phi is latitude.
|
107
|
+
|
108
|
+
=== Context
|
109
|
+
Contexts are used to support multi-threaded programs. The bindings expose this object via Context.current
|
110
|
+
and store it using thread local storage. Use the context object to access error codes, set proj4
|
111
|
+
compatability settings, set the logging level and to install custom logging code.
|
112
|
+
|
113
|
+
Both Crs and Transformation objects take a context object in their constructors. If none is passed, they default
|
114
|
+
to using Context.current
|
115
|
+
|
116
|
+
=== Projection
|
117
|
+
If you are using Proj 4, then instead of using Coordinates, Crses and Tranformations you use Points and Projections. Those
|
118
|
+
are deprecated classes but will continue to work until the release of Proj 7. Please refer to the documentation
|
119
|
+
for more information.
|
120
|
+
|
121
|
+
== Error handling
|
122
|
+
When an error occurs, a Proj::Error instance will be thrown with the underlying message provided
|
123
|
+
from the Proj library.
|
124
|
+
|
125
|
+
== Finding Proj Files (LIB_PROJ)
|
126
|
+
Starting with version 6, Proj stores its information (datums, ellipsoids, prime meridians, coordinate systems,
|
127
|
+
units, etc) in a sqlite file called proj.db. If Proj cannot find its database, then the Ruby bindings will
|
128
|
+
search for it in some well-known locations. Failing that, the Ruby bindings will raise an exception.
|
129
|
+
In this case, set the environmental variable PROJ_LIB to point at the folder that contains the proj.db file.
|
130
|
+
Note PROJ_LIB must be set by whatever launches your Ruby program. The Ruby program itself cannot set this
|
131
|
+
variable and have it work correctly (at least not on windows).
|
132
|
+
|
133
|
+
== Backwards Compatibility
|
134
|
+
Proj versions 5 and 6 are *very* different than Proj version 4. Changes are documented at
|
135
|
+
https://proj.org/development/migration.html. Note that the gem should gracefully degrade
|
136
|
+
(as in newer functionality stops working) depending on if you are using Proj 6, Proj 5 or Proj 4.
|
137
|
+
|
138
|
+
To ensure backwards compatiblity, the Ruby bindings still include the older Point and Projection
|
139
|
+
classes. However, these classes are no longer documented in this Readme because they will be
|
140
|
+
removed upon the release of Proj 7 which will remove the underlying API's they are dependent upon.
|
141
|
+
So please port your code! But take note of the changes in Proj 6 described below.
|
142
|
+
|
143
|
+
Proj 5 introduced the the Coordinate, Crs and Tranformation apis. However, it wasn't until Proj 6 that additional
|
144
|
+
metadata APIs were added, so the amount of information about each object is somewhat limited.
|
145
|
+
|
146
|
+
Proj 6 makes a big change compared to previous releases that is not well documented (see
|
147
|
+
https://github.com/OSGeo/PROJ/pull/1182). When creating tranformations with EPSG values Proj 6
|
148
|
+
will assume EPSG axis order and units (typically lat-long degree for geodetic CRS). First,
|
149
|
+
this means that lat-long should usually be specified in degrees and not radians (breaking change one).
|
150
|
+
Second, the axis order is likely different than what your previous code assumed (breaking change two).
|
151
|
+
Note if creating transformations with the deprecated "+init=epsg:XXXX" values, Proj 6 will assume the traditional
|
152
|
+
axis order and units (long-lat radians for geodetic CRS).
|
153
|
+
|
154
|
+
Bottom line - when porting your code to the new Proj 6 APIs generally:
|
155
|
+
|
156
|
+
* Use degrees, not radians
|
157
|
+
* Swap the order of the lat and long values
|
158
|
+
|
159
|
+
== Tests
|
160
|
+
Proj4rb ships with a full test suite designed to work using Proj 6. If you are using an earlier version of Proj,
|
161
|
+
then expect *many* test failures.
|
162
|
+
|
163
|
+
== License
|
164
|
+
Proj4rb is released under the MIT license.
|
155
165
|
|
156
166
|
==Authors
|
157
167
|
The proj4rb Ruby bindings were started by Guilhem Vellut with most of the code
|
158
168
|
written by Jochen Topf. Charlie Savage ported the code to Windows and added
|
159
|
-
the Windows build infrastructure.
|
160
|
-
|
169
|
+
the Windows build infrastructure. Later, he updated the code to support
|
170
|
+
Proj version 5 and 6 and ported the code to use FFI.
|
data/Rakefile
CHANGED
@@ -1,42 +1,27 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "rubygems"
|
4
|
-
require "rake/
|
5
|
-
require "
|
6
|
-
require "
|
7
|
-
require "
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
rdoc.options << "--line-numbers"
|
28
|
-
# Make the readme file the start page for the generated html
|
29
|
-
rdoc.main = 'README.rdoc'
|
30
|
-
rdoc.rdoc_files.include('doc/*.rdoc',
|
31
|
-
'ext/projrb.c',
|
32
|
-
'README',
|
33
|
-
'proj4rb.gemspec',
|
34
|
-
'Changelog',
|
35
|
-
'MIT-LICENSE')
|
36
|
-
end
|
37
|
-
|
38
|
-
# Test Task
|
39
|
-
Rake::TestTask.new do |t|
|
40
|
-
t.libs << "test"
|
41
|
-
t.verbose = true
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "rake/testtask"
|
5
|
+
require "rubygems/package_task"
|
6
|
+
require "yard"
|
7
|
+
require "yaml"
|
8
|
+
|
9
|
+
# Read the spec file
|
10
|
+
GEM_NAME = "proj4rb"
|
11
|
+
spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
|
12
|
+
|
13
|
+
# Setup generic gem
|
14
|
+
Gem::PackageTask.new(spec) do |pkg|
|
15
|
+
pkg.package_dir = 'pkg'
|
16
|
+
pkg.need_tar = false
|
17
|
+
end
|
18
|
+
|
19
|
+
# Yard Task
|
20
|
+
desc "Generate documentation"
|
21
|
+
YARD::Rake::YardocTask.new
|
22
|
+
|
23
|
+
# Test Task
|
24
|
+
Rake::TestTask.new do |t|
|
25
|
+
t.libs << "test"
|
26
|
+
t.verbose = true
|
42
27
|
end
|