rename some things having to do with url path prefixes

This commit is contained in:
Naomi Seyfer
2013-07-09 11:21:39 -07:00
parent 2e44b70cb7
commit 18384d197c
7 changed files with 19 additions and 19 deletions

View File

@@ -52,7 +52,7 @@ var translateUrl = function(url, newSchemeBase, subPath) {
url = newSchemeBase + "://" + url;
}
url = Meteor._fixLink(url);
url = Meteor._relativeToSiteRootUrl(url);
if (endsWith(url, "/"))
return url + subPath;

View File

@@ -7,7 +7,7 @@
__meteor_runtime_config__.serverId =
process.env.SERVER_ID ? process.env.SERVER_ID : Random.id();
var pathPrefix = __meteor_runtime_config__.PATH_PREFIX || "";
var pathPrefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX || "";
Meteor._DdpStreamServer = function () {
var self = this;

View File

@@ -50,7 +50,7 @@ Tinytest.add("stream - sockjs urls are computed correctly", function(test) {
"http://subdomain.meteor.com/sockjs");
testHasSockjsUrl("subdomain.meteor.com",
"http://subdomain.meteor.com/sockjs");
testHasSockjsUrl("/", Meteor._fixLink("/sockjs"));
testHasSockjsUrl("/", Meteor._relativeToSiteRootUrl("/sockjs"));
testHasSockjsUrl("http://localhost:3000/", "http://localhost:3000/sockjs");
testHasSockjsUrl("http://localhost:3000", "http://localhost:3000/sockjs");
@@ -73,7 +73,7 @@ testAsyncMulti("stream - /websocket is a websocket endpoint", [
// Verify that /websocket and /websocket/ don't return the main page
//
_.each(['/websocket', '/websocket/'], function(path) {
Meteor.http.get(Meteor._fixLink(path), expect(function(error, result) {
Meteor.http.get(Meteor._relativeToSiteRootUrl(path), expect(function(error, result) {
test.isNotNull(error);
test.equal('Can "Upgrade" only to "WebSocket".', result.content);
}));
@@ -91,12 +91,12 @@ testAsyncMulti("stream - /websocket is a websocket endpoint", [
test.equal(pageContent, result.content);
});
Meteor.http.get(Meteor._fixLink('/'), expect(function(error, result) {
Meteor.http.get(Meteor._relativeToSiteRootUrl('/'), expect(function(error, result) {
test.isNull(error);
pageContent = result.content;
_.each(['/websockets', '/websockets/'], function(path) {
Meteor.http.get(Meteor._fixLink(path), wrappedCallback);
Meteor.http.get(Meteor._relativeToSiteRootUrl(path), wrappedCallback);
});
}));
}

View File

@@ -41,9 +41,9 @@ if (typeof __meteor_runtime_config__ === "object" &&
Meteor.absoluteUrl.defaultOptions.rootUrl = __meteor_runtime_config__.ROOT_URL;
Meteor._fixLink = function (link) {
Meteor._relativeToSiteRootUrl = function (link) {
if (typeof __meteor_runtime_config__ === "object" &&
link.substr(0, 1) === "/")
link = (__meteor_runtime_config__.PATH_PREFIX || "") + link;
link = (__meteor_runtime_config__.ROOT_URL_PATH_PREFIX || "") + link;
return link;
};

View File

@@ -2,5 +2,5 @@ if (process.env.ROOT_URL &&
typeof __meteor_runtime_config__ === "object") {
__meteor_runtime_config__.ROOT_URL = process.env.ROOT_URL;
var pathPrefix = Npm.require('url').parse(__meteor_runtime_config__.ROOT_URL).pathname;
__meteor_runtime_config__.PATH_PREFIX = pathPrefix === "/" ? "" : pathPrefix;
__meteor_runtime_config__.ROOT_URL_PATH_PREFIX = pathPrefix === "/" ? "" : pathPrefix;
}

View File

@@ -187,7 +187,7 @@ var runWebAppServer = function () {
// Strip off the path prefix, if it exists.
app.use(function (request, response, next) {
var pathPrefix = __meteor_runtime_config__.PATH_PREFIX;
var pathPrefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX;
var url = Npm.require('url').parse(request.url);
var pathname = url.pathname;
// check if the path in the url starts with the path prefix (and the part
@@ -329,8 +329,8 @@ var runWebAppServer = function () {
"__meteor_runtime_config__ = " +
JSON.stringify(__meteor_runtime_config__) + ";")
.replace(
/##PATH_PREFIX##/g,
__meteor_runtime_config__.PATH_PREFIX || "");
/##ROOT_URL_PATH_PREFIX##/g,
__meteor_runtime_config__.ROOT_URL_PATH_PREFIX || "");
// only start listening after all the startup code has run.
var bind = deployConfig.boot.bind;

View File

@@ -34,8 +34,8 @@ assert.doesNotThrow(function () {
// verify that contents are minified
var appHtml = fs.readFileSync(path.join(tmpOutputDir, "programs",
"client", "app.html"), 'utf8');
assert(/src=\"##PATH_PREFIX##\/[0-9a-f]{40,40}.js\"/.test(appHtml));
assert(!(/src=\"##PATH_PREFIX##\/packages/.test(appHtml)));
assert(/src=\"##ROOT_URL_PATH_PREFIX##\/[0-9a-f]{40,40}.js\"/.test(appHtml));
assert(!(/src=\"##ROOT_URL_PATH_PREFIX##\/packages/.test(appHtml)));
});
console.log("nodeModules: 'skip', no minify");
@@ -50,11 +50,11 @@ assert.doesNotThrow(function () {
// verify that contents are not minified
var appHtml = fs.readFileSync(path.join(tmpOutputDir, "programs",
"client", "app.html"), 'utf8');
assert(!(/src=\"##PATH_PREFIX##\/[0-9a-f]{40,40}.js\"/.test(appHtml)));
assert(/src=\"##PATH_PREFIX##\/packages\/meteor/.test(appHtml));
assert(/src=\"##PATH_PREFIX##\/packages\/deps/.test(appHtml));
assert(!(/src=\"##ROOT_URL_PATH_PREFIX##\/[0-9a-f]{40,40}.js\"/.test(appHtml)));
assert(/src=\"##ROOT_URL_PATH_PREFIX##\/packages\/meteor/.test(appHtml));
assert(/src=\"##ROOT_URL_PATH_PREFIX##\/packages\/deps/.test(appHtml));
// verify that tests aren't included
assert(!(/src=\"##PATH_PREFIX##\/package-tests\/meteor/.test(appHtml)));
assert(!(/src=\"##ROOT_URL_PATH_PREFIX##\/package-tests\/meteor/.test(appHtml)));
});
console.log("nodeModules: 'skip', no minify, testPackages: ['meteor']");
@@ -70,7 +70,7 @@ assert.doesNotThrow(function () {
// verify that tests for the meteor package are included
var appHtml = fs.readFileSync(path.join(tmpOutputDir, "programs",
"client", "app.html"));
assert(/src=\"##PATH_PREFIX##\/packages\/meteor\.tests\.js/.test(appHtml));
assert(/src=\"##ROOT_URL_PATH_PREFIX##\/packages\/meteor\.tests\.js/.test(appHtml));
});
console.log("nodeModules: 'copy'");