Skip to content
Browse files

npm install not npm update, and move working directory

  • Loading branch information...
1 parent e66bed3 commit c14d0a3912eeaacc6fc007f775e1c7fce45ddb3f @dominictarr committed Jun 15, 2011
Showing with 36 additions and 29 deletions.
  1. +2 −1 server.js
  2. +1 −1 test/api.asynct.js
  3. +1 −1 test/controllers.github.asynct.js
  4. +1 −1 test/pull.asynct.js
  5. +1 −1 test/test-with-vows.asynct.js
  6. +1 −1 test/test.asynct.js
  7. +29 −23 testbed.js
View
3 server.js
@@ -1,6 +1,7 @@
#!/usr/bin/env node
-var testbed = new (require('./testbed'))(process.cwd() + '/workspace')
+var testbed = new (require('./testbed'))(process.cwd() + '/../workspace')//no not install inside cwd.
+ //testbed's deps may interfere with a tests deps.
, appSetup = require('./app-setup')
, request = require('request')
, render = require('render')
View
2 test/api.asynct.js
@@ -1,6 +1,6 @@
var Testbed = require('testbed')
, it = require('it-is')
- , tmp = __dirname + '/tmp'
+ , tmp = '/tmp'
, testbed = new Testbed(tmp)
exports ['can has api'] = function (test){
View
2 test/controllers.github.asynct.js
@@ -74,7 +74,7 @@ function MockRepo (){
process.nexTick(function (){ callback(null, {ok: 'true'}) })
}
}*/
-var github = Github(db,new Testbed(__dirname + '/tmp').Repo, {basedir: __dirname + '/tmp'})
+var github = Github(db,new Testbed('/tmp').Repo, {basedir: __dirname + '/tmp'})
, post = {
repository: {
name: 'curry',
View
2 test/pull.asynct.js
@@ -1,6 +1,6 @@
var Testbed = require('testbed')
, it = require('it-is')
- , tmp = __dirname + '/tmp'
+ , tmp = '/tmp'
, testbed = new Testbed(tmp)
, exec = require('child_process').exec
, fs = require('fs')
View
2 test/test-with-vows.asynct.js
@@ -1,6 +1,6 @@
var Testbed = require('testbed')
, it = require('it-is')
- , tmp = __dirname + '/tmp'
+ , tmp = '/tmp'
, testbed = new Testbed(tmp)
, exec = require('child_process').exec
, fs = require('fs')
View
2 test/test.asynct.js
@@ -1,6 +1,6 @@
var Testbed = require('testbed')
, it = require('it-is').style('colour')
- , tmp = __dirname + '/tmp'
+ , tmp = '/tmp'
, testbed = new Testbed(tmp)
, exec = require('child_process').exec
, fs = require('fs')
View
52 testbed.js
@@ -192,7 +192,6 @@ var also = {
try {
package = eval('(' + json + ')')
- dev = package.devDependencies || {}
} catch (err) {
self.report.status = 'install-error'
err.message = 'trying to parse package.json:' + err.message
@@ -201,6 +200,13 @@ var also = {
self.change('install-error',err)
return callback(err)
}
+
+ dev = package.devDependencies || {}
+ var deps = package.dependencies || {}
+
+ for(var dep in deps){
+ dev[dep] = dev[dep] || deps[dep]
+ }
self.package = package
@@ -210,34 +216,34 @@ var also = {
return !!!/expresso|meta-test/(e)
})
console.log("devDependencies",devDependencies)
- if(devDependencies.length)
+ if(devDependencies.length)//XXX: ignore this for now
exec('npm install ' + devDependencies.join(' '),{cwd: self.dir()}, next)
else next()
function next(err,data){
- if(err) {
- self.report.status = 'install-error'
- self.report.failures.push(err)
- //there was an error reading package json.
- self.change('install-error',err)
- return callback(err,data)
- }
+ if(err) {
+ self.report.status = 'install-error'
+ self.report.failures.push(err)
+ //there was an error reading package json.
+ self.change('install-error',err)
+ return callback(err,data)
+ }
- exec([
- 'mkdir', 'node_modules'].join(' '),
- {cwd: join(self.basedir,self.username)},
- function (err){
- if(err) console.log(err)
exec([
- 'ln -s',
- self.dir(),
- join(self.basedir, self.username, 'node_modules', package.name)
- ].join(' '),
- function (err){//err will happen if it's already there, so ignore it.
- self.setState(true,false,false)
- self.change('init',err)
- callback(err)
+ 'mkdir', 'node_modules'].join(' '),
+ {cwd: join(self.basedir,self.username)},
+ function (err){
+ if(err) console.log(err)
+ exec([
+ 'ln -s',
+ self.dir(),
+ join(self.basedir, self.username, 'node_modules', package.name)
+ ].join(' '),
+ function (err){//err will happen if it's already there, so ignore it.
+ self.setState(true,false,false)
+ self.change('init',err)
+ callback(err)
+ })
})
- })
}
})
},

0 comments on commit c14d0a3

Please sign in to comment.
Something went wrong with that request. Please try again.