[Groonga-commit] groonga/gcs [master] Reduce unnessesary codes from command line interface

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Oct 22 10:45:49 JST 2012


YUKI Hiroshi	2012-10-22 10:45:49 +0900 (Mon, 22 Oct 2012)

  New Revision: c295c905b887bfad266bc1278f19c0a2d9ec84ef
  https://github.com/groonga/gcs/commit/c295c905b887bfad266bc1278f19c0a2d9ec84ef

  Log:
    Reduce unnessesary codes from command line interface

  Modified files:
    lib/command-line.js

  Modified: lib/command-line.js (+0 -35)
===================================================================
--- lib/command-line.js    2012-10-22 10:21:47 +0900 (5ed7e05)
+++ lib/command-line.js    2012-10-22 10:45:49 +0900 (917905d)
@@ -1,12 +1,7 @@
 var program = require('commander');
-var nroonga = require('./wrapped-nroonga');
-var Domain = require('./database/domain').Domain;
 var version = require('../package').version;
 var path = require('path');
 
-var defaultDatabasePath =
-      exports.defaultDatabasePath =
-      CommandLineInterface.defaultDatabasePath = process.env.GCS_DATABASE_PATH || process.env.HOME + '/.gcs/database/gcs';
 var defaultPort =
       exports.defaultPort =
       CommandLineInterface.defaultPort = process.env.GCS_PORT || 7575;
@@ -40,17 +35,6 @@ CommandLineInterface.prototype = {
     return this.options.baseHost.split(':')[1] || this.options.port;
   },
 
-  get databasePath() {
-    return this.options.databasePath || defaultDatabasePath;
-  },
-  get context() {
-    return this._context ||
-           (this._context = new nroonga.Context(this.databasePath));
-  },
-  get domain() {
-    return this._domain ||
-           (this._domain = new Domain(this.options.domainName, this.context));
-  },
   get options() {
     return this.program;
   },
@@ -68,12 +52,6 @@ CommandLineInterface.prototype = {
     }, this);
 
     this.program
-      .option('--database-path <path>',
-              'database path' +
-                '(GCS_DATABASE_PATH) ' +
-                '[' + defaultDatabasePath + ']',
-              String,
-              defaultDatabasePath)
       .option('-p, --port <port>',
               'specify port' +
                 '(GCS_PORT) ' +
@@ -117,17 +95,6 @@ CommandLineInterface.prototype = {
     process.exit(1);
   },
 
-  assertHaveDomainName: function() {
-    if (!this.domainName)
-      this.raiseFatalError('You must specify the domain name.');
-    return this;
-  },
-  assertDomainExists: function() {
-    if (!this.domain.exists())
-      this.raiseFatalError(this.domainName + ' does not exist. You must specify an existing domain name.');
-    return this;
-  },
-
   hasOption: function(option) {
     return this.program.rawArgs.indexOf('--' + option) > -1 ||
            this.program.rawArgs.indexOf('-' + option) > -1;
@@ -145,5 +112,3 @@ exports.CommandLineInterface = CommandLineInterface;
 CommandLineInterface.resolve = function(possibleRelativePath) {
   return path.resolve(process.cwd(), possibleRelativePath);
 };
-
-exports.Domain = CommandLineInterface.Domain = Domain;
-------------- next part --------------
HTML����������������������������...
Download 



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