jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/364416 )

Change subject: Rearrange folders - move source code to lib folder
......................................................................


Rearrange folders - move source code to lib folder

cxserver's top folder had all kind of folders. Following the pattern
of other mediawiki services, let us put all source code for cxserver
under new lib folder.

* registry/index.js - the only file inside registry folder now moved
to lib/registry.js
* util/utils.js now moved under lib folder.

No change on any functionality. All tests should pass and no change
to any APIs.

Change-Id: I6472fd5bfff6e54b41a0ca36e22c28d43aa340a0
---
M app.js
M bin/linearize
R doc/Registry.md
R lib/api-util.js
R lib/dictionary/dict/Dict.js
R lib/dictionary/dict/DictClient.js
R lib/dictionary/dict/DictRegistry.json
R lib/dictionary/dict/Readme.md
R lib/dictionary/index.js
R lib/dictionary/jsondict/JsonDict.js
R lib/dictionary/jsondict/JsonDictRegistry.json
R lib/dictionary/jsondict/dictionaries/apertium-ca-es.json
R lib/dictionary/jsondict/dictionaries/apertium-es-ca.json
R lib/dictionary/jsondict/dictionaries/freedict-eng-spa.json
R lib/index.js
R lib/lineardoc/Builder.js
R lib/lineardoc/Doc.js
R lib/lineardoc/Normalizer.js
R lib/lineardoc/Parser.js
R lib/lineardoc/TextBlock.js
R lib/lineardoc/TextChunk.js
R lib/lineardoc/Utils.js
R lib/lineardoc/index.js
R lib/mt/Apertium.js
R lib/mt/Apertium.languagenames.json
R lib/mt/MTClient.js
R lib/mt/Yandex.js
R lib/mt/Youdao.js
R lib/mt/annotationmapper/LevenshteinDistance.js
R lib/mt/annotationmapper/SubsequenceMatcher.js
R lib/mt/index.js
R lib/pageloader/PageLoader.js
R lib/registry.js
R lib/routes/doc.js
R lib/routes/info.js
R lib/routes/root.js
R lib/routes/v1.js
R lib/segmentation/CXSegmenter.js
R lib/segmentation/languages/SegmenterAm.js
R lib/segmentation/languages/SegmenterDefault.js
R lib/segmentation/languages/SegmenterHi.js
R lib/segmentation/languages/SegmenterHy.js
R lib/segmentation/languages/SegmenterJa.js
R lib/segmentation/languages/SegmenterZh.js
R lib/segmentation/languages/index.js
R lib/util.js
M test/dictionary/JsonDict.test.js
M test/index.js
M test/lineardoc/LinearDoc.test.js
M test/mt/Apertium.test.js
M test/segmentation/CXSegmenter.test.js
51 files changed, 23 insertions(+), 25 deletions(-)

Approvals:
  KartikMistry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/app.js b/app.js
index f6ddda8..648c001 100644
--- a/app.js
+++ b/app.js
@@ -6,8 +6,8 @@
        compression = require( 'compression' ),
        bodyParser = require( 'body-parser' ),
        fs = BBPromise.promisifyAll( require( 'fs' ) ),
-       sUtil = require( './utils/util' ),
-       apiUtil = require( './utils/api-util' ),
+       sUtil = require( './lib/util' ),
+       apiUtil = require( './lib/api-util' ),
        packageInfo = require( './package.json' ),
        path = require( 'path' ),
        yaml = require( 'js-yaml' );
