extract setICUEnvVariable() to it's own module
This commit is contained in:
parent
4d11403be2
commit
ae48a01e26
13
app.js
13
app.js
@ -4,7 +4,7 @@ var path = require('path');
|
||||
var fs = require('fs');
|
||||
var _ = require('underscore');
|
||||
var semver = require('semver');
|
||||
const glob = require('glob');
|
||||
const setICUEnvVariable = require('./lib/cartodb/utils/icu_data_env_setter');
|
||||
|
||||
// jshint undef:false
|
||||
var log = console.log.bind(console);
|
||||
@ -17,18 +17,7 @@ if (!semver.satisfies(nodejsVersion, '>=6.9.0')) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// See https://github.com/CartoDB/support/issues/984
|
||||
// CartoCSS properties text-wrap-width/text-wrap-character not working
|
||||
// This function should be called before the require('yargs').
|
||||
function setICUEnvVariable() {
|
||||
if (process.env.ICU_DATA === undefined) {
|
||||
let directory = glob.sync(__dirname + '/node_modules/mapnik/lib/binding/*/share/mapnik/icu/');
|
||||
|
||||
if (directory && directory.length > 0) {
|
||||
process.env.ICU_DATA = directory[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
setICUEnvVariable();
|
||||
|
||||
var argv = require('yargs')
|
||||
|
18
lib/cartodb/utils/icu_data_env_setter.js
Normal file
18
lib/cartodb/utils/icu_data_env_setter.js
Normal file
@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
|
||||
// See https://github.com/CartoDB/support/issues/984
|
||||
// CartoCSS properties text-wrap-width/text-wrap-character not working
|
||||
function setICUEnvVariable() {
|
||||
if (process.env.ICU_DATA === undefined) {
|
||||
let directory = glob.sync(path.join(__dirname, '../../..', '/node_modules/mapnik/lib/binding/*/share/mapnik/icu/'));
|
||||
|
||||
if (directory && directory.length > 0) {
|
||||
process.env.ICU_DATA = directory[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = setICUEnvVariable;
|
@ -15,22 +15,13 @@ var redis = require('redis');
|
||||
var nock = require('nock');
|
||||
var log4js = require('log4js');
|
||||
var pg = require('pg');
|
||||
const setICUEnvVariable = require('../../lib/cartodb/utils/icu_data_env_setter');
|
||||
|
||||
// set environment specific variables
|
||||
global.environment = require(__dirname + '/../../config/environments/test');
|
||||
global.environment.name = 'test';
|
||||
process.env.NODE_ENV = 'test';
|
||||
|
||||
// See https://github.com/CartoDB/support/issues/984
|
||||
// CartoCSS properties text-wrap-width/text-wrap-character not working
|
||||
function setICUEnvVariable() {
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
let directory = glob.sync(path.join(__dirname, '../..', '/node_modules/mapnik/lib/binding/*/share/mapnik/icu/'));
|
||||
if (directory && directory.length > 0) {
|
||||
process.env.ICU_DATA = directory[0];
|
||||
}
|
||||
}
|
||||
setICUEnvVariable();
|
||||
|
||||
// don't output logs in test environment to reduce noise
|
||||
|
Loading…
Reference in New Issue
Block a user