[kosmtik] Initial import of kosmtik

Tom Hughes tomh at fedoraproject.org
Mon Dec 8 14:38:42 UTC 2014


commit 3e724e9c1f7ce23280bf261f62e3373e1a82a53b
Author: Tom Hughes <tom at compton.nu>
Date:   Mon Dec 8 14:38:40 2014 +0000

    Initial import of kosmtik

 .gitignore            |    1 +
 kosmtik-fonts.patch   |   68 +++++++++++++++++++++++++++++
 kosmtik-geojson.patch |   40 +++++++++++++++++
 kosmtik-pbf.patch     |   26 +++++++++++
 kosmtik.spec          |  112 +++++++++++++++++++++++++++++++++++++++++++++++++
 sources               |    1 +
 6 files changed, 248 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..cab9c0d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/kosmtik-0.0.9.tgz
diff --git a/kosmtik-fonts.patch b/kosmtik-fonts.patch
new file mode 100644
index 0000000..4bc7e3e
--- /dev/null
+++ b/kosmtik-fonts.patch
@@ -0,0 +1,68 @@
+commit 6b41cbacd710e5c5713e694fa89b409295cb4e40
+Author: Tom Hughes <tom at compton.nu>
+Date:   Mon Dec 8 10:12:15 2014 +0000
+
+    Use system fonts
+
+diff --git a/src/back/PreviewServer.js b/src/back/PreviewServer.js
+index c25824f..7a6b2cb 100644
+--- a/src/back/PreviewServer.js
++++ b/src/back/PreviewServer.js
+@@ -15,6 +15,7 @@ var http = require('http'),
+         '.jpg' : 'image/jpeg',
+         '.woff' : 'application/octet-stream',
+         '.ttf' : 'application/octet-stream',
++        '.otf' : 'application/octet-stream',
+         '.svg' : 'image/svg+xml'
+     };
+ 
+diff --git a/src/front/Core.css b/src/front/Core.css
+index f3e6bc6..843954c 100644
+--- a/src/front/Core.css
++++ b/src/front/Core.css
+@@ -5,10 +5,7 @@
+ 
+ @font-face {
+     font-family: 'fira_sansbold';
+-    src: url('./fonts/FiraSans-Bold.eot');
+-    src: url('./fonts/FiraSans-Bold.eot?#iefix') format('embedded-opentype'),
+-         url('./fonts/FiraSans-Bold.woff') format('woff'),
+-         url('./fonts/FiraSans-Bold.ttf') format('truetype');
++    src: url('./fonts/FiraSansOT-Bold.otf');
+     font-weight: normal;
+     font-style: normal;
+ 
+@@ -17,30 +14,21 @@
+ 
+ @font-face {
+     font-family: 'fira_sansregular';
+-    src: url('./fonts/FiraSans-Regular.eot');
+-    src: url('./fonts/FiraSans-Regular.eot?#iefix') format('embedded-opentype'),
+-         url('./fonts/FiraSans-Regular.woff') format('woff'),
+-         url('./fonts/FiraSans-Regular.ttf') format('truetype');
++    src: url('./fonts/FiraSansOT-Regular.otf');
+     font-weight: normal;
+     font-style: normal;
+ }
+ 
+ @font-face {
+     font-family: 'fira_sanslight';
+-    src: url('./fonts/FiraSans-Light.eot');
+-    src: url('./fonts/FiraSans-Light.eot?#iefix') format('embedded-opentype'),
+-         url('./fonts/FiraSans-Light.woff') format('woff'),
+-         url('./fonts/FiraSans-Light.ttf') format('truetype');
++    src: url('./fonts/FiraSansOT-Light.otf');
+     font-weight: normal;
+     font-style: normal;
+ }
+ 
+ @font-face {
+     font-family: 'dejavu_sansbook';
+-    src: url('./fonts/DejaVuSans-webfont.eot');
+-    src: url('./fonts/DejaVuSans-webfont.eot?#iefix') format('embedded-opentype'),
+-         url('./fonts/DejaVuSans-webfont.woff') format('woff'),
+-         url('./fonts/DejaVuSans-webfont.ttf') format('truetype');
++    src: url('./fonts/DejaVuSans.ttf');
+     font-weight: normal;
+     font-style: normal;
+ 
diff --git a/kosmtik-geojson.patch b/kosmtik-geojson.patch
new file mode 100644
index 0000000..068a993
--- /dev/null
+++ b/kosmtik-geojson.patch
@@ -0,0 +1,40 @@
+commit 8e6e20fc9d413ef59e8d19c8c51a8757ccc5d16b
+Author: Tom Hughes <tom at compton.nu>
+Date:   Wed Nov 26 10:36:59 2014 +0100
+
+    Make GeoJSON comparison more robust
+
+diff --git a/test/tile.js b/test/tile.js
+index e9680a4..8eabfbb 100644
+--- a/test/tile.js
++++ b/test/tile.js
+@@ -5,6 +5,20 @@ var Config = require('../src/Config.js').Config,
+     assert = require('assert'),
+     mapnik = require('mapnik');
+ 
++var trunc_6 = function(key, val) {
++    return val.toFixed ? Number(val.toFixed(6)) : val;
++}
++
++function compareGeoJSON(json1, json2) {
++    if (typeof json1 === 'string') json1 = JSON.parse(json1);
++    if (typeof json2 === 'string') json2 = JSON.parse(json2);
++
++    json1 = JSON.parse(JSON.stringify(json1, trunc_6));
++    json2 = JSON.parse(JSON.stringify(json2, trunc_6));
++
++    return assert.deepEqual(json1, json2);
++}
++
+ describe('#Tile()', function () {
+     var config, project, map;
+ 
+@@ -50,7 +64,7 @@ describe('#Tile()', function () {
+             var tile = new Tile(6, 19, 28);
+             tile.renderToVector(project, map, function (err, vtile) {
+                 if (err) throw err;
+-                assert.equal(vtile.toGeoJSON('__all__'), fs.readFileSync('test/data/expected/tile.world.6.19.28.geojson'));
++                compareGeoJSON(vtile.toGeoJSON('__all__'), JSON.parse(fs.readFileSync('test/data/expected/tile.world.6.19.28.geojson')));
+                 done();
+             });
+         });
diff --git a/kosmtik-pbf.patch b/kosmtik-pbf.patch
new file mode 100644
index 0000000..88e0145
--- /dev/null
+++ b/kosmtik-pbf.patch
@@ -0,0 +1,26 @@
+commit 09ff91ce431cf499e030b6f47097efe6397674aa
+Author: Tom Hughes <tom at compton.nu>
+Date:   Wed Nov 26 18:56:24 2014 +0000
+
+    Drop PBF test for now as it is not reliable
+
+diff --git a/test/tile.js b/test/tile.js
+index 8eabfbb..21e7376 100644
+--- a/test/tile.js
++++ b/test/tile.js
+@@ -69,15 +69,6 @@ describe('#Tile()', function () {
+             });
+         });
+ 
+-        it('should render a PBF', function (done) {
+-            var tile = new Tile(6, 19, 28);
+-            tile.renderToVector(project, map, function (err, vtile) {
+-                if (err) throw err;
+-                assert.deepEqual(vtile.getData(), fs.readFileSync('test/data/expected/tile.world.6.19.28.pbf'));
+-                done();
+-            });
+-        });
+-
+     });
+ 
+ });
diff --git a/kosmtik.spec b/kosmtik.spec
new file mode 100644
index 0000000..6d0810d
--- /dev/null
+++ b/kosmtik.spec
@@ -0,0 +1,112 @@
+Name:           kosmtik
+Version:        0.0.9
+Release:        2%{?dist}
+Summary:        Make maps with OpenStreetMap and Mapnik
+
+License:        WTFPL
+URL:            https://github.com/kosmtik/kosmtik
+Source0:        http://registry.npmjs.org/kosmtik/-/kosmtik-%{version}.tgz
+# https://github.com/kosmtik/kosmtik/issues/21
+Patch0:         kosmtik-geojson.patch
+# https://github.com/kosmtik/kosmtik/issues/22
+Patch1:         kosmtik-pbf.patch
+# Use system fonts
+Patch2:         kosmtik-fonts.patch
+BuildArch:      noarch
+ExclusiveArch:  %{nodejs_arches} noarch
+
+Requires:       font(dejavusans)
+Requires:       font(firasansot)
+Requires:       font(firasansotlight)
+
+BuildRequires:  nodejs-packaging
+
+BuildRequires:  npm(mocha)
+BuildRequires:  npm(carto)
+BuildRequires:  npm(generic-pool)
+BuildRequires:  npm(js-yaml)
+BuildRequires:  npm(mapnik)
+BuildRequires:  npm(nomnom)
+BuildRequires:  npm(npm)
+BuildRequires:  npm(request)
+
+%description
+Very lite but extendable mapping framework to create Mapnik
+ready maps with OpenStreetMap data (and more).
+
+For now, only Carto based projects are supported (with .mml or
+.yml config), but in the future we hope to plug in MapCSS too.
+
+
+%prep
+%setup -q -n package
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%nodejs_fixdep generic-pool "^2.0.3"
+%nodejs_fixdep js-yaml "^2.1.3"
+%nodejs_fixdep mapnik-pool "^0.1.0"
+%nodejs_fixdep npm "^1.3.6"
+%nodejs_fixdep request "^2.25.0"
+%nodejs_fixdep semver "^2.1.0"
+rm -rf node_modules src/front/fonts
+
+
+%build
+
+
+%install
+mkdir -p %{buildroot}%{nodejs_sitelib}/kosmtik
+cp -pr package.json index.js %{buildroot}%{nodejs_sitelib}/kosmtik
+mkdir -p %{buildroot}%{nodejs_sitelib}/kosmtik/src
+mkdir -p %{buildroot}%{_datadir}/kosmtik
+pushd src
+  for file in $(find . -type f -name '*.js' -print)
+  do
+    cp -p --parents "${file}" "%{buildroot}%{nodejs_sitelib}/kosmtik/src"
+  done
+  for file in $(find . -type f ! -name '*.js' -print)
+  do
+    cp -p --parents "${file}" "%{buildroot}%{_datadir}/kosmtik"
+    ln -s "%{_datadir}/kosmtik/${file}" "%{buildroot}%{nodejs_sitelib}/kosmtik/src/${file}"
+  done
+popd
+mkdir -p %{buildroot}%{_datadir}/kosmtik/front/fonts
+ln -s %{_datadir}/fonts/dejavu/DejaVuSans.ttf %{buildroot}%{_datadir}/kosmtik/front/fonts
+ln -s %{_datadir}/fonts/mozilla-fira/FiraSansOT-Bold.otf %{buildroot}%{_datadir}/kosmtik/front/fonts
+ln -s %{_datadir}/fonts/mozilla-fira/FiraSansOT-Light.otf %{buildroot}%{_datadir}/kosmtik/front/fonts
+ln -s %{_datadir}/fonts/mozilla-fira/FiraSansOT-Regular.otf %{buildroot}%{_datadir}/kosmtik/front/fonts
+ln -s %{_datadir}/kosmtik/front/fonts %{buildroot}%{nodejs_sitelib}/kosmtik/src/front
+mkdir -p %{buildroot}%{_bindir}
+ln -s %{nodejs_sitelib}/kosmtik/index.js %{buildroot}%{_bindir}/kosmtik
+%nodejs_symlink_deps
+
+
+%check
+%nodejs_symlink_deps --check
+%{nodejs_sitelib}/mocha/bin/mocha
+
+
+%files
+%doc README.md
+%{nodejs_sitelib}/kosmtik
+%{_datadir}/kosmtik
+%{_bindir}/kosmtik
+
+
+%changelog
+* Mon Dec  8 2014 Tom Hughes <tom at compton.nu> - 0.0.9-2
+- Remove fonts from package
+- Move non-js files to %%{_datadir}
+
+* Wed Nov 26 2014 Tom Hughes <tom at compton.nu> - 0.0.9-1
+- Update to 0.0.9 upstream release
+
+* Sun Nov 16 2014 Tom Hughes <tom at compton.nu> - 0.0.8-2
+- Add patch to support projects in the current directory
+
+* Sun Nov 16 2014 Tom Hughes <tom at compton.nu> - 0.0.8-1
+- Update to 0.0.8 upstream release
+
+* Sat Nov 15 2014 Tom Hughes <tom at compton.nu> - 0.0.7-1
+- Initial build of 0.0.7
diff --git a/sources b/sources
index e69de29..aeee3c4 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+30390d505b83bd5a23e61f1008586db3  kosmtik-0.0.9.tgz


More information about the scm-commits mailing list