Skip to content

Commit ab63dc3

Browse files
committed
Updated Postgrex and Poison optional dependencies
1 parent 564ccb6 commit ab63dc3

7 files changed

Lines changed: 50 additions & 43 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v1.0.1
2+
* Enhancements
3+
* Updated Postgrex and Poison optional dependencies
4+
15
# v1.0.0
26

37
# v0.18.0

mix.exs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Geo.Mixfile do
33

44
def project do
55
[ app: :geo,
6-
version: "1.0.0",
6+
version: "1.0.1",
77
elixir: "~> 1.0",
88
deps: deps,
99
description: description,
@@ -28,8 +28,8 @@ defmodule Geo.Mixfile do
2828
defp deps do
2929
[
3030
{:ecto, "~> 1.1", optional: true },
31-
{:postgrex, "~> 0.9", optional: true },
32-
{:poison, "~> 1.0", optional: true},
31+
{:postgrex, "~> 0.11", optional: true },
32+
{:poison, "~> 1.5 or ~> 2.0", optional: true},
3333
{:earmark, "~> 0.1", only: :dev},
3434
{:ex_doc, "~> 0.10", only: :dev}
3535
]

mix.lock

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
%{"connection": {:hex, :connection, "1.0.2"},
2-
"decimal": {:hex, :decimal, "1.1.0"},
3-
"earmark": {:hex, :earmark, "0.1.17"},
4-
"ecto": {:hex, :ecto, "1.1.0"},
5-
"ex_doc": {:hex, :ex_doc, "0.10.0"},
2+
"db_connection": {:hex, :db_connection, "0.2.3"},
3+
"decimal": {:hex, :decimal, "1.1.1"},
4+
"earmark": {:hex, :earmark, "0.2.1"},
5+
"ecto": {:hex, :ecto, "1.1.3"},
6+
"ex_doc": {:hex, :ex_doc, "0.11.4"},
67
"hex": {:git, "git://github.com/rjsamson/hex.git", "48e3e0887153baa0a34879ebf649ae0af15ef386", []},
78
"jazz": {:hex, :jazz, "0.2.1"},
89
"jsex": {:git, "git://github.com/talentdeficit/jsex.git", "91fbbb51ac18c5ecec45044af107cd079af2ff8b", []},
910
"json": {:git, "git://github.com/cblage/elixir-json.git", "f386b18431bbc0a0b6d38519ec2f256b5a040668", []},
1011
"jsx": {:hex, :jsx, "2.1.1"},
11-
"poison": {:hex, :poison, "1.5.0"},
12+
"poison": {:hex, :poison, "1.5.2"},
1213
"poolboy": {:hex, :poolboy, "1.5.1"},
13-
"postgrex": {:hex, :postgrex, "0.9.1"}}
14+
"postgrex": {:hex, :postgrex, "0.11.0"}}

test/geo/ecto_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ defmodule Geo.Ecto.Test do
3333
username: "postgres", database: "geo_postgrex_test",
3434
extensions: [{Geo.PostGIS.Extension, library: Geo}]]
3535

36-
{:ok, pid} = Postgrex.Connection.start_link(opts)
37-
{:ok, _} = Postgrex.Connection.query(pid, "DROP TABLE IF EXISTS locations, geographies", [])
38-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE locations (id serial primary key, name varchar, geom geometry(MultiPolygon))", [])
39-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE geographies (id serial primary key, name varchar, geom geography(Point))", [])
36+
{:ok, pid} = Postgrex.start_link(opts)
37+
{:ok, _} = Postgrex.query(pid, "DROP TABLE IF EXISTS locations, geographies", [])
38+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE locations (id serial primary key, name varchar, geom geometry(MultiPolygon))", [])
39+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE geographies (id serial primary key, name varchar, geom geography(Point))", [])
4040

4141
{:ok, _} = Repo.start_link()
4242

test/geo/geography_test.exs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ defmodule Geo.Geography.Test do
66
username: "postgres", database: "geo_postgrex_test",
77
extensions: [{Geo.PostGIS.Extension, library: Geo}]]
88

9-
{:ok, pid} = Postgrex.Connection.start_link(opts)
10-
{:ok, _result} = Postgrex.Connection.query(pid, "DROP TABLE IF EXISTS geography_test", [])
9+
{:ok, pid} = Postgrex.start_link(opts)
10+
{:ok, _result} = Postgrex.query(pid, "DROP TABLE IF EXISTS geography_test", [])
1111
{:ok, [pid: pid]}
1212
end
1313

