Permalink
Browse files

Version access

  • Loading branch information...
1 parent 8898265 commit 615f198e9822119c335f2a98a3517b4af6d12cac @dazuma dazuma committed Jan 19, 2011
Showing with 67 additions and 1 deletion.
  1. +4 −0 History.rdoc
  2. +1 −1 Version
  3. +1 −0 lib/rgeo/geo_json.rb
  4. +56 −0 lib/rgeo/geo_json/version.rb
  5. +5 −0 test/tc_basic.rb
View
4 History.rdoc
@@ -1,3 +1,7 @@
+=== 0.2.1 / 2011-01-19
+
+* The gem version is now accessible via an api.
+
=== 0.2.0 / 2010-12-07
* Initial public alpha release. Spun rgeo-geojson off from the core rgeo gem.
View
2 Version
@@ -1 +1 @@
-0.2.0
+0.2.1
View
1 lib/rgeo/geo_json.rb
@@ -57,6 +57,7 @@ module GeoJSON
# Implementation files
+require 'rgeo/geo_json/version'
require 'rgeo/geo_json/entities'
require 'rgeo/geo_json/coder'
require 'rgeo/geo_json/interface'
View
56 lib/rgeo/geo_json/version.rb
@@ -0,0 +1,56 @@
+# -----------------------------------------------------------------------------
+#
+# Version of rgeo-geojson
+#
+# -----------------------------------------------------------------------------
+# Copyright 2010 Daniel Azuma
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the copyright holder, nor the names of any other
+# contributors to this software, may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# -----------------------------------------------------------------------------
+;
+
+
+begin
+ require 'versionomy'
+rescue ::LoadError
+end
+
+
+module RGeo
+
+ module GeoJSON
+
+ # Current version of RGeo::GeoJSON as a frozen string
+ VERSION_STRING = ::File.read(::File.dirname(__FILE__)+'/../../../Version').strip.freeze
+
+ # Current version of RGeo::GeoJSON as a Versionomy object, if the
+ # Versionomy gem is available; otherwise equal to VERSION_STRING.
+ VERSION = defined?(::Versionomy) ? ::Versionomy.parse(VERSION_STRING) : VERSION_STRING
+
+ end
+
+end
View
5 test/tc_basic.rb
@@ -54,6 +54,11 @@ def setup
end
+ def test_has_version
+ assert_not_nil(::RGeo::GeoJSON::VERSION)
+ end
+
+
def test_point
object_ = @geo_factory.point(10, 20)
json_ = {

0 comments on commit 615f198

Please sign in to comment.