This repository was archived by the owner on Mar 18, 2018. It is now read-only.
File tree 4 files changed +16
-2
lines changed
4 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 45
45
"mkdirp" : " ^0.5.0" ,
46
46
"moment" : " ^2.12.0" ,
47
47
"path2" : " ^0.1.0" ,
48
+ "rimraf" : " ^2.6.2" ,
48
49
"shipit-utils" : " ^1.1.3"
49
50
}
50
51
}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ var utils = require('shipit-utils');
2
2
var chalk = require ( 'chalk' ) ;
3
3
var mkdirp = require ( 'mkdirp' ) ;
4
4
var Promise = require ( 'bluebird' ) ;
5
+ var rimraf = require ( 'rimraf' ) ;
5
6
6
7
/**
7
8
* Fetch task.
@@ -44,7 +45,7 @@ module.exports = function (gruntOrShipit) {
44
45
45
46
if ( shipit . config . shallowClone ) {
46
47
shipit . log ( 'Deleting existing workspace "%s"' , shipit . config . workspace ) ;
47
- return shipit . local ( 'rm -rf ' + shipit . config . workspace )
48
+ return Promise . promisify ( rimraf ) ( shipit . config . workspace )
48
49
. then ( create ) ;
49
50
}
50
51
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Module dependencies.
3
+ */
4
+
5
+ var sinon = require ( 'sinon' ) ;
6
+
7
+ /**
8
+ * Expose rimraf mock.
9
+ */
10
+
11
+ module . exports = sinon . stub ( ) . yields ( ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ var expect = require('chai').use(require('sinon-chai')).expect;
5
5
var Shipit = require ( 'shipit-cli' ) ;
6
6
var fetchFactory = rewire ( '../../../../tasks/deploy/fetch' ) ;
7
7
var mkdirpMock = require ( '../../../mocks/mkdirp' ) ;
8
+ var rimrafMock = require ( '../../../mocks/rimraf' ) ;
8
9
9
10
describe ( 'deploy:fetch task' , function ( ) {
10
11
var shipit ;
@@ -59,7 +60,7 @@ describe('deploy:fetch task', function () {
59
60
60
61
shipit . start ( 'deploy:fetch' , function ( err ) {
61
62
if ( err ) return done ( err ) ;
62
- expect ( shipit . local ) . to . be . calledWith ( 'rm -rf /tmp/workspace' ) ;
63
+ expect ( rimrafMock ) . to . be . calledWith ( '/tmp/workspace' ) ;
63
64
expect ( mkdirpMock ) . to . be . calledWith ( '/tmp/workspace' ) ;
64
65
expect ( shipit . local ) . to . be . calledWith ( 'git init' , { cwd : '/tmp/workspace' } ) ;
65
66
expect ( shipit . local ) . to . be . calledWith ( 'git remote' , { cwd : '/tmp/workspace' } ) ;
You can’t perform that action at this time.
0 commit comments