Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue #264: Fixes for windows paths

  • Loading branch information...
commit 4fd035106f12407c2f97c40a0aae69c6844b10a6 1 parent 7558065
Michael Ridgway authored
1  examples/newsboxes/mojits/Read/definition.json
View
50 examples/newsboxes/mojits/Read/definition.json
View
@@ -0,0 +1,50 @@
+[{
+ "settings": [ "master" ],
+
+ "feeds": {
+ "bbcnews": {
+ "name": "BBC World News",
+ "url": "http://feeds.bbci.co.uk/news/world/rss.xml"
+ },
+ "yahoonews": {
+ "name": "Yahoo! Internet News",
+ "url": "http://rss.news.yahoo.com/rss/internet"
+ },
+ "techcrunch": {
+ "name": "TechCrunch",
+ "url": "http://feeds.feedburner.com/TechCrunch"
+ },
+ "yahoopersonaltech": {
+ "name": "Yahoo! Sports MLB",
+ "url": "http://sports.yahoo.com/mlb/rss.xml"
+ },
+ "allthingsd": {
+ "name": "AllThingsD",
+ "url": "http://allthingsd.com/feed/"
+ },
+ "yahoostocks": {
+ "name": "Yahoo! Stock Markets News",
+ "url": "http://rss.news.yahoo.com/rss/stocks"
+ },
+ "bbcbusiness": {
+ "name": "BBC Business News",
+ "url": "http://feeds.bbci.co.uk/news/business/rss.xml"
+ },
+ "yahooomg": {
+ "name": "Yahoo! OMG",
+ "url": "http://rss.omg.yahoo.com/-/news/latest"
+ },
+ "yui": {
+ "name": "YUI Blog",
+ "url": "http://feeds.yuiblog.com/YahooUserInterfaceBlog"
+ },
+ "yql": {
+ "name": "YQL Blog",
+ "url": "http://yqlblog.net/blog/feed/"
+ },
+ "ysearch": {
+ "name": "Yahoo Search Blog",
+ "url": "http://www.ysearchblog.com/feed/"
+ }
+ }
+}]
9 lib/app/addons/rs/url.server.js
View
@@ -176,6 +176,11 @@ YUI.add('addon-rs-url', function(Y, NAME) {
rollupParts = [],
rollupFsPath;
+ // Fix windows paths
+ if ('win32' === process.platform) {
+ relativePath = relativePath.replace(/\\/g, '/');
+ }
+
// Don't clobber a URL calculated by another RS addon.
if (res.hasOwnProperty('url')) {
return;
@@ -202,7 +207,7 @@ YUI.add('addon-rs-url', function(Y, NAME) {
rollupParts.push(this.config.appName);
}
rollupParts.push('rollup.client.js');
- rollupFsPath = libpath.join(this.appRoot, 'rollup.client.js');
+ rollupFsPath = [this.appRoot, 'rollup.client.js'].join('/');
}
} else {
if ('mojit' === res.type) {
@@ -213,7 +218,7 @@ YUI.add('addon-rs-url', function(Y, NAME) {
if (res.yui && res.yui.name) {
rollupParts.push(res.mojit);
rollupParts.push('rollup.client.js');
- rollupFsPath = libpath.join(mojitRes.source.fs.fullPath, 'rollup.client.js');
+ rollupFsPath = [mojitRes.source.fs.fullPath, 'rollup.client.js'].join('/');
}
}
8 lib/management/utils.js
View
@@ -174,16 +174,16 @@ function process_directory(archetype_path, dir, mojit_dir, template, force) {
files = fs.readdirSync(path.join(archetype_path, dir));
files.forEach(function(f) {
- var s = fs.statSync(path.join(archetype_path, '/', dir, '/', f));
+ var s = fs.statSync(path.join(archetype_path, dir, f));
if (f.charAt(0) === '.') {
return;
}
if (s.isDirectory()) {
- process_directory(path.join(archetype_path, '/', dir), f,
- path.join(mojit_dir, '/', dir), template, force);
+ process_directory(path.join(archetype_path, dir), f,
+ path.join(mojit_dir, dir), template, force);
} else {
- process_file(path.join(archetype_path, '/', dir), f,
+ process_file(path.join(archetype_path, dir), f,
new_dir, template);
}
});
24 lib/store.server.js
View
@@ -107,7 +107,6 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
libs.semver = require('semver');
libs.walker = require('./package-walker.server');
-
// The Affinity object is to manage the use of the affinity string in
// filenames. Some files have affinities that have multiple parts
// (e.g. "server-tests").
@@ -169,6 +168,8 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
this._libs[i] = libs[i];
}
}
+ // Backport of node 0.8+ property
+ this._libs.path.sep = this._libs.path.sep || ('win32' === process.platform ? '\\' : '/');
this._appRVs = []; // array of resource versions
this._mojitRVs = {}; // mojitType: array of resource versions
@@ -991,6 +992,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
if (!fs.isFile && fs.subDirArray.length < 2 && 'addons' === fs.subDirArray[0]) {
return true;
}
+
if (fs.isFile && fs.subDirArray.length >= 1 && 'addons' === fs.subDirArray[0]) {
if ('.js' !== fs.ext) {
return false;
@@ -1119,7 +1121,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
Y.log('invalid ' + type + ' filename. skipping ' + fs.fullPath, 'warn', NAME);
return;
}
- res.name = this._libs.path.join(fs.subDirArray.join('/'), baseParts.join('.'));
+ res.name = this._libs.path.join(fs.subDirArray.join(this._libs.path.sep), baseParts.join('.'));
res.id = [res.type, res.subtype, res.name].join('-');
// special case
if ('addon' === type && ADDON_SUBTYPES_APPLEVEL[res.subtype]) {
@@ -1145,7 +1147,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
Y.log('invalid ' + type + ' filename. skipping ' + fs.fullPath, 'warn', NAME);
return;
}
- res.name = this._libs.path.join(fs.subDirArray.join('/'), baseParts.join('.'));
+ res.name = this._libs.path.join(fs.subDirArray.join(this._libs.path.sep), baseParts.join('.'));
res.id = [res.type, res.subtype, res.name].join('-');
return res;
}
@@ -1189,7 +1191,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
Y.log('invalid view filename. skipping ' + fs.fullPath, 'warn', NAME);
return;
}
- res.name = this._libs.path.join(fs.subDirArray.join('/'), baseParts.join('.'));
+ res.name = this._libs.path.join(fs.subDirArray.join(this._libs.path.sep), baseParts.join('.'));
res.id = [res.type, res.subtype, res.name].join('-');
return res;
}
@@ -1563,9 +1565,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
childName,
childPath;
- if ('/' !== dir.charAt(0)) {
- dir = this._libs.path.join(this._config.root, dir);
- }
+ dir = this._libs.path.resolve(this._config.root, dir);
if (!(this._libs.fs.existsSync || this._libs.path.existsSync)(dir)) {
return;
@@ -1601,9 +1601,8 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
r,
res;
- if ('/' !== dir.charAt(0)) {
- dir = this._libs.path.join(this._config.root, dir);
- }
+
+ dir = this._libs.path.resolve(this._config.root, dir);
if (!(this._libs.fs.existsSync || this._libs.path.existsSync)(dir)) {
return;
@@ -1766,7 +1765,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
rootDir: dir,
rootType: dirType,
subDir: subdir,
- subDirArray: subdir.split('/'),
+ subDirArray: subdir.split(me._libs.path.sep),
isFile: isFile,
ext: me._libs.path.extname(file)
},
@@ -1782,7 +1781,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
if ('object' === typeof ret) {
if (ret.skipSubdirParts) {
source.fs.subDirArray = source.fs.subDirArray.slice(ret.skipSubdirParts);
- source.fs.subDir = source.fs.subDirArray.join('/') || '.';
+ source.fs.subDir = source.fs.subDirArray.join(me._libs.path.sep) || '.';
}
res = me.parseResourceVersion(source, ret.type, ret.subtype, mojitType);
if ('object' === typeof res) {
@@ -1899,6 +1898,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
if ('/' !== glob.charAt(0)) {
glob = this._libs.path.join(prefix, glob);
}
+ glob = glob.replace(/\\/g, '/'); // Glob only supports forward slashes
found = found.concat(this._libs.glob.sync(glob, {}));
}
return found;
Please sign in to comment.
Something went wrong with that request. Please try again.