[Groonga-commit] groonga/gcs at 0e32fd3 [master] Suppress warnings

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Mar 1 14:38:06 JST 2014


Kouhei Sutou	2014-03-01 14:38:06 +0900 (Sat, 01 Mar 2014)

  New Revision: 0e32fd3f6ca217b1f5d79657034be8f04ef481a9
  https://github.com/groonga/gcs/commit/0e32fd3f6ca217b1f5d79657034be8f04ef481a9

  Message:
    Suppress warnings
    
        path.existsSync is now called `fs.existsSync`.

  Modified files:
    lib/database/storage.js
    lib/rm.js
    lib/server.js
    test/database-storage.js
    test/test-utils.js

  Modified: lib/database/storage.js (+4 -4)
===================================================================
--- lib/database/storage.js    2012-12-26 13:05:22 +0900 (9200151)
+++ lib/database/storage.js    2014-03-01 14:38:06 +0900 (9e3b625)
@@ -39,7 +39,7 @@ FileStorage.prototype = {
     mkdirp.sync(this.directoryPath, 0700);
 
     var filePath = this.idToFilePath(document.id);
-    if (path.existsSync(filePath))
+    if (fs.existsSync(filePath))
       fs.unlinkSync(filePath);
 
     var contents = JSON.stringify(document);
@@ -53,7 +53,7 @@ FileStorage.prototype = {
       return null;
 
     var filePath = this.idToFilePath(id);
-    if (!path.existsSync(filePath))
+    if (!fs.existsSync(filePath))
       return null;
 
     var contents = fs.readFileSync(filePath, 'UTF-8');
@@ -65,7 +65,7 @@ FileStorage.prototype = {
       return;
 
     var filePath = this.idToFilePath(id);
-    if (path.existsSync(filePath))
+    if (fs.existsSync(filePath))
       fs.unlinkSync(filePath);
   },
 
@@ -75,7 +75,7 @@ FileStorage.prototype = {
   },
 
   directoryExistsSync: function() {
-    return path.existsSync(this.directoryPath);
+    return fs.existsSync(this.directoryPath);
   }
 };
 exports.FileStorage = FileStorage;

  Modified: lib/rm.js (+1 -1)
===================================================================
--- lib/rm.js    2012-12-26 13:05:22 +0900 (e24a08d)
+++ lib/rm.js    2014-03-01 14:38:06 +0900 (8f0cfe3)
@@ -6,7 +6,7 @@ function isDirectorySync(path) {
 }
 
 function rmRSync(directoryPath) {
-  if (!path.existsSync(directoryPath)) return;
+  if (!fs.existsSync(directoryPath)) return;
 
   var files = fs.readdirSync(directoryPath);
   var file, filePath;

  Modified: lib/server.js (+1 -2)
===================================================================
--- lib/server.js    2012-12-26 13:05:22 +0900 (dfe8fb5)
+++ lib/server.js    2014-03-01 14:38:06 +0900 (e57f236)
@@ -1,6 +1,5 @@
 var express = require('express');
 var fs = require('fs');
-var path = require('path');
 var nroonga = require('./wrapped-nroonga');
 var CLI = require('./command-line').CommandLineInterface;
 var logger = require('./logger');
@@ -29,7 +28,7 @@ function prepareConfigurations(config) {
 function prepareLoggers(application, config) {
   if (config.accessLogPath) {
     var accessLogPath = CLI.resolve(config.accessLogPath);
-    var accessLogFlags = path.existsSync(accessLogPath) ? 'a' : 'w';
+    var accessLogFlags = fs.existsSync(accessLogPath) ? 'a' : 'w';
     var accessLogStream = fs.createWriteStream(accessLogPath, { flags: accessLogFlags });
     application.use(express.logger({ stream: accessLogStream }));
   }

  Modified: test/database-storage.js (+7 -7)
===================================================================
--- test/database-storage.js    2012-12-26 13:05:22 +0900 (b6c68c5)
+++ test/database-storage.js    2014-03-01 14:38:06 +0900 (9d47cef)
@@ -46,9 +46,9 @@ suite('database', function() {
     test('auto creation of the data directory', function() {
       var document = createNewDocument();
       var filePath = path.join(utils.temporaryDirectory, 'storage', sha1hash(document.id));
-      assert.isFalse(path.existsSync(storage.directoryPath));
+      assert.isFalse(fs.existsSync(storage.directoryPath));
       storage.saveSync(document);
-      assert.isTrue(path.existsSync(storage.directoryPath));
+      assert.isTrue(fs.existsSync(storage.directoryPath));
     });
 
     test('saveSync for new document', function() {
@@ -56,13 +56,13 @@ suite('database', function() {
 
       var document = createNewDocument();
       var filePath = path.join(utils.temporaryDirectory, 'storage', sha1hash(document.id));
-      assert.isFalse(path.existsSync(filePath));
+      assert.isFalse(fs.existsSync(filePath));
 
       assertFilesCount(storage.directoryPath, 1, function() {
         storage.saveSync(document);
       });
 
-      assert.isTrue(path.existsSync(filePath));
+      assert.isTrue(fs.existsSync(filePath));
 
       var contents = fs.readFileSync(filePath, 'UTF-8');
       contents = JSON.parse(contents);
@@ -103,11 +103,11 @@ suite('database', function() {
       storage.saveSync(document);
 
       var filePath = path.join(utils.temporaryDirectory, 'storage', sha1hash(document.id));
-      assert.isTrue(path.existsSync(filePath));
+      assert.isTrue(fs.existsSync(filePath));
 
       assertFilesCount(storage.directoryPath, -1, function() {
         storage.deleteSync(document.id);
-        assert.isFalse(path.existsSync(filePath));
+        assert.isFalse(fs.existsSync(filePath));
       });
     });
 
@@ -125,7 +125,7 @@ suite('database', function() {
       storage.saveSync(createNewDocument());
       storage.saveSync(createNewDocument());
       storage.clearSync();
-      assert.isFalse(path.existsSync(storage.directoryPath));
+      assert.isFalse(fs.existsSync(storage.directoryPath));
     });
   });
 });

  Modified: test/test-utils.js (+1 -1)
===================================================================
--- test/test-utils.js    2012-12-26 13:05:22 +0900 (314aad5)
+++ test/test-utils.js    2014-03-01 14:38:06 +0900 (b17264a)
@@ -197,7 +197,7 @@ exports.toTimeStamp = toTimeStamp;
 function setupResponses(scenarios, date) {
   if (!date) date = new Date();
   var outputDir = path.join(temporaryDirectory, 'results.' + toTimeStamp(date));
-  if (path.existsSync(outputDir)) {
+  if (fs.existsSync(outputDir)) {
     return Deferred.next(function() {
       return outputDir;
     });
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index