Skip to content

Commit

Permalink
fixing options.type issue and adding more tests around it
Browse files Browse the repository at this point in the history
  • Loading branch information
doowb committed Mar 11, 2014
1 parent 3916bf0 commit ead845a
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 7 deletions.
11 changes: 9 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@ module.exports = function(grunt) {
options: {
type: 'xml'
},
src: ['test/fixtures/xml-content.xyz'],
dest: 'tmp/result/xml-content.json'
files: [
{
expand: true,
cwd: 'test/fixtures/custom/',
src: ['*.*'],
dest: 'tmp/result/custom/',
ext: '.json'
}
]
},
adv: {
options: {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,4 @@ Please see the [Contributing to Assemble](http://assemble.io/contributing) guide

***

_This file was generated by [grunt-readme](https://github.com/assemble/grunt-readme) on Saturday, February 15, 2014._
_This file was generated by [grunt-readme](https://github.com/assemble/grunt-readme) on Tuesday, March 11, 2014._
8 changes: 4 additions & 4 deletions tasks/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
}
});

if (options.type && options.type.indexOf('.') === -1) {
options.type = '.' + options.type;
}

grunt.verbose.writeflags(options, 'Options');

async.forEach(this.files, function (f, next) {
Expand All @@ -53,10 +57,6 @@
return;
}

if (options.type) {
options.type = '.' + options.type;
}

var srcFiles = f.src.map(grunt.file.read).join(grunt.util.normalizelf(grunt.util.linefeed)),
srcExt = options.type ||path.extname(f.src[0]),
destExt = path.extname(f.dest),
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions test/fixtures/custom/xml-content-foo.foo
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<sdk:source>
<!-- Generated at Fri Mar 30 10:43:44 2012 from ics-mr1 @ 302030 -->
<sdk:revision>2</sdk:revision>
<sdk:api-level>15</sdk:api-level>
<sdk:archives>
<sdk:archive arch="any" os="any">
<sdk:size>16468746</sdk:size>
<sdk:checksum type="sha1">e5992a5747c9590783fbbdd700337bf0c9f6b1fa</sdk:checksum>
<sdk:url>sources-15_r02.zip</sdk:url>
</sdk:archive>
</sdk:archives>
<sdk:uses-license ref="android-sdk-license"/>
</sdk:source>
14 changes: 14 additions & 0 deletions test/fixtures/custom/xml-content-xyz.xyz
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<sdk:source>
<!-- Generated at Fri Mar 30 10:43:44 2012 from ics-mr1 @ 302030 -->
<sdk:revision>2</sdk:revision>
<sdk:api-level>15</sdk:api-level>
<sdk:archives>
<sdk:archive arch="any" os="any">
<sdk:size>16468746</sdk:size>
<sdk:checksum type="sha1">e5992a5747c9590783fbbdd700337bf0c9f6b1fa</sdk:checksum>
<sdk:url>sources-15_r02.zip</sdk:url>
</sdk:archive>
</sdk:archives>
<sdk:uses-license ref="android-sdk-license"/>
</sdk:source>

0 comments on commit ead845a

Please sign in to comment.