Permalink
Browse files

Update existsSync to new namespace

  • Loading branch information...
1 parent 333e69d commit 118933426abe06e69ea1c132d8ea9cb1a8843434 @ryanwilliams committed Sep 10, 2012
Showing with 14 additions and 14 deletions.
  1. +1 −1 bin/jah.js
  2. +2 −2 lib/jah/commands/new.js
  3. +4 −4 lib/jah/compiler.js
  4. +3 −3 lib/jah/copytree.js
  5. +1 −1 lib/jah/mimetypes.js
  6. +2 −2 lib/jah/server.js
  7. +1 −1 package.json
View
@@ -6,7 +6,7 @@ var sys = require('util'),
var localPath = path.normalize(path.join(process.cwd(), 'node_modules', '.bin', 'jah')),
- isLocal = path.existsSync(localPath) && require.resolve(localPath) != __filename;
+ isLocal = fs.existsSync(localPath) && require.resolve(localPath) != __filename;
// If the local project has its own Jah install, use that executable instead
if (isLocal) {
@@ -63,7 +63,7 @@ function mkdir(dir, mode) {
for (var i = 0, len = paths.length; i < len; i++) {
var p = paths[i];
- if (!path.existsSync(p)) {
+ if (!fs.existsSync(p)) {
fs.mkdirSync(p, mode);
}
}
@@ -89,7 +89,7 @@ exports.run = function () {
skeletonPath = path.join(exports.skeletonPaths[i], skeletonName)
// Does skeleton template exist in the current path
- if (path.existsSync(skeletonPath) && fs.statSync(skeletonPath).isDirectory()) {
+ if (fs.existsSync(skeletonPath) && fs.statSync(skeletonPath).isDirectory()) {
break
} else {
skeletonPath = false
View
@@ -116,7 +116,7 @@ Compiler.prototype.findLibPath = function (libname) {
// If we're inside a node_modules folder loop up the parent packages to see if any match the lib
var parentNodeModules = path.join(JAH_ROOT, '..')
, parentPackage = path.join(parentNodeModules, '..')
- while (path.basename(parentNodeModules) == 'node_modules' && path.existsSync(path.join(parentPackage, 'package.json'))) {
+ while (path.basename(parentNodeModules) == 'node_modules' && fs.existsSync(path.join(parentPackage, 'package.json'))) {
// Add path to start of array so it gets highest priority
possiblePaths.unshift(parentPackage)
@@ -128,7 +128,7 @@ Compiler.prototype.findLibPath = function (libname) {
for (i=0; i<possiblePaths.length; i++) {
p = possiblePaths[i]
// Test if jah.json file exists and that package.json has the correct name
- if (path.existsSync(path.join(p, 'jah.json')) && path.existsSync(path.join(p, 'package.json'))) {
+ if (fs.existsSync(path.join(p, 'jah.json')) && fs.existsSync(path.join(p, 'package.json'))) {
pkgJSON = JSON.parse(fs.readFileSync(path.join(p, 'package.json'), 'utf8'))
if (pkgJSON.name == libname) {
@@ -566,7 +566,7 @@ Compiler.prototype.filePathForScript = function (scriptname) {
if (this.buildQueue.hasOwnProperty(codePath)) {
pkg = this.buildQueue[codePath]
jahJson = path.join(codePath, 'jah.json')
- if (!path.existsSync(jahJson)) {
+ if (!fs.existsSync(jahJson)) {
continue;
}
config = this.readConfig(jahJson)
@@ -591,7 +591,7 @@ Compiler.prototype.filePathForScript = function (scriptname) {
}
}
- if (!path.existsSync(bestMatch.filename)) {
+ if (!fs.existsSync(bestMatch.filename)) {
bestMatch = null
}
View
@@ -18,7 +18,7 @@ function mkdir(dir, mode) {
for (var i = 0, len = paths.length; i < len; i++) {
var p = paths[i];
- if (!path.existsSync(p)) {
+ if (!fs.existsSync(p)) {
fs.mkdirSync(p, mode);
}
}
@@ -65,7 +65,7 @@ function copyfile(src, dst, callback) {
* @see https://gist.github.com/563078/afa6c25facaf857712c6847c0bdc748cb6476f93
*/
function copytree(src, dst, skipHidden) {
- if(!path.existsSync(src)) {
+ if(!fs.existsSync(src)) {
throw new Error(src + ' does not exists. Nothing to be copied');
}
@@ -76,7 +76,7 @@ function copytree(src, dst, skipHidden) {
var filenames = fs.readdirSync(src);
var basedir = src;
- if(!path.existsSync(dst)) {
+ if(!fs.existsSync(dst)) {
mkdir(dst, parseInt('0755', 8));
}
var readNext = function(){
@@ -63,7 +63,7 @@ function read(file) {
for (var i = 0, len = exports.knowntypes.length; i < len; i++) {
var typeFile = exports.knowntypes[i];
- if (path.existsSync(typeFile)) {
+ if (fs.existsSync(typeFile)) {
read(typeFile);
}
}
View
@@ -94,9 +94,9 @@ Server.prototype.servePublicFile = function (response, filename) {
logger.notice('Serving file', filename)
var mimetype = mimetypes.guessType(filename)
- if (path.existsSync(filename)) {
+ if (fs.existsSync(filename)) {
this.serve(response, fs.readFileSync(filename), mimetype)
- } else if (path.existsSync(filename + '.template')) {
+ } else if (fs.existsSync(filename + '.template')) {
var template = new Template(fs.readFileSync(filename + '.template').toString())
this.serve(response, template.substitute(this.substitutions()), mimetype)
} else {
View
@@ -2,7 +2,7 @@
"name": "jah",
"author": "Ryan Williams <ryan@wigg.ly>",
"description": "Enable CommonJS in browser applications",
- "version": "0.2.3",
+ "version": "0.3",
"homepage": "https://github.com/ryanwilliams/jah",
"engines": {

0 comments on commit 1189334

Please sign in to comment.