Skip to content
Browse files

cleanup

  • Loading branch information...
1 parent f56fed2 commit cd73e2d43c1c46439248c0435bd384cf5c92f1e6 @crcn crcn committed Mar 14, 2013
Showing with 44 additions and 22 deletions.
  1. +2 −0 .cupboard
  2. +18 −9 lib/build.js
  3. +1 −1 package.json
  4. +23 −12 src/build.coffee
View
2 .cupboard
@@ -0,0 +1,2 @@
+[commands]
+make=make clean all
View
27 lib/build.js
@@ -25,7 +25,8 @@
function _Class(ops, packageManagers) {
this._jam = packageManagers.packageManagers.jam;
this._directory = process.cwd();
- this._output = this._directory + "/" + (dref.get(ops.pkg, "jam.packageDir") || "jam");
+ this._prefix = dref.get(ops.pkg, "jam.packageDir") || "jam";
+ this._output = this._directory + "/" + this._prefix;
}
/*
@@ -41,12 +42,7 @@
return stepc.async((function() {
return fs.readdir(dir, this);
}), o.s(function(dirs) {
- dirs = dirs.map(function(d) {
- return dir + "/" + d;
- }).filter(function(d) {
- return path.basename(d).substr(0, 1) !== "." && fs.lstatSync(d).isDirectory();
- });
- return this(null, dirs);
+ return this(null, self._fixDirs(dir, dirs));
}), o.s(function(dirs) {
return self._amdifyAll(dirs, this);
}), o.s(function() {
@@ -58,6 +54,18 @@
*/
+ _Class.prototype._fixDirs = function(base, dirs) {
+ return dirs.map(function(d) {
+ return base + "/" + d;
+ }).filter(function(d) {
+ return path.basename(d).substr(0, 1) !== "." && fs.lstatSync(d).isDirectory();
+ });
+ };
+
+ /*
+ */
+
+
_Class.prototype._amdifyAll = function(dirs, callback) {
var _this = this;
return async.map(dirs, (function(dir, callback) {
@@ -75,12 +83,13 @@
var _this = this;
return amdify({
entry: require.resolve(dir),
- directory: this._output
+ directory: this._directory,
+ prefix: this._prefix
}, outcome.e(callback).s(function(bundle) {
var transformer;
transformer = new at.Template("amd");
transformer = new at.Copy({
- output: _this._output
+ output: _this._directory
}, transformer);
return bundle.transform(transformer, callback);
}));
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "nojam",
- "version": "0.0.0",
+ "version": "0.0.1",
"description": "nodejam =======",
"main": "./lib/index.js",
"scripts": {
View
35 src/build.coffee
@@ -8,7 +8,6 @@ fs = require "fs"
path = require "path"
dref = require "dref"
-
module.exports = class
###
@@ -17,7 +16,8 @@ module.exports = class
constructor: (ops, packageManagers) ->
@_jam = packageManagers.packageManagers.jam
@_directory = process.cwd()
- @_output = @_directory + "/" + (dref.get(ops.pkg, "jam.packageDir") or "jam");
+ @_prefix = (dref.get(ops.pkg, "jam.packageDir") or "jam");
+ @_output = @_directory + "/" + @_prefix
###
@@ -36,14 +36,7 @@ module.exports = class
fs.readdir dir, @
),
(o.s (dirs) ->
-
- dirs = dirs.map((d) ->
- dir + "/" + d
- ).filter (d) ->
- path.basename(d).substr(0,1) isnt "." and fs.lstatSync(d).isDirectory()
-
-
- this null, dirs
+ this null, self._fixDirs(dir, dirs)
),
(o.s (dirs) ->
self._amdifyAll dirs, this
@@ -57,24 +50,42 @@ module.exports = class
###
###
+ _fixDirs: (base, dirs) ->
+ dirs.map((d) ->
+ base + "/" + d
+ ).filter (d) ->
+ path.basename(d).substr(0,1) isnt "." and fs.lstatSync(d).isDirectory()
+
+
+ ###
+ ###
+
_amdifyAll: (dirs, callback) ->
async.map dirs, ((dir, callback) =>
@_amdify dir, (err) ->
callback()
), callback
+
+
+
+
+
+
###
###
_amdify: (dir, callback) ->
+
amdify {
entry: require.resolve(dir),
- directory: @_output
+ directory: @_directory,
+ prefix: @_prefix
}, outcome.e(callback).s (bundle) =>
transformer = new at.Template("amd")
- transformer = new at.Copy({ output: @_output }, transformer)
+ transformer = new at.Copy({ output: @_directory }, transformer)
bundle.transform(transformer, callback)

0 comments on commit cd73e2d

Please sign in to comment.
Something went wrong with that request. Please try again.