Skip to content

Commit d0dd34b

Browse files
committed
gulp.src fix for multiple globs
1 parent ed246d9 commit d0dd34b

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
  
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 2
10+
quote_type = single
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

lib/utils/bozon.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ var bozon = {
1616
},
1717

1818
src: function (suffix) {
19-
return this.requireLocal('gulp').src(this.sourcePath(suffix))
19+
var sources;
20+
if (Array.isArray(suffix)) {
21+
sources = suffix.map(this.sourcePath.bind(this))
22+
} else {
23+
sources = this.sourcePath(suffix)
24+
}
25+
return this.requireLocal('gulp').src(sources)
2026
},
2127

2228
dest: function (suffix) {

test/lib/utils/bozon_spec.coffee

+10-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,21 @@ describe '#bozon', ->
2727
expect(gulpTaskSpy.getCall(0).args[0]).to.eq('compile')
2828

2929
describe '#src', ->
30-
beforeEach =>
31-
bozon.src('javascripts')
30+
afterEach =>
31+
gulpSrcSpy.reset()
3232

3333
it 'should set gulp src', =>
34+
bozon.src('javascripts')
3435
expect(gulpSrcSpy.calledOnce).to.be.true
3536
expect(gulpSrcSpy.getCall(0).args[0]).to.eq("#{process.cwd()}/app/javascripts")
3637

38+
it 'should set multiple gulp sources', =>
39+
bozon.src(['javascripts', 'styles'])
40+
expect(gulpSrcSpy.calledOnce).to.be.true
41+
expect(gulpSrcSpy.getCall(0).args[0]).to.instanceof(Array)
42+
expect(gulpSrcSpy.getCall(0).args[0][0]).to.eq("#{process.cwd()}/app/javascripts")
43+
expect(gulpSrcSpy.getCall(0).args[0][1]).to.eq("#{process.cwd()}/app/styles")
44+
3745
describe '#dest', ->
3846
beforeEach =>
3947
bozon.dest('javascripts')

0 commit comments

Comments
 (0)