Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Windows support, replaces PR #460 #869

Closed
wants to merge 4 commits into
from
@@ -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/"
+ }
+ }
+}]
View
@@ -181,6 +181,11 @@ YUI.add('addon-rs-url', function(Y, NAME) {
relativePath = fs.fullPath.substr(fs.rootDir.length + 1),
urlParts = [liburl.resolve('/', (this.config.prefix || 'static'))];
+ // Translate from filesystem path to URL
+ if ('win32' === process.platform) {
+ relativePath = relativePath.replace(/\\/g, '/');
+ }
+
// Don't clobber a URL calculated by another RS addon, or bother to
// proceed for server affinity resources that don't need uris
if (res.hasOwnProperty('url') || ('server' === res.affinity.affinity)) {
@@ -165,6 +165,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._config = cfg || {};
this._config.context = this._config.context || {};
@@ -996,7 +998,7 @@ YUI.add('mojito-resource-store', function(Y, NAME) {
rootDir: dir,
rootType: dirType,
subDir: subdir,
- subDirArray: subdir.split('/'),
+ subDirArray: subdir.split(this._libs.path.sep),
isFile: isFile,
ext: this._libs.path.extname(file)
};
@@ -1305,7 +1307,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]) {
@@ -1331,7 +1333,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;
}
@@ -1375,7 +1377,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;
}
@@ -1743,9 +1745,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;
@@ -1781,9 +1781,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;
@@ -1944,7 +1943,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) {
@@ -2061,6 +2060,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;
View
@@ -159,16 +159,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);
}
});