diff options
-rwxr-xr-x | sources/merkaartor/import_merkaartor.rb | 65 | ||||
-rw-r--r-- | sources/merkaartor/post.sql | 12 | ||||
-rw-r--r-- | sources/merkaartor/pre.sql | 74 | ||||
-rwxr-xr-x | sources/merkaartor/update.sh | 53 |
4 files changed, 0 insertions, 204 deletions
diff --git a/sources/merkaartor/import_merkaartor.rb b/sources/merkaartor/import_merkaartor.rb deleted file mode 100755 index 4f0ad4b..0000000 --- a/sources/merkaartor/import_merkaartor.rb +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/ruby -#------------------------------------------------------------------------------ -# -# Taginfo source: Merkaartor -# -# import_merkaartor.rb -# -#------------------------------------------------------------------------------ -# -# Copyright (C) 2013 Jochen Topf <jochen@remote.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -#------------------------------------------------------------------------------ - -require 'pp' -require 'sqlite3' -require 'rexml/document' - -dir = ARGV[0] || '.' -db = SQLite3::Database.new(dir + '/taginfo-merkaartor.db') - -#------------------------------------------------------------------------------ - -template = 'default' - -db.transaction do |db| - db.execute('INSERT INTO templates (name) VALUES (?)', template) - - file = File.new(dir + '/git-source/Templates/' + template + '.mat') - doc = REXML::Document.new(file) - - doc.elements.each('/templates/widgets/widget') do |widget| - key = widget.attributes['tag'] - link = widget.elements['link'].attributes['src'] if widget.elements['link'] - selector = widget.elements['selector'].attributes['expr'] if widget.elements['selector'] - db.execute('INSERT INTO keys (template, key, tag_type, link, selector) VALUES (?, ?, ?, ?, ?)', template, key, widget.attributes['type'], link, selector) - widget.elements.each('description') do |desc| - db.execute('INSERT INTO key_descriptions (template, key, lang, description) VALUES (?, ?, ?, ?)', template, key, desc.attributes['locale'], desc.text) - end - widget.elements.each('value') do |valelement| - value = valelement.attributes['tag'] - vlink = valelement.elements['link'].attributes['src'] if valelement.elements['link'] - db.execute('INSERT INTO tags (template, key, value, link) VALUES (?, ?, ?, ?)', template, key, value, vlink) - widget.elements.each('description') do |desc| - db.execute('INSERT INTO tag_descriptions (template, key, value, lang, description) VALUES (?, ?, ?, ?, ?)', template, key, value, desc.attributes['locale'], desc.text) - end - end - end -end - - -#-- THE END ------------------------------------------------------------------- diff --git a/sources/merkaartor/post.sql b/sources/merkaartor/post.sql deleted file mode 100644 index 06bcef0..0000000 --- a/sources/merkaartor/post.sql +++ /dev/null @@ -1,12 +0,0 @@ --- --- Taginfo source: Merkaartor --- --- post.sql --- - -.bail ON - -ANALYZE; - -UPDATE source SET update_end=datetime('now'); - diff --git a/sources/merkaartor/pre.sql b/sources/merkaartor/pre.sql deleted file mode 100644 index 76d8012..0000000 --- a/sources/merkaartor/pre.sql +++ /dev/null @@ -1,74 +0,0 @@ --- --- Taginfo source: Merkaartor --- --- pre.sql --- - -.bail ON - -INSERT INTO source (id, name, update_start, data_until) SELECT 'merkaartor', 'Merkaartor', datetime('now'), datetime('now'); - --- --- templates --- - -DROP TABLE IF EXISTS templates; - -CREATE TABLE templates ( - name TEXT -); - --- --- keys --- - -DROP TABLE IF EXISTS keys; - -CREATE TABLE keys ( - template TEXT, - key TEXT, - tag_type TEXT, - link TEXT, - selector TEXT -); - --- --- key_descriptions --- - -DROP TABLE IF EXISTS key_descriptions; - -CREATE TABLE key_descriptions ( - template TEXT, - key TEXT, - lang TEXT, - description TEXT -); - --- --- tags --- - -DROP TABLE IF EXISTS tags; - -CREATE TABLE tags ( - template TEXT, - key TEXT, - value TEXT, - link TEXT -); - --- --- tag_descriptions --- - -DROP TABLE IF EXISTS tag_descriptions; - -CREATE TABLE tag_descriptions ( - template TEXT, - key TEXT, - value TEXT, - lang TEXT, - description TEXT -); - diff --git a/sources/merkaartor/update.sh b/sources/merkaartor/update.sh deleted file mode 100755 index 8d68de7..0000000 --- a/sources/merkaartor/update.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Taginfo source: Merkaartor -# -# update.sh DIR -# - -set -e - -DIR=$1 - -DATECMD='date +%Y-%m-%dT%H:%M:%S' - -if [ "x" = "x$DIR" ]; then - echo "Usage: update.sh DIR" - exit 1 -fi - -echo "`$DATECMD` Start merkaartor..." - -EXEC_RUBY="$TAGINFO_RUBY" -if [ "x$EXEC_RUBY" = "x" ]; then - EXEC_RUBY=ruby -fi -echo "Running with ruby set as '${EXEC_RUBY}'" - -DATABASE=$DIR/taginfo-merkaartor.db - -rm -f $DATABASE - -echo "`$DATECMD` Updating resources..." -if [ -d $DIR/git-source ]; then - cd $DIR/git-source - git pull - cd - -else - git clone http://git.gitorious.org/merkaartor/main.git $DIR/git-source -fi - -echo "`$DATECMD` Running init.sql..." -sqlite3 $DATABASE <../init.sql - -echo "`$DATECMD` Running pre.sql..." -sqlite3 $DATABASE <pre.sql - -echo "`$DATECMD` Running import..." -$EXEC_RUBY ./import_merkaartor.rb $DIR - -echo "`$DATECMD` Running post.sql..." -sqlite3 $DATABASE <post.sql - -echo "`$DATECMD` Done merkaartor." - |