From 8978e066b5f7fd0fac273b470b90fe4f9bef48c2 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Mon, 17 Oct 2011 15:26:10 -0700 Subject: [PATCH] fix(gen-docs): require files without touching PATH So that it works on latest revision of node... New version of Node (v0.5.x) does not support require.paths.push(). --- docs/spec/domSpec.js | 2 +- docs/spec/ngdocSpec.js | 4 ++-- docs/spec/sitemapSpec.js | 4 ++-- docs/spec/specs.js | 4 +--- docs/spec/writerSpec.js | 2 +- docs/src/gen-docs.js | 12 +++++------- docs/src/ngdoc.js | 6 +++--- docs/src/reader.js | 3 +-- docs/src/writer.js | 1 - gen_docs.sh | 2 +- 10 files changed, 17 insertions(+), 23 deletions(-) diff --git a/docs/spec/domSpec.js b/docs/spec/domSpec.js index 45813cc46b2..a967645e430 100644 --- a/docs/spec/domSpec.js +++ b/docs/spec/domSpec.js @@ -1,4 +1,4 @@ -var DOM = require('dom.js').DOM; +var DOM = require('../src/dom.js').DOM; describe('dom', function() { var dom; diff --git a/docs/spec/ngdocSpec.js b/docs/spec/ngdocSpec.js index c6e67b13a15..72ad69ff444 100644 --- a/docs/spec/ngdocSpec.js +++ b/docs/spec/ngdocSpec.js @@ -1,5 +1,5 @@ -var ngdoc = require('ngdoc.js'); -var DOM = require('dom.js').DOM; +var ngdoc = require('../src/ngdoc.js'); +var DOM = require('../src/dom.js').DOM; describe('ngdoc', function() { var Doc = ngdoc.Doc; diff --git a/docs/spec/sitemapSpec.js b/docs/spec/sitemapSpec.js index dc6c3438339..5f9278356b6 100644 --- a/docs/spec/sitemapSpec.js +++ b/docs/spec/sitemapSpec.js @@ -1,5 +1,5 @@ -var SiteMap = require('SiteMap.js').SiteMap; -var Doc = require('ngdoc.js').Doc; +var SiteMap = require('../src/SiteMap.js').SiteMap; +var Doc = require('../src/ngdoc.js').Doc; describe('sitemap', function() { diff --git a/docs/spec/specs.js b/docs/spec/specs.js index 7f9f92ee42f..cffd8eb9fb1 100644 --- a/docs/spec/specs.js +++ b/docs/spec/specs.js @@ -1,8 +1,6 @@ if (global.jasmine) return; -require.paths.push(__dirname + "/../../lib"); -require.paths.push(__dirname + '/../src'); -var jasmine = require('jasmine-1.0.1'); +var jasmine = require('../../lib/jasmine-1.0.1'); var sys = require('util'); for(var key in jasmine) { diff --git a/docs/spec/writerSpec.js b/docs/spec/writerSpec.js index 973bb64e050..c0f80de3194 100644 --- a/docs/spec/writerSpec.js +++ b/docs/spec/writerSpec.js @@ -1,4 +1,4 @@ -var writer = require('writer.js'); +var writer = require('../src/writer.js'); describe('writer', function() { describe('toString', function() { var toString = writer.toString; diff --git a/docs/src/gen-docs.js b/docs/src/gen-docs.js index eecc98ccfa5..1ca40c60ef1 100755 --- a/docs/src/gen-docs.js +++ b/docs/src/gen-docs.js @@ -1,10 +1,8 @@ -require.paths.push(__dirname); -require.paths.push('lib'); -var reader = require('reader.js'), - ngdoc = require('ngdoc.js'), - writer = require('writer.js'), - SiteMap = require('SiteMap.js').SiteMap, - appCache = require('appCache.js').appCache, +var reader = require('./reader.js'), + ngdoc = require('./ngdoc.js'), + writer = require('./writer.js'), + SiteMap = require('./SiteMap.js').SiteMap, + appCache = require('./appCache.js').appCache, Q = require('qq'); process.on('uncaughtException', function(err) { diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 34a4dfcf101..c5da18e68d8 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -2,9 +2,9 @@ * All parsing/transformation code goes here. All code here should be sync to ease testing. */ -var Showdown = require('showdown').Showdown; -var DOM = require('dom.js').DOM; -var htmlEscape = require('dom.js').htmlEscape; +var Showdown = require('../../lib/showdown').Showdown; +var DOM = require('./dom.js').DOM; +var htmlEscape = require('./dom.js').htmlEscape; var NEW_LINE = /\n\r?/; exports.trim = trim; diff --git a/docs/src/reader.js b/docs/src/reader.js index 9b846ed4034..576ae2e41b5 100644 --- a/docs/src/reader.js +++ b/docs/src/reader.js @@ -5,8 +5,7 @@ exports.collect = collect; -require.paths.push(__dirname); -var ngdoc = require('ngdoc.js'), +var ngdoc = require('./ngdoc.js'), Q = require('qq'), qfs = require('q-fs'); diff --git a/docs/src/writer.js b/docs/src/writer.js index e5dff59f54a..dcf78930ac5 100644 --- a/docs/src/writer.js +++ b/docs/src/writer.js @@ -2,7 +2,6 @@ * All writing related code here. This is so that we can separate the async code from sync code * for testability */ -require.paths.push(__dirname); var qfs = require('q-fs'); var Q = require('qq'); var OUTPUT_DIR = "build/docs/"; diff --git a/gen_docs.sh b/gen_docs.sh index 3c74339e906..b14c49db770 100755 --- a/gen_docs.sh +++ b/gen_docs.sh @@ -1,4 +1,4 @@ #!/bin/bash if [ ! -e gen_docs.disable ]; then - jasmine-node docs/spec -i docs/src -i lib --noColor && node docs/src/gen-docs.js + jasmine-node docs/spec --noColor && node docs/src/gen-docs.js fi