Comparing version 0.0.3 to 0.0.6
@@ -31,4 +31,2 @@ #!/usr/bin/env node | ||
console.log('Start renaming'); | ||
mv.mvFile(currentDir, sourceAbsPath, destAbsPath, function(err) { | ||
@@ -39,4 +37,3 @@ if (err) { | ||
console.log('Successfully moved file and updated all file references'); | ||
process.exit(); | ||
}) |
14
index.js
@@ -35,2 +35,3 @@ var path = require('path'), | ||
var matches = data.match(re); | ||
console.log(matches) | ||
@@ -44,3 +45,3 @@ if (matches) { | ||
var newRelativePath = path.relative(path.dirname(destAbsPath), oldAsbPath); | ||
if (newRelativePath.indexOf(".") < 0 ) { | ||
if (newRelativePath.indexOf(".") != 0 ) { | ||
newRelativePath = './' + newRelativePath; | ||
@@ -58,13 +59,12 @@ } | ||
var fileMatchingStr = exports.getFileMatchingStr(); | ||
glob(fileMatchingStr, {cwd:currentDir}, function(err, files) { | ||
if (err) return cb(err); | ||
function updateReferenceForFile(file) { | ||
var oldRelativePath = path.relative(path.dirname(file), sourceAbsPath).replace(/\.(js|coffee)$/g, ''), | ||
newRelativePath = path.relative(path.dirname(file), destAbsPath).replace(/\.(js|coffee)$/g, ''); | ||
if (oldRelativePath.indexOf(".") < 0 ) { | ||
function updateReferenceForFile(file, cb) { | ||
var oldRelativePath = path.relative(path.dirname(file), sourceAbsPath).replace(/\.(js|coffee)$/, ''), | ||
newRelativePath = path.relative(path.dirname(file), destAbsPath).replace(/\.(js|coffee)$/, ''); | ||
if (oldRelativePath.indexOf(".") != 0 ) { | ||
oldRelativePath = './' + oldRelativePath; | ||
} | ||
if (newRelativePath.indexOf(".") < 0 ) { | ||
if (newRelativePath.indexOf(".") != 0 ) { | ||
newRelativePath = './' + newRelativePath; | ||
@@ -71,0 +71,0 @@ } |
{ | ||
"name": "node-mv", | ||
"version": "0.0.3", | ||
"version": "0.0.6", | ||
"description": "Command-line tool for renaming/moving a node.js source file and update all references to the file", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"bin": { | ||
"node-mv": "mv.js" | ||
"node-mv": "./bin/mv.js" | ||
}, | ||
@@ -18,0 +18,0 @@ "directories": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5946
96