Skip to content

Ruby Examples ... #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.repos
bin
build
include
lib
*.pyc
.Python
26 changes: 25 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<property name="groovy.long" value="Groovy"/>
<property name="groovy.repo" value="jericks/geoscript-groovy"/>

<property name="ruby.version" value="0.0.1.pre" />
<property name="ruby.short" value="ruby" />
<property name="ruby.long" value="Ruby" />
<property name="ruby.repo" value="scooterw/geoscript-ruby" />

<property name="repos" value="${basedir}/.repos"/>
<property name="t" value="&#x0009;"/>

Expand All @@ -40,6 +45,8 @@
<echo message="${t}scala-pull: Update scala repo."/>
<echo message="${t}groovy-doc: Build the groovy docs (groovy-pull first)."/>
<echo message="${t}groovy-pull: Update groovy repo."/>
<echo message="${t}ruby-doc: Build the ruby docs (ruby-pull first)." />
<echo message="${t}ruby-pull: Update ruby repo." />
<echo message="${t}init: Check out local git repos."/>
<echo message="${t}clean: Delete doc builds."/>
<echo message="${t}clean-full: Delete doc builds and local git repos."/>
Expand All @@ -65,6 +72,9 @@
<condition property="repo.groovy.exists">
<available file="${repos}/${groovy.short}"/>
</condition>
<condition property="repo.ruby.exists">
<available file="${repos}/${ruby.short}" />
</condition>
</target>

<target name="init-js" depends="init">
Expand Down Expand Up @@ -198,13 +208,27 @@
</copy>
</target>

<target name="init-ruby" depends="init">
<antcall target="ruby-clone" />
</target>

<target name="ruby-pull" if="repo.ruby.exists" depends="init-ruby">
<exec executable="git" dir="${repos}/${ruby.short}">
<arg value="pull" />
</exec>
</target>

<target name="ruby-doc" depends="init-ruby">
<exec></exec>
</target>

<target name="site-doc" depends="init">
<exec executable="sphinx-build" dir="${basedir}/src" failonerror="true">
<arg line="-E -b html . ${basedir}/build"/>
</exec>
</target>

<target name="site" depends="js-pull, js-doc, py-pull, py-doc, scala-pull, scala-doc, groovy-pull, groovy-doc, site-doc"/>
<target name="site" depends="js-pull, js-doc, py-pull, py-doc, scala-pull, scala-doc, groovy-pull, groovy-doc, ruby-pull, ruby-doc, site-doc"/>

<target name="clean">
<delete dir="${basedir}/build"/>
Expand Down
1 change: 1 addition & 0 deletions src/_theme/geoscript/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ <h1 id="logo"><a href="{{ pathto('index') }}">GeoScript</a></h1>
<li><a href="{{ pathto('py/index') }}">Python</a></li>
<li><a href="{{ pathto('scala/index') }}">Scala</a></li>
<li><a href="{{ pathto('groovy/index') }}">Groovy</a></li>
<li><a href="{{ pathto('ruby/index') }}">Ruby</a></li>
</ul>
{%- if pagename != "search" %}
<div id="searchbox">
Expand Down
2 changes: 2 additions & 0 deletions src/_theme/geoscript/static/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ var site = {
id: "scala", title: "Scala"
}, {
id: "groovy", title: "Groovy"
}, {
id: "ruby", title: "Ruby"
}];

var list = $("<ul></ul>");
Expand Down
25 changes: 24 additions & 1 deletion src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

GeoScript adds spatial capabilities to dynamic scripting languages

GeoScript implementations are available in `JavaScript <js>`_, `Python <py>`_, `Scala <scala>`_, and `Groovy <groovy>`_.
GeoScript implementations are available in `JavaScript <js>`_, `Python <py>`_, `Scala <scala>`_, `Groovy <groovy>`_, and `Ruby <ruby>`_.

.. cssclass:: tab-js ui-tabs-hide

Expand Down Expand Up @@ -66,6 +66,29 @@ GeoScript implementations are available in `JavaScript <js>`_, `Python <py>`_, `
groovy:000> poly.area
===> 31214.451522477902

.. cssclass:: tab-ruby ui-tabs-hide

.. code-block:: ruby

irb(main):001:0> require 'geoscript'
=> true
irb(main):002:0> include GeoScript::Geom
=> Object
irb(main):003:0> p = Point.create -111.0, 45.7
=> #<GeoScript::Geom::Point:0x76c5495 @bounds=#<GeoScript::Geom::Bounds:0x7317851>>
irb(main):004:0> p.to_wkt
=> "POINT (-111.0 45.7)"
irb(main):005:0> p2 = GeoScript::Projection.reproject p, 'epsg:4326', 'epsg:26912'
=> #<Java::ComVividsolutionsJtsGeom::Point:0x5ad7eb94>
irb(main):006:0> p2.x
=> 500000.0
irb(main):007:0> p2.y
=> 5060716.313515949
irb(main):008:0> poly = p2.buffer 100
=> #<Java::ComVividsolutionsJtsGeom::Polygon:0xb034979>
irb(main):009:0> poly.get_area
=> 31214.451522458345

Find out more :ref:`about <about>` the GeoScript project and how to :ref:`get involved <get_involved>`. See the :ref:`learning center <learning>` for an
overview of the library.

Expand Down