1414
test "insert geography point", context do
1515
pid = context[:pid]
1616
geo = %Geo.Point{ coordinates: {30, -90}, srid: 4326}
17-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE geography_test (id int, geom geography(Point, 4326))", [])
18-
{:ok, _} = Postgrex.Connection.query(pid, "INSERT INTO geography_test VALUES ($1, $2)", [42, geo])
19-
{:ok, result} = Postgrex.Connection.query(pid, "SELECT * FROM geography_test", [])
17+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE geography_test (id int, geom geography(Point, 4326))", [])
18+
{:ok, _} = Postgrex.query(pid, "INSERT INTO geography_test VALUES ($1, $2)", [42, geo])
19+
{:ok, result} = Postgrex.query(pid, "SELECT * FROM geography_test", [])
2020
assert(result.rows == [[42, geo]])
2121
end
2222
end

test/geo/postgis_test.exs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,71 +6,71 @@ defmodule Geo.PostGIS.Test do
66
username: "postgres", database: "geo_postgrex_test",
77
extensions: [{Geo.PostGIS.Extension, library: Geo}]]
88

9-
{:ok, pid} = Postgrex.Connection.start_link(opts)
10-
{:ok, _result} = Postgrex.Connection.query(pid, "DROP TABLE IF EXISTS text_test, point_test, linestring_test, polygon_test, multipoint_test, multilinestring_test, multipolygon_test, geometrycollection_test", [])
9+
{:ok, pid} = Postgrex.start_link(opts)
10+
{:ok, _result} = Postgrex.query(pid, "DROP TABLE IF EXISTS text_test, point_test, linestring_test, polygon_test, multipoint_test, multilinestring_test, multipolygon_test, geometrycollection_test", [])
1111
{:ok, [pid: pid]}
1212
end
1313

1414
test "insert point", context do
1515
pid = context[:pid]
1616
geo = %Geo.Point{ coordinates: {30, -90}, srid: 4326}
17-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE point_test (id int, geom geometry(Point, 4326))", [])
18-
{:ok, _} = Postgrex.Connection.query(pid, "INSERT INTO point_test VALUES ($1, $2)", [42, geo])
19-
{:ok, result} = Postgrex.Connection.query(pid, "SELECT * FROM point_test", [])
17+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE point_test (id int, geom geometry(Point, 4326))", [])
18+
{:ok, _} = Postgrex.query(pid, "INSERT INTO point_test VALUES ($1, $2)", [42, geo])
19+
{:ok, result} = Postgrex.query(pid, "SELECT * FROM point_test", [])
2020
assert(result.rows == [[42, geo]])
2121
end
2222

2323
test "insert with text column", context do
2424
pid = context[:pid]
2525
geo = %Geo.Point{ coordinates: {30, -90}, srid: 4326}
26-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE text_test (id int, t text, geom geometry(Point, 4326))", [])
27-
{:ok, _} = Postgrex.Connection.query(pid, "INSERT INTO text_test (id, t, geom) VALUES ($1, $2, $3)", [42, "test", geo])
28-
{:ok, result} = Postgrex.Connection.query(pid, "SELECT id, t, geom FROM text_test", [])
26+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE text_test (id int, t text, geom geometry(Point, 4326))", [])
27+
{:ok, _} = Postgrex.query(pid, "INSERT INTO text_test (id, t, geom) VALUES ($1, $2, $3)", [42, "test", geo])
28+
{:ok, result} = Postgrex.query(pid, "SELECT id, t, geom FROM text_test", [])
2929
assert(result.rows == [[42, "test", geo]])
3030
end
3131

3232
test "insert linestring", context do
3333
pid = context[:pid]
3434
geo = %Geo.LineString{ srid: 4326, coordinates: [{30, 10}, {10, 30}, {40, 40}] }
35-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE linestring_test (id int, geom geometry(Linestring, 4326))", [])
36-
{:ok, _} = Postgrex.Connection.query(pid, "INSERT INTO linestring_test VALUES ($1, $2)", [42, geo])
37-
{:ok, result} = Postgrex.Connection.query(pid, "SELECT * FROM linestring_test", [])
35+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE linestring_test (id int, geom geometry(Linestring, 4326))", [])
36+
{:ok, _} = Postgrex.query(pid, "INSERT INTO linestring_test VALUES ($1, $2)", [42, geo])
37+
{:ok, result} = Postgrex.query(pid, "SELECT * FROM linestring_test", [])
3838
assert(result.rows == [[42, geo]])
3939
end
4040

4141
test "insert polygon", context do
4242
pid = context[:pid]
4343
geo = %Geo.Polygon{ coordinates: [ [{35, 10}, {45, 45}, {15, 40}, {10, 20}, {35, 10}], [{20, 30}, {35, 35}, {30, 20}, {20, 30}] ], srid: 4326 }
44-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE polygon_test (id int, geom geometry(Polygon, 4326))", [])
45-
{:ok, _} = Postgrex.Connection.query(pid, "INSERT INTO polygon_test VALUES ($1, $2)", [42, geo])
46-
{:ok, result} = Postgrex.Connection.query(pid, "SELECT * FROM polygon_test", [])
44+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE polygon_test (id int, geom geometry(Polygon, 4326))", [])
45+
{:ok, _} = Postgrex.query(pid, "INSERT INTO polygon_test VALUES ($1, $2)", [42, geo])
46+
{:ok, result} = Postgrex.query(pid, "SELECT * FROM polygon_test", [])
4747
assert(result.rows == [[42, geo]])
4848
end
4949

