-
Notifications
You must be signed in to change notification settings - Fork 31
Suggested fix for #97, review of implications required #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,17 @@ describe( 'clean', function () { | |
|
|
||
| it( '(preparing: create files to clean up later)', function ( done ) { | ||
|
|
||
| VinylFs.src( 'test/fixtures/**' ) | ||
| .pipe( VinylFs.dest( 'test/fixtures/cleaning' ) ) | ||
| VinylFs.src( 'test/fixtures/index.html' ) | ||
| .pipe( VinylFs.dest( 'test/fixtures/cleanthis' ) ) | ||
| .on( 'error', done ) | ||
| .on( 'end', done ); | ||
|
|
||
| } ); | ||
|
|
||
| it( '(preparing: create files to ignore in cleanup)', function ( done ) { | ||
|
|
||
| VinylFs.src( 'test/fixtures/index.html' ) | ||
| .pipe( VinylFs.dest( 'test/fixtures/dontcleanthis' ) ) | ||
| .on( 'error', done ) | ||
| .on( 'end', done ); | ||
|
|
||
|
|
@@ -31,22 +40,27 @@ describe( 'clean', function () { | |
|
|
||
| it( '(preparing: remove files to clean)', function ( done ) { | ||
|
|
||
| rmdir( 'test/fixtures/cleaning', done ); | ||
| rmdir( 'test/fixtures/cleanthis', done ); | ||
|
|
||
| } ); | ||
|
|
||
| it( '(preparing: remove files to ignore in cleanup)', function ( done ) { | ||
|
|
||
| rmdir( 'test/fixtures/dontcleanthis', done ); | ||
|
|
||
| } ); | ||
|
|
||
| it( 'should clean up extra remote files', function ( done ) { | ||
| it( 'should clean up extra remote files but repect ignore rules', function ( done ) { | ||
|
|
||
| done = suite.done( done ); | ||
|
|
||
| suite.vftp.clean( 'test/clean/**', 'test/fixtures' ) | ||
| suite.vftp.clean( [ 'test/clean/**/*', '!test/clean/dontcleanthis/**/*' ], 'test/fixtures' ) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This operation doesn't quite work yet, and the problem may lie with the implementation of the |
||
| .on( 'error', done ) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This practice of calling |
||
| .on( 'end', check ); | ||
|
|
||
| function check() { | ||
|
|
||
| assert.ok( suite.log.match( /DEL/ ) ); | ||
| assert.ok( suite.log.match( /RMDIR/ ) ); | ||
| assert.ok( suite.log.match( /RMDIR(.)*test\/clean\/cleanthis/ ) ); | ||
| assert.equal( suite.log.match( /RMDIR(.)*test\/clean\/dontcleanthis/ ), null ); | ||
| done(); | ||
|
|
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should properly handle leading negation characters
!while keeping the behaviour of prepending a slash. However, I don't quite see why prepending a slash is necessary or even useful - it may even lead to problems where the user doesn't expect this behaviour.I'd also suggest moving to the glob parsing of
vinyl-fs, as proposed above, but I don't have enough knowledge of the code to implement this.