-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #336 from sunghwan2789/skip-rm-empty
Fix remove not working properly
- Loading branch information
Showing
10 changed files
with
104 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// to be copied |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file should not be removed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// to be copied |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* to be removed */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// to be removed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This file should not be removed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const helper = require('../helper'); | ||
const ghPages = require('../../lib/'); | ||
const path = require('path'); | ||
|
||
const fixtures = path.join(__dirname, 'fixtures'); | ||
const fixtureName = 'remove'; | ||
|
||
beforeEach(() => { | ||
ghPages.clean(); | ||
}); | ||
|
||
describe('the remove option', () => { | ||
it('removes matched files in remote branch', done => { | ||
const local = path.join(fixtures, fixtureName, 'local'); | ||
const expected = path.join(fixtures, fixtureName, 'expected'); | ||
const branch = 'gh-pages'; | ||
const remove = '*.{js,css}'; | ||
|
||
helper.setupRemote(fixtureName, {branch}).then(url => { | ||
const options = { | ||
repo: url, | ||
user: { | ||
name: 'User Name', | ||
email: '[email protected]' | ||
}, | ||
remove: remove | ||
}; | ||
|
||
ghPages.publish(local, options, err => { | ||
if (err) { | ||
return done(err); | ||
} | ||
helper | ||
.assertContentsMatch(expected, url, branch) | ||
.then(() => done()) | ||
.catch(done); | ||
}); | ||
}); | ||
}); | ||
|
||
it('skips removing files if there are no files to be removed', done => { | ||
const local = path.join(fixtures, fixtureName, 'remote'); | ||
const branch = 'gh-pages'; | ||
const remove = 'non-exist-file'; | ||
|
||
helper.setupRemote(fixtureName, {branch}).then(url => { | ||
const options = { | ||
repo: url, | ||
user: { | ||
name: 'User Name', | ||
email: '[email protected]' | ||
}, | ||
remove: remove | ||
}; | ||
|
||
ghPages.publish(local, options, err => { | ||
if (err) { | ||
return done(err); | ||
} | ||
helper | ||
.assertContentsMatch(local, url, branch) | ||
.then(() => done()) | ||
.catch(done); | ||
}); | ||
}); | ||
}); | ||
}); |