5050
test "insert mulitpoint", context do
5151
pid = context[:pid]
5252
geo = %Geo.MultiPoint{ coordinates: [{0, 0}, {20, 20}, {60, 60}], srid: 4326}
53-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE multipoint_test (id int, geom geometry(MultiPoint, 4326))", [])
54-
{:ok, _} = Postgrex.Connection.query(pid, "INSERT INTO multipoint_test VALUES ($1, $2)", [42, geo])
55-
{:ok, result} = Postgrex.Connection.query(pid, "SELECT * FROM multipoint_test", [])
53+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE multipoint_test (id int, geom geometry(MultiPoint, 4326))", [])
54+
{:ok, _} = Postgrex.query(pid, "INSERT INTO multipoint_test VALUES ($1, $2)", [42, geo])
55+
{:ok, result} = Postgrex.query(pid, "SELECT * FROM multipoint_test", [])
5656
assert(result.rows == [[42, geo]])
5757
end
5858

5959
test "insert mulitlinestring", context do
6060
pid = context[:pid]
6161
geo = %Geo.MultiLineString{ coordinates: [[{10, 10}, {20, 20}, {10, 40}], [{40, 40}, {30, 30}, {40, 20}, {30, 10}]], srid: 4326 }
62-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE multilinestring_test (id int, geom geometry(MultiLinestring, 4326))", [])
63-
{:ok, _} = Postgrex.Connection.query(pid, "INSERT INTO multilinestring_test VALUES ($1, $2)", [42, geo])
64-
{:ok, result} = Postgrex.Connection.query(pid, "SELECT * FROM multilinestring_test", [])
62+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE multilinestring_test (id int, geom geometry(MultiLinestring, 4326))", [])
63+
{:ok, _} = Postgrex.query(pid, "INSERT INTO multilinestring_test VALUES ($1, $2)", [42, geo])
64+
{:ok, result} = Postgrex.query(pid, "SELECT * FROM multilinestring_test", [])
6565
assert(result.rows == [[42, geo]])
6666
end
6767

6868
test "insert mulitpolygon", context do
6969
pid = context[:pid]
7070
geo = %Geo.MultiPolygon{ coordinates: [ [ [{40, 40}, {20, 45}, {45, 30}, {40, 40}] ], [ [{20, 35}, {10, 30}, {10, 10}, {30, 5}, {45, 20}, {20, 35}], [{30, 20}, {20, 15}, {20, 25}, {30, 20}] ] ], srid: 4326}
71-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE TABLE multipolygon_test (id int, geom geometry(MultiPolygon, 4326))", [])
72-
{:ok, _} = Postgrex.Connection.query(pid, "INSERT INTO multipolygon_test VALUES ($1, $2)", [42, geo])
73-
{:ok, result} = Postgrex.Connection.query(pid, "SELECT * FROM multipolygon_test", [])
71+
{:ok, _} = Postgrex.query(pid, "CREATE TABLE multipolygon_test (id int, geom geometry(MultiPolygon, 4326))", [])
72+
{:ok, _} = Postgrex.query(pid, "INSERT INTO multipolygon_test VALUES ($1, $2)", [42, geo])
73+
{:ok, result} = Postgrex.query(pid, "SELECT * FROM multipolygon_test", [])
7474
assert(result.rows == [[42, geo]])
7575
end
7676
end

test/test_helper.exs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
:ok = Application.ensure_started(:poolboy)
22
:ok = Application.ensure_started(:decimal)
3+
:ok = Application.ensure_started(:connection)
4+
:ok = Application.ensure_started(:db_connection)
35
:ok = Application.ensure_started(:postgrex)
46
:ok = Application.ensure_started(:ecto)
57

@@ -9,5 +11,5 @@ opts = [hostname: "localhost",
911
username: "postgres", database: "geo_postgrex_test",
1012
extensions: [{Geo.PostGIS.Extension, library: Geo}]]
1113

12-
{:ok, pid} = Postgrex.Connection.start_link(opts)
13-
{:ok, _} = Postgrex.Connection.query(pid, "CREATE EXTENSION IF NOT EXISTS postgis", [])
14+
{:ok, pid} = Postgrex.start_link(opts)
15+
{:ok, _} = Postgrex.query(pid, "CREATE EXTENSION IF NOT EXISTS postgis", [])

0 commit comments

Comments
 (0)