<img src=“https://travis-ci.org/sul-dlss/rgeoserver.svg” alt=“Build Status” />
RGeoServer¶ ↑
RGeoServer is a Ruby client for the GeoServer RESTful Configuration interface.
Requirements:
-
GeoServer 2.1.3 or later.
-
Ruby 2.2 or later
It provides primitive Ruby model abstraction.
Documentation¶ ↑
See the GeoServer REST Configuration API Reference
Installation ¶ ↑
$ gem install rgeoserver
Example: ¶ ↑
Sample usage from an irb console, using a GeoServer installation with a topp workspace.
$ rake console > require 'rgeoserver' > catalog = RGeoServer::Catalog.new => Catalog: http://localhost:8080/geoserver/rest > w = catalog.get_default_workspace => RGeoServer::Workspace: topp > ds = w.data_stores.first => RGeoServer::DataStore: states_shapefile > ds.profile => {"name"=>"states_shapefile", "enabled"=>"true", "connectionParameters"=>{ "url"=>"file:data/shapefiles/states.shp", "namespace"=>"http://www.openplans.org/topp"}, "featureTypes"=>["states"]} > ft = ds.featuretypes.first => RGeoServer::FeatureType: states > ft.profile => {:name=>"states", :workspace=>"topp", :nativeName=>"states"} > lyr = RGeoServer::Layer.new c, :name => 'Arc_Sample' => RGeoServer::Layer: Arc_Sample > lyr.profile => {"name"=>"Arc_Sample", "path"=>"/", "defaultstyle"=>"rain", "styles"=>["raster"], "type"=>"RASTER", "enabled"=>"true", "attribution"=>{"logoWidth"=>"0", "logoHeight"=>"0"}, "resource"=>{ "type"=>"coverage", "name"=>"Arc_Sample", "store"=>"arcGridSample", "workspace"=>"nurc"}, "metadata"=>{ "GWC.autoCacheStyles"=>"true", "GWC.metaTilingX"=>"4", "GWC.metaTilingY"=>"4", "GWC.gutter"=>"0", "GWC.cachedNonDefaultStyles"=>"raster", "GWC.enabled"=>"true", "GWC.cacheFormats"=>"image/jpeg,image/png", "GWC.gridSets"=>"EPSG:4326,EPSG:900913"}} > sld = lyr.styles.first => RGeoServer::Style: raster > sld.profile => {"name"=>"raster", "sld_version"=>"1.0.0", "filename"=>"raster.sld", "sld"=>{"sld_name"=>"raster", "sld_title"=>"Default Raster"}}
See examples directory for more examples.
Testing¶ ↑
We use jettywrapper to wrap a test instance of GeoServer. In theory, you should be able to point to any other local installation. Suppose that you download the binary stable version 2.1.3 binary from here, then unzip it under say, /tmp/geoserver-2.1.3. The integration tests are executed as follows:
If you have the test instance running already on port 8080, you can run the tests simply with:
$ rake spec:integration
To generate the documentation run:
$ rake yard
To enter into an Pry console with all classes loaded:
$ rake console
Logging¶ ↑
To enable logging from RestClient’s base logger, add an entry in your ‘config.yml` for stdout/stderr or a file:
geoserver: logfile: stderr
or
geoserver: logfile: 'rgeoserver.log'
Related Resources¶ ↑
-
Implementation in other languages:
-
Python: gsconfig.py
-
Release History¶ ↑
-
v0.7 - Major update with keywords, YAML config, REST API, unit testing and cleanup
-
v0.5 - Initial alpha release
TODO¶ ↑
-
Complete data stores and coverages functionality and data upload.
-
Complete updating data in objects. On failure, objects should roll back.
-
Complete documentation.
-
Complete test coverage:
-
Break down testing into separate specs per class.
-
Add more flexibility for integration tests with embedded Jetty and other containers.
-
Add ability to perform integration tests in a CI server.
-
-
Provide more examples:
-
Customize configuration.
-
Connect under SSL.
-
-
Migrate base HTTP client to Faraday?
-
Curlify operations: To provide optional log/output of the curl command that would produce the same
result as the ResourceInfo#save method.
Contributing with Patches and Pull requests checklist¶ ↑
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
-
Fork the project
-
Start a feature/bugfix branch
-
Commit and push until you are happy with your contribution
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Acknowledgements¶ ↑
Inspired on the Rubydora gem. Followed somewhat closely to gsconfig.py
Contributors¶ ↑
This package is supported and maintained by Stanford University Libraries.
-
Renzo Sanchez-Silva <renzo.sanchez.silva@gmail.com> (Original Author)
-
Bess Sadler <bess@stanford.edu>
-
Darren Hardy <drh@stanford.edu>
License ¶ ↑
Copyright © 2012-2013 Stanford University
Licensed under the Apache License, Version 2.0