@@ -159,7 +159,7 @@
  */
 function loadRoutes( app ) {
        // get the list of files in routes/
-       return fs.readdirAsync( __dirname + '/routes' )
+       return fs.readdirAsync( __dirname + '/lib/routes' )
                .map( function ( fname ) {
                        var route;
 
@@ -170,7 +170,7 @@
                                        return undefined;
                                }
                                // import the route file
-                               route = require( __dirname + '/routes/' + fname 
);
+                               route = require( __dirname + '/lib/routes/' + 
fname );
                                return route( app );
                        } ).then( function ( route ) {
                                if ( route === undefined ) {
diff --git a/bin/linearize b/bin/linearize
index c65b709..257717b 100755
--- a/bin/linearize
+++ b/bin/linearize
@@ -1,7 +1,7 @@
 #!/usr/bin/env node
 var script, xhtmlSource, xhtml, parser,
        fs = require( 'fs' ),
-       LinearDoc = require( __dirname + '/../lineardoc' );
+       LinearDoc = require( __dirname + '/../lib/lineardoc' );
 
 script = process.argv[ 1 ];
 if ( process.argv.length !== 3 ) {
diff --git a/registry/README.md b/doc/Registry.md
similarity index 100%
rename from registry/README.md
rename to doc/Registry.md
diff --git a/utils/api-util.js b/lib/api-util.js
similarity index 100%
rename from utils/api-util.js
rename to lib/api-util.js
diff --git a/dictionary/dict/Dict.js b/lib/dictionary/dict/Dict.js
similarity index 100%
rename from dictionary/dict/Dict.js
rename to lib/dictionary/dict/Dict.js
diff --git a/dictionary/dict/DictClient.js b/lib/dictionary/dict/DictClient.js
similarity index 100%
rename from dictionary/dict/DictClient.js
rename to lib/dictionary/dict/DictClient.js
diff --git a/dictionary/dict/DictRegistry.json 
b/lib/dictionary/dict/DictRegistry.json
similarity index 100%
rename from dictionary/dict/DictRegistry.json
rename to lib/dictionary/dict/DictRegistry.json
diff --git a/dictionary/dict/Readme.md b/lib/dictionary/dict/Readme.md
similarity index 100%
rename from dictionary/dict/Readme.md
rename to lib/dictionary/dict/Readme.md
diff --git a/dictionary/index.js b/lib/dictionary/index.js
similarity index 100%
rename from dictionary/index.js
rename to lib/dictionary/index.js
diff --git a/dictionary/jsondict/JsonDict.js 
b/lib/dictionary/jsondict/JsonDict.js
similarity index 100%
rename from dictionary/jsondict/JsonDict.js
rename to lib/dictionary/jsondict/JsonDict.js
diff --git a/dictionary/jsondict/JsonDictRegistry.json 
b/lib/dictionary/jsondict/JsonDictRegistry.json
similarity index 100%
rename from dictionary/jsondict/JsonDictRegistry.json
rename to lib/dictionary/jsondict/JsonDictRegistry.json
diff --git a/dictionary/jsondict/dictionaries/apertium-ca-es.json 
b/lib/dictionary/jsondict/dictionaries/apertium-ca-es.json
similarity index 100%
rename from dictionary/jsondict/dictionaries/apertium-ca-es.json
rename to lib/dictionary/jsondict/dictionaries/apertium-ca-es.json
diff --git a/dictionary/jsondict/dictionaries/apertium-es-ca.json 
b/lib/dictionary/jsondict/dictionaries/apertium-es-ca.json
similarity index 100%
rename from dictionary/jsondict/dictionaries/apertium-es-ca.json
rename to lib/dictionary/jsondict/dictionaries/apertium-es-ca.json
diff --git a/dictionary/jsondict/dictionaries/freedict-eng-spa.json 
b/lib/dictionary/jsondict/dictionaries/freedict-eng-spa.json
similarity index 100%
rename from dictionary/jsondict/dictionaries/freedict-eng-spa.json
rename to lib/dictionary/jsondict/dictionaries/freedict-eng-spa.json
diff --git a/index.js b/lib/index.js
similarity index 100%
rename from index.js
rename to lib/index.js
diff --git a/lineardoc/Builder.js b/lib/lineardoc/Builder.js
similarity index 100%
rename from lineardoc/Builder.js
rename to lib/lineardoc/Builder.js
diff --git a/lineardoc/Doc.js b/lib/lineardoc/Doc.js
similarity index 100%
rename from lineardoc/Doc.js
rename to lib/lineardoc/Doc.js
diff --git a/lineardoc/Normalizer.js b/lib/lineardoc/Normalizer.js
similarity index 100%
rename from lineardoc/Normalizer.js
rename to lib/lineardoc/Normalizer.js
diff --git a/lineardoc/Parser.js b/lib/lineardoc/Parser.js
similarity index 100%
rename from lineardoc/Parser.js
rename to lib/lineardoc/Parser.js
diff --git a/lineardoc/TextBlock.js b/lib/lineardoc/TextBlock.js
similarity index 100%
rename from lineardoc/TextBlock.js
rename to lib/lineardoc/TextBlock.js
diff --git a/lineardoc/TextChunk.js b/lib/lineardoc/TextChunk.js
similarity index 100%
rename from lineardoc/TextChunk.js
rename to lib/lineardoc/TextChunk.js
diff --git a/lineardoc/Utils.js b/lib/lineardoc/Utils.js
similarity index 100%
rename from lineardoc/Utils.js
rename to lib/lineardoc/Utils.js
diff --git a/lineardoc/index.js b/lib/lineardoc/index.js
similarity index 100%
rename from lineardoc/index.js
rename to lib/lineardoc/index.js
diff --git a/mt/Apertium.js b/lib/mt/Apertium.js
similarity index 100%
rename from mt/Apertium.js
rename to lib/mt/Apertium.js
diff --git a/mt/Apertium.languagenames.json b/lib/mt/Apertium.languagenames.json
similarity index 100%
rename from mt/Apertium.languagenames.json
rename to lib/mt/Apertium.languagenames.json
diff --git a/mt/MTClient.js b/lib/mt/MTClient.js
similarity index 100%
rename from mt/MTClient.js
rename to lib/mt/MTClient.js
diff --git a/mt/Yandex.js b/lib/mt/Yandex.js
similarity index 100%
rename from mt/Yandex.js
rename to lib/mt/Yandex.js
diff --git a/mt/Youdao.js b/lib/mt/Youdao.js
similarity index 100%
rename from mt/Youdao.js
rename to lib/mt/Youdao.js
diff --git a/mt/annotationmapper/LevenshteinDistance.js 
b/lib/mt/annotationmapper/LevenshteinDistance.js
similarity index 100%
rename from mt/annotationmapper/LevenshteinDistance.js
rename to lib/mt/annotationmapper/LevenshteinDistance.js
diff --git a/mt/annotationmapper/SubsequenceMatcher.js 
b/lib/mt/annotationmapper/SubsequenceMatcher.js
similarity index 100%
rename from mt/annotationmapper/SubsequenceMatcher.js
rename to lib/mt/annotationmapper/SubsequenceMatcher.js
diff --git a/mt/index.js b/lib/mt/index.js
similarity index 100%
rename from mt/index.js
rename to lib/mt/index.js
diff --git a/pageloader/PageLoader.js b/lib/pageloader/PageLoader.js
similarity index 97%
rename from pageloader/PageLoader.js
rename to lib/pageloader/PageLoader.js
index c29ed44..6a75cd4 100644
--- a/pageloader/PageLoader.js
+++ b/lib/pageloader/PageLoader.js
@@ -1,6 +1,6 @@
 'use strict';
 
-var apiUtil = require( '../utils/api-util' );
+var apiUtil = require( '../api-util' );
 
 /**
  * Cheap body extraction.
diff --git a/registry/index.js b/lib/registry.js
similarity index 100%
rename from registry/index.js
rename to lib/registry.js
diff --git a/routes/doc.js b/lib/routes/doc.js
similarity index 98%
rename from routes/doc.js
rename to lib/routes/doc.js
index a10b25f..01e0476 100644
--- a/routes/doc.js
+++ b/lib/routes/doc.js
@@ -1,6 +1,6 @@
 'use strict';
 
-var app, sUtil = require( '../utils/util' ),
+var app, sUtil = require( '../util' ),
        BBPromise = require( 'bluebird' ),
        fs = BBPromise.promisifyAll( require( 'fs' ) ),
        // Swagger-ui helpfully exports the absolute path of its dist directory
diff --git a/routes/info.js b/lib/routes/info.js
similarity index 97%
rename from routes/info.js
rename to lib/routes/info.js
index dd25d46..7574f25 100644
--- a/routes/info.js
+++ b/lib/routes/info.js
@@ -1,7 +1,7 @@
 'use strict';
 
 var app, router,
-       sUtil = require( '../utils/util' );
+       sUtil = require( '../util' );
 
 /**
  * The main router object
diff --git a/routes/root.js b/lib/routes/root.js
similarity index 94%
rename from routes/root.js
rename to lib/routes/root.js
index 291131c..f2d1177 100644
--- a/routes/root.js
+++ b/lib/routes/root.js
@@ -1,7 +1,7 @@
 'use strict';
 
 var router, app,
-       sUtil = require( '../utils/util' );
+       sUtil = require( '../util' );
 
 router = sUtil.router();
 
diff --git a/routes/v1.js b/lib/routes/v1.js
similarity index 99%
rename from routes/v1.js
rename to lib/routes/v1.js
index 8203f97..f649de9 100644
--- a/routes/v1.js
+++ b/lib/routes/v1.js
@@ -1,7 +1,7 @@
 'use strict';
 
 var app, router,
-       sUtil = require( '../utils/util' ),
+       sUtil = require( '../util' ),
        jwt = require( 'jsonwebtoken' ),
        registry;
 
diff --git a/segmentation/CXSegmenter.js b/lib/segmentation/CXSegmenter.js
similarity index 100%
rename from segmentation/CXSegmenter.js
rename to lib/segmentation/CXSegmenter.js
diff --git a/segmentation/languages/SegmenterAm.js 
b/lib/segmentation/languages/SegmenterAm.js
similarity index 100%
rename from segmentation/languages/SegmenterAm.js
rename to lib/segmentation/languages/SegmenterAm.js
diff --git a/segmentation/languages/SegmenterDefault.js 
b/lib/segmentation/languages/SegmenterDefault.js
similarity index 100%
rename from segmentation/languages/SegmenterDefault.js
rename to lib/segmentation/languages/SegmenterDefault.js
diff --git a/segmentation/languages/SegmenterHi.js 
b/lib/segmentation/languages/SegmenterHi.js
similarity index 100%
rename from segmentation/languages/SegmenterHi.js
rename to lib/segmentation/languages/SegmenterHi.js
diff --git a/segmentation/languages/SegmenterHy.js 
b/lib/segmentation/languages/SegmenterHy.js
similarity index 100%
rename from segmentation/languages/SegmenterHy.js
rename to lib/segmentation/languages/SegmenterHy.js
diff --git a/segmentation/languages/SegmenterJa.js 
b/lib/segmentation/languages/SegmenterJa.js
similarity index 100%
rename from segmentation/languages/SegmenterJa.js
rename to lib/segmentation/languages/SegmenterJa.js
diff --git a/segmentation/languages/SegmenterZh.js 
b/lib/segmentation/languages/SegmenterZh.js
similarity index 100%
rename from segmentation/languages/SegmenterZh.js
rename to lib/segmentation/languages/SegmenterZh.js
diff --git a/segmentation/languages/index.js 
b/lib/segmentation/languages/index.js
similarity index 100%
rename from segmentation/languages/index.js
rename to lib/segmentation/languages/index.js
diff --git a/utils/util.js b/lib/util.js
similarity index 100%
rename from utils/util.js
rename to lib/util.js
diff --git a/test/dictionary/JsonDict.test.js b/test/dictionary/JsonDict.test.js
index 63b02be..e9e9258 100644
--- a/test/dictionary/JsonDict.test.js
+++ b/test/dictionary/JsonDict.test.js
@@ -2,7 +2,7 @@
 
 var assert = require( '../utils/assert.js' ),
        server = require( '../utils/server.js' ),
-       Dictionary = require( '../../dictionary' );
+       Dictionary = require( '../../lib/dictionary' );
 
 describe( 'JsonDict', function () {
 
diff --git a/test/index.js b/test/index.js
index 35aeba4..8776d2c 100644
--- a/test/index.js
+++ b/test/index.js
@@ -5,16 +5,14 @@
        lint = require( 'mocha-eslint' );
 
 paths = [
-       'dictionary',
-       'mt',
-       'lineardoc',
-       'pageloader',
-       'registry',
-       'routes',
-       'segmentation',
-       'utils',
-       'tests/**/*.js',
-       '*.js'
+       'lib/*.js',
+       'lib/dictionary',
+       'lib/lineardoc',
+       'lib/mt',
+       'lib/pageloader',
+       'lib/routes',
+       'lib/segmentation',
+       'tests/**/*.js'
 ];
 
 // Run the tests
diff --git a/test/lineardoc/LinearDoc.test.js b/test/lineardoc/LinearDoc.test.js
index ca397e9..9035051 100644
--- a/test/lineardoc/LinearDoc.test.js
+++ b/test/lineardoc/LinearDoc.test.js
@@ -1,7 +1,7 @@
 'use strict';
 
 var assert = require( '../utils/assert.js' ),
-       LinearDoc = require( '../../lineardoc' ),
+       LinearDoc = require( '../../lib/lineardoc' ),
        fs = require( 'fs' ),
        transTests = require( __dirname + '/translate.test.json' );
 
diff --git a/test/mt/Apertium.test.js b/test/mt/Apertium.test.js
index 722c8bf..4989651 100644
--- a/test/mt/Apertium.test.js
+++ b/test/mt/Apertium.test.js
@@ -5,7 +5,7 @@
        server = require( '../utils/server.js' ),
        BBPromise = require( 'bluebird' ),
        async = require( 'async' ),
-       Apertium = require( '../../mt' ).Apertium;
+       Apertium = require( '../../lib/mt' ).Apertium;
 
 // In each case, below, just "source" and "textTranslations" should be 
sufficient for linearDoc
 // to derive "target".  // The plaintext strings in "textTranslations" are 
real Apertium output.
diff --git a/test/segmentation/CXSegmenter.test.js 
b/test/segmentation/CXSegmenter.test.js
index 145bb1c..a0b9341 100644
--- a/test/segmentation/CXSegmenter.test.js
+++ b/test/segmentation/CXSegmenter.test.js
@@ -3,8 +3,8 @@
 var fs = require( 'fs' ),
        lang, i, len, lang, test, tests,
        assert = require( '../utils/assert.js' ),
-       LinearDoc = require( '../../lineardoc' ),
-       Segmenter = require( '../../segmentation/CXSegmenter' ).CXSegmenter,
+       LinearDoc = require( '../../lib/lineardoc' ),
+       Segmenter = require( '../../lib/segmentation/CXSegmenter' ).CXSegmenter,
        allTests = require( './SegmentationTests.json' );
 
 function normalize( html ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/364416
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6472fd5bfff6e54b41a0ca36e22c28d43aa340a0
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: KartikMistry <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to