tml-server
Advanced tools
Comparing version 0.4.1 to 0.4.4
@@ -32,4 +32,3 @@ /** | ||
var fs = require('fs-extra'); | ||
var tml = require('tml-js'); | ||
var tml = require('tml-js'); | ||
@@ -44,2 +43,3 @@ /** | ||
this.config = config || {}; | ||
this.fs = require('fs-extra'); | ||
}; | ||
@@ -70,3 +70,3 @@ | ||
fs.exists(file_path, function (exists) { | ||
self.fs.exists(file_path, function (exists) { | ||
if (!exists) { | ||
@@ -76,3 +76,3 @@ self.info("Cache miss " + key); | ||
} else { | ||
fs.readFile(file_path, 'utf8', function (err, data) { | ||
self.fs.readFile(file_path, 'utf8', function (err, data) { | ||
if (data) { | ||
@@ -97,3 +97,3 @@ self.info("cache hit " + key); | ||
if (!fs.exists(file_path)) { | ||
if (!self.fs.exists(file_path)) { | ||
self.info("Cache miss " + key); | ||
@@ -105,3 +105,3 @@ value = (typeof def == "function") ? def() : def || null; | ||
fs.readFile(file_path, 'utf8', function (err, data) { | ||
self.fs.readFile(file_path, 'utf8', function (err, data) { | ||
if (err) { | ||
@@ -170,5 +170,5 @@ self.info("Cache miss " + key); | ||
var source_path = self.getVersionedPath() + "/" + locale + "/sources"; | ||
fs.ensureDir(source_path, function() { | ||
self.fs.ensureDir(source_path, function() { | ||
var source_file = source_path + "/" + source.source + ".json"; | ||
fs.writeFile(source_file, JSON.stringify(data), function(err) { | ||
self.fs.writeFile(source_file, JSON.stringify(data), function(err) { | ||
if (err) { | ||
@@ -210,4 +210,4 @@ console.log(err); | ||
var language_path = self.getVersionedPath() + "/" + locale; | ||
fs.ensureDir(language_path, function() { | ||
fs.writeFile(language_path + "/language.json", JSON.stringify(data), function(err) { | ||
self.fs.ensureDir(language_path, function() { | ||
self.fs.writeFile(language_path + "/language.json", JSON.stringify(data), function(err) { | ||
if (err) { | ||
@@ -263,4 +263,4 @@ console.log(err); | ||
fs.ensureDir(self.getVersionedPath(), function() { | ||
fs.writeFile(self.getVersionedPath() + "/application.json", JSON.stringify(data), function(err) { | ||
self.fs.ensureDir(self.getVersionedPath(), function() { | ||
self.fs.writeFile(self.getVersionedPath() + "/application.json", JSON.stringify(data), function(err) { | ||
if (err) { | ||
@@ -281,4 +281,4 @@ console.log(err); | ||
var current_path = self.basePath() + '/current'; | ||
fs.unlink(current_path, function() { | ||
fs.symlink(self.getCurrentVersion(), current_path, function() { | ||
self.fs.unlink(current_path, function() { | ||
self.fs.symlink(self.getCurrentVersion(), current_path, function() { | ||
callback(); | ||
@@ -285,0 +285,0 @@ }); |
@@ -32,3 +32,2 @@ /** | ||
var memcached = require("memcached"); | ||
var tml = require('tml-js'); | ||
@@ -63,2 +62,3 @@ | ||
create: function() { | ||
var memcached = require("memcached"); | ||
return new memcached(this.config.hosts, this.config.options); | ||
@@ -65,0 +65,0 @@ }, |
@@ -32,3 +32,2 @@ /** | ||
var redis = require("redis"); | ||
var tml = require('tml-js'); | ||
@@ -60,2 +59,3 @@ | ||
create: function() { | ||
var redis = require("redis"); | ||
return redis.createClient(this.config.port, this.config.host, this.config.options || {}); | ||
@@ -62,0 +62,0 @@ }, |
{ | ||
"name": "tml-server", | ||
"description": "Translation Markup Language for Server-Side Integrations", | ||
"version": "0.4.1", | ||
"version": "0.4.4", | ||
"author": { | ||
@@ -39,31 +39,31 @@ "name": "Michael Berkovich", | ||
"dependencies": { | ||
"tml-js": "~0.4.1", | ||
"request": "~2.61.0" | ||
"tml-js": "~0.4.1", | ||
"request": "~2.61.0" | ||
}, | ||
"devDependencies": { | ||
"blanket": "~1.1.7", | ||
"coveralls": "~2.11.4", | ||
"grunt": "~0.4.5", | ||
"grunt-blanket": "~0.0.8", | ||
"grunt-contrib-clean": "~0.6.0", | ||
"grunt-contrib-copy": "~0.8.0", | ||
"blanket": "~1.1.7", | ||
"coveralls": "~2.11.4", | ||
"grunt": "~0.4.5", | ||
"grunt-blanket": "~0.0.8", | ||
"grunt-contrib-clean": "~0.6.0", | ||
"grunt-contrib-copy": "~0.8.0", | ||
"grunt-contrib-jshint": "~0.11.3", | ||
"grunt-contrib-uglify": "~0.7.0", | ||
"grunt-contrib-watch": "~0.6.1", | ||
"grunt-coveralls": "~1.0.0", | ||
"grunt-jsdoc": "~0.5.8", | ||
"grunt-karma": "~0.10.1", | ||
"grunt-mocha-test": "~0.12.7", | ||
"karma": "~0.12.37", | ||
"memcached": "~2.2.0", | ||
"redis": "~0.12.1", | ||
"redis-mock": "~0.4.9", | ||
"mocha": "~2.3.2", | ||
"mocha-lcov-reporter": "~0.0.1", | ||
"object-keys": "~1.0.7", | ||
"phantomjs": "~1.9.15", | ||
"proxyquire": "~1.7.2", | ||
"should": "~4.6.5", | ||
"travis-cov": "~0.2.5" | ||
"grunt-contrib-watch": "~0.6.1", | ||
"grunt-coveralls": "~1.0.0", | ||
"grunt-jsdoc": "~0.5.8", | ||
"grunt-karma": "~0.10.1", | ||
"grunt-mocha-test": "~0.12.7", | ||
"karma": "~0.12.37", | ||
"memcached": "~2.2.0", | ||
"redis": "~0.12.1", | ||
"redis-mock": "~0.4.9", | ||
"mocha": "~2.3.2", | ||
"mocha-lcov-reporter": "~0.0.1", | ||
"object-keys": "~1.0.7", | ||
"phantomjs": "~1.9.15", | ||
"proxyquire": "~1.7.2", | ||
"should": "~4.6.5", | ||
"travis-cov": "~0.2.5" | ||
} | ||
} | ||
} |
29955
10