Permalink
Browse files

Simple test for valid compilation

  • Loading branch information...
zhm committed Jun 21, 2012
1 parent c9acfa9 commit 68d2a27e0eaebab6bde0ca7103e8049352355cff
Showing with 64 additions and 3 deletions.
  1. +2 −0 .gitignore
  2. +9 −0 .travis.yml
  3. +1 −1 README.md
  4. +37 −1 Rakefile
  5. +4 −0 gdal.gemspec
  6. +1 −1 lib/gdal-ruby/version.rb
  7. +10 −0 spec/gdal_spec.rb
View
@@ -1,6 +1,8 @@
*.gem
*.rbc
.bundle
+*.so
+*.bundle
.config
.yardoc
Gemfile.lock
View
@@ -0,0 +1,9 @@
+language: ruby
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - 1.9.3
+before_install:
+ - sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable -y
+ - sudo apt-get update
+ - sudo apt-get install libgdal-dev
View
@@ -1,4 +1,4 @@
-# Gdal::Ruby
+# Gdal::Ruby [![Build Status](https://secure.travis-ci.org/zhm/gdal-ruby.png)](http://travis-ci.org/zhm/gdal-ruby)
Native bindings for GDAL/OGR for ruby. The GDAL repository contains ruby bindings
in the `swig/ruby` directory, but they aren't compiled or installed with default
View
@@ -1,2 +1,38 @@
#!/usr/bin/env rake
-require "bundler/gem_tasks"
+require 'rubygems'
+require 'bundler'
+require 'bundler/gem_tasks'
+require 'rake/testtask'
+require 'rake'
+require 'rake/extensiontask'
+require 'rspec/core'
+require 'rspec/core/rake_task'
+
+Bundler.setup
+
+Rake::ExtensionTask.new('gdal-ruby/gdal') do |ext|
+ ext.name = 'gdal'
+ ext.lib_dir = "lib/gdal-ruby"
+end
+
+Rake::ExtensionTask.new('gdal-ruby/ogr') do |ext|
+ ext.name = 'ogr'
+ ext.lib_dir = "lib/gdal-ruby"
+end
+
+Rake::ExtensionTask.new('gdal-ruby/osr') do |ext|
+ ext.name = 'osr'
+ ext.lib_dir = "lib/gdal-ruby"
+end
+
+Rake::ExtensionTask.new('gdal-ruby/gdalconst') do |ext|
+ ext.name = 'gdalconst'
+ ext.lib_dir = "lib/gdal-ruby"
+end
+
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ Rake::Task['compile'].invoke
+ spec.pattern = FileList['spec/**/*_spec.rb']
+end
+
+task :default => :spec
View
@@ -16,4 +16,8 @@ Gem::Specification.new do |gem|
gem.name = "gdal"
gem.require_paths = ["lib"]
gem.version = Gdal::Ruby::VERSION
+
+ gem.add_development_dependency 'rake', ['>= 0']
+ gem.add_development_dependency 'rake-compiler', ['>= 0']
+ gem.add_development_dependency 'rspec', ['>= 0']
end
View
@@ -1,5 +1,5 @@
module Gdal
module Ruby
- VERSION = "0.0.1"
+ VERSION = "0.0.2"
end
end
View
@@ -0,0 +1,10 @@
+require 'gdal'
+
+describe "Gdal" do
+ it "converts WKT to GeoJSON" do
+ valid_wkt = 'POINT (30 10)'
+ valid_json = '{ "type": "Point", "coordinates": [ 30.0, 10.0 ] }'
+
+ Gdal::Ogr.create_geometry_from_wkt(valid_wkt).export_to_json.should eq(valid_json)
+ end
+end

0 comments on commit 68d2a27

Please sign in to comment.