Browse Source

Add test with test-runnier

tags/0.3.0^2
Bèr Kessels 3 years ago
parent
commit
08ce253314
3 changed files with 28 additions and 45 deletions
  1. 4
    0
      Gemfile
  2. 2
    0
      Gemfile.lock
  3. 22
    45
      Makefile

+ 4
- 0
Gemfile View File

@@ -9,3 +9,7 @@ gem "opening_hours_converter"
gem "nominatim", github: "lukaszsliwa/nominatim"

gem "semver"

group :development, :test do
gem "minitest"
end

+ 2
- 0
Gemfile.lock View File

@@ -12,6 +12,7 @@ GEM
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
json (2.1.0)
minitest (5.11.3)
multi_json (1.13.1)
multipart-post (2.0.0)
opening_hours_converter (1.7.20)
@@ -22,6 +23,7 @@ PLATFORMS
ruby

DEPENDENCIES
minitest
nominatim!
opening_hours_converter
semver

+ 22
- 45
Makefile View File

@@ -1,53 +1,30 @@
ENV_FILE := .env
POSTGRES_PASSWORD := $(shell grep DB_PASSWORD ${ENV_FILE} | cut -d '=' -f 2)
OSM_FILE = /media/ber/ExtraDrive1/OSM/netherlands-latest.osm.pbf
DB_NAME := hours_development
PG_URL = postgres://postgres:$(POSTGRES_PASSWORD)@localhost:5432/$(DB_NAME)
OUT_DIR=tmp
CMD_PREFIX=bundle exec
VERSION=$(shell semver)
TODAY=$(shell date +%F)

.PHONY: all console install import server clean test lint doc services
# You want latexmk to *always* run, because make does not have all the info.
# Also, include non-file targets in .PHONY so they are run regardless of any
# file of the given name existing.
.PHONY: all test clean setup ruby packages preprocess

all: test lint

import: services
psql $(PG_URL) < ./data/country_name.sql
./bin/imposm import -appendcache \
-diff \
-cachedir /media/ber/ExtraDrive1/OSM/imposm3/ \
-diffdir /media/ber/ExtraDrive1/OSM/updates/ \
-connection $(PG_URL) \
-mapping mapping.yml \
-read $(OSM_FILE) \
-write \
-deployproduction

console:
psql $(PG_URL)

count:
psql $(PG_URL) --command='select count(*) as cnt from import.osm_all'

# Setup docker instance
install:
touch $(ENV_FILE)
docker run --name pbx_hours_development -e POSTGRES_PASS=$(POSTGRES_PASSWORD) -e POSTGRES_USER=postgres -e POSTGRES_DBNAME=$(DB_NAME) -p5432:5432 -d -t kartoza/postgis

services:
docker start pbx_hours_development

server:
npx ./bin/server
# The first rule in a Makefile is the one executed by default ("make"). It
# should always be the "all" rule, so that "make" and "make all" are identical.
all: test

# CUSTOM BUILD RULES
test:
npx mocha --recursive
$(CMD_PREFIX) ruby -I test test/**/*_test.rb

clean:
docker stop pbx_hours_development
docker rm pbx_hours_development
rm -r /tmp/imposm3/
# noop

##
# Set up the project for building
setup: ruby packages

lint:
npx standard
ruby:
bundle install

doc:
npx documentation build **.js -f html -o doc
npx redoc-cli bundle doc/swagger.yml --output doc/api.html
packages:
sudo apt install ruby

Loading…
Cancel
Save