-
Notifications
You must be signed in to change notification settings - Fork 4
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
"Integration of modularized export code" #1
Changes from all commits
48383c3
33273aa
872d0d3
a0a06e1
a5e7026
ce37b9d
e4a4380
6ab0908
4d39742
c10e2cd
6a3dd90
5f33b87
e44e2b4
1e6e7e8
0a2869b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.git |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
sudo: required | ||
services: | ||
- docker | ||
|
||
install: | ||
docker build . -t mapknitter-exporter:latest | ||
|
||
script: | ||
docker run mapknitter-exporter bundle exec rspec |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,49 @@ | ||
GIT | ||
remote: https://github.com/publiclab/mapknitter-exporter | ||
revision: 480cc2bca5a23454967caed2221a2e44a1ac309d | ||
branch: add_cartagen | ||
glob: *.gemspec | ||
specs: | ||
mapknitter-exporter (0.0.1) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
diff-lcs (1.3) | ||
mustermann (1.0.2) | ||
rack (2.0.6) | ||
rack-protection (2.0.3) | ||
mustermann (1.0.3) | ||
rack (2.0.7) | ||
rack-protection (2.0.5) | ||
rack | ||
rack-test (1.1.0) | ||
rack (>= 1.0, < 3) | ||
rspec (3.7.0) | ||
rspec-core (~> 3.7.0) | ||
rspec-expectations (~> 3.7.0) | ||
rspec-mocks (~> 3.7.0) | ||
rspec-core (3.7.1) | ||
rspec-support (~> 3.7.0) | ||
rspec-expectations (3.7.0) | ||
rspec (3.8.0) | ||
rspec-core (~> 3.8.0) | ||
rspec-expectations (~> 3.8.0) | ||
rspec-mocks (~> 3.8.0) | ||
rspec-core (3.8.0) | ||
rspec-support (~> 3.8.0) | ||
rspec-expectations (3.8.2) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.7.0) | ||
rspec-mocks (3.7.0) | ||
rspec-support (~> 3.8.0) | ||
rspec-mocks (3.8.0) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.7.0) | ||
rspec-support (3.7.1) | ||
sinatra (2.0.3) | ||
rspec-support (~> 3.8.0) | ||
rspec-support (3.8.0) | ||
sinatra (2.0.5) | ||
mustermann (~> 1.0) | ||
rack (~> 2.0) | ||
rack-protection (= 2.0.3) | ||
rack-protection (= 2.0.5) | ||
tilt (~> 2.0) | ||
tilt (2.0.8) | ||
tilt (2.0.9) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
mapknitter-exporter! | ||
rack-test | ||
rspec | ||
sinatra | ||
|
||
BUNDLED WITH | ||
1.16.2 | ||
1.13.6 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require "mapknitterExporter" | ||
require "sinatra" | ||
require "json" | ||
|
||
|
@@ -31,4 +32,42 @@ | |
STDERR.puts "Uploading file, original name #{name.inspect}" | ||
@data = JSON.parse(tmpfile.read) | ||
String @data[0]['image_file_name'] | ||
|
||
export = Export.new | ||
|
||
# each image will be: | ||
# { | ||
# "cm_per_pixel":4.99408, | ||
# "id":306187, // some unique id | ||
# "nodes":[ | ||
# {"id":2593754,"lat":"-37.7664063648","lon":"144.9828654528"}, | ||
# {"id":2593755,"lat":"-37.7650239004","lon":"144.9831980467"}, | ||
# {"id":2593756,"lat":"-37.7652020107","lon":"144.9844533205"}, | ||
# {"id":2593757,"lat":"-37.7665844718","lon":"144.9841207266"} | ||
# ], | ||
# "src":"https://s3.amazonaws.com/grassrootsmapping/warpables/306187/DJI_1207.JPG", | ||
# } | ||
|
||
# simplified this because of https://github.com/publiclab/mapknitteexporter/pull/6... it won't work yet though | ||
MapKnitterExporter.run_export( | ||
@data[0]['id'], | ||
@data[0]['height'], | ||
export, | ||
@data[0]['map_id'], | ||
@data[0]['images'], # TODO: these images need a special format like https://github.com/publiclab/mapknitter-exporter/blob/bf375b6f2cb09070503f523d24ba803936144875/test/exporter_test.rb#L15-L39 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we resolve this comment and rely on their formatting coming properly from the incoming JSON request? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! We need an instance of a properly format JSON request. |
||
'' | ||
) | ||
end | ||
|
||
|
||
class Export | ||
|
||
attr_accessor :status, :tms, :geotiff, :zip, :jpg # these will be updated with i.e. export.tms = "/path" | ||
|
||
def save | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So here, we should be updating a .json file stored in google cloud - but can we merge now, and add this on in a later PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes please. |
||
# need to save status.json file with above properties as strings | ||
puts "saved" | ||
return true | ||
end | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2015 Google, Inc | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require_relative "../app.rb" | ||
require "rspec" | ||
require "rack/test" | ||
|
||
describe "Mapknitter Exporter" do | ||
include Rack::Test::Methods | ||
|
||
def app | ||
Sinatra::Application | ||
end | ||
|
||
it "displays Mapknitter Exporter text" do | ||
get "/" | ||
expect(last_response.body).to match("Mapknitter Exporter") | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is the one whose parameters will change. But can we peg to the current version of
mapknitter-exporter
for now, and then when we change the params, we'll issue a breaking change version bump and then make the change here too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I am linking to the current (git) version of
mapknitter-exporter
except to theadd_cartagen
branch because otherwise it wouldn'trequire
. Please merge theadd_cartagen
branch if it is correct.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, cool, could you open a PR for this? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did! publiclab/mapknitter-exporter#7 :-)