Permalink
Browse files

Add type support to package target, available types: tar.gz (default)…

… and zip.
  • Loading branch information...
cliffano committed Nov 25, 2012
1 parent a565a33 commit d5868274babf98695c45ba18a0cfc62c75a23bf8
Showing with 31 additions and 13 deletions.
  1. +1 −1 CHANGELOG.md
  2. +3 −3 README.md
  3. +3 −3 conf/Makefile
  4. +15 −0 conf/tools.json
  5. +7 −6 lib/bob.js
  6. +2 −0 test/bob.js
View
@@ -1,5 +1,5 @@
### 0.5.11 (SNAPSHOT)
-*
+* Add type support to package target, available types: tar.gz (default) and zip
### 0.5.10
* Add proxy support to updep target
View
@@ -144,9 +144,9 @@ Targets
</tr>
<tr>
<td>package</td>
- <td>Create a .tar.gz package file in .bob/artifact/ directory, along with md5 and sha1 checksums of the artifact file.</td>
- <td>-</td>
- <td>src</td>
+ <td>Create a package file in .bob/artifact/ directory, along with md5 and sha1 checksums of the artifact file.</td>
+ <td>tar.gz (default), zip</td>
+ <td>src, bin, opts, files</td>
</tr>
<tr>
<td>publish</td>
View
@@ -68,9 +68,9 @@ depgraph: init
package: init
mkdir -p .bob/artifact/${name}-${version}
rsync -av --exclude-from=${bob}/conf/package-exclude ${src}/ .bob/artifact/${name}-${version}
- cd .bob/artifact/; tar -X ${bob}/conf/package-exclude -cvzf ${name}-${version}.tar.gz ${name}-${version}/
- $(call exec_sum,md5,.bob/artifact/${name}-${version}.tar.gz)
- $(call exec_sum,sha1,.bob/artifact/${name}-${version}.tar.gz)
+ cd .bob/artifact/; ${package_bin} ${package_opts} ${name}-${version}.${package_type} ${package_files}
+ $(call exec_sum,md5,.bob/artifact/${name}-${version}.${package_type})
+ $(call exec_sum,sha1,.bob/artifact/${name}-${version}.${package_type})
publish: ${publish_dep}
View
@@ -157,6 +157,21 @@
}
}
},
+ "package": {
+ "default": "tar.gz",
+ "types": {
+ "tar.gz": {
+ "bin": "tar",
+ "opts": "-X ${bob}/conf/package-exclude -cvzf",
+ "files": "${name}-${version}/"
+ },
+ "zip": {
+ "bin": "zip",
+ "opts": "-x ${bob}/conf/package-exclude -r",
+ "files": "${name}-${version}/"
+ }
+ }
+ },
"publish": {
"default": "npm",
"types": {
View
@@ -63,13 +63,14 @@ Bob.prototype.external = function (targets, mode, verbose, cb) {
function _constructParams(target, targets, i) {
// determine target type
- var tool = self.tools[target].types[
- bag.obj.exist(target + '.type', self.custom) ?
- self.custom[target].type :
- self.tools[target]['default']
- ];
+ var type = bag.obj.exist(target + '.type', self.custom) ?
+ self.custom[target].type : self.tools[target]['default'],
+ tool = self.tools[target].types[type];
- // set default tool properties
+ // set target type, e.g. package_type: 'tar.gz'
+ params[target + '_type'] = type;
+
+ // set default tool properties, e.g. package_bin: 'tar'
_.keys(tool).forEach(function (prop) {
if (typeof tool[prop] === 'object') {
params[target + '_' + prop] = tool[prop][mode];
View
@@ -112,6 +112,7 @@ describe('bob', function () {
});
checks.make_file.should.equal('/app/bob/conf/Makefile');
checks.make_verbose.should.equal(true);
+ checks.make_exec_params.lint_type.should.equal('jshint');
checks.make_exec_params.lint_bin.should.equal('/usr/bin/jshint');
checks.make_exec_targets.length.should.equal(2);
checks.make_exec_targets[0].should.equal('clean');
@@ -128,6 +129,7 @@ describe('bob', function () {
});
checks.make_file.should.equal('/app/bob/conf/Makefile');
checks.make_verbose.should.equal(true);
+ checks.make_exec_params.lint_type.should.equal('nodelint');
checks.make_exec_params.lint_bin.should.equal('/usr/local/bin/nodelint');
checks.make_exec_targets.length.should.equal(2);
checks.make_exec_targets[0].should.equal('clean');

0 comments on commit d586827

Please sign in to comment.