This repository has been archived by the owner on Dec 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 🚧 Added task running from files 🚧 TODO: Add deps
- Loading branch information
Showing
7 changed files
with
209 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Sample buildup | ||
//const tools = require('buildup').tools; | ||
module.exports = (buildup) => { | ||
buildup.task('test', function (done) { | ||
buildup.logger.info('Task ran'); | ||
done(); | ||
}) | ||
} |
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,34 @@ | ||
// File for the api | ||
'use strict' | ||
/** | ||
* Module dependencies | ||
*/ | ||
const Log = require('./logger').Logger; | ||
/** | ||
* Vars | ||
*/ | ||
let app = module.exports = {}; | ||
app.that = this; | ||
app.that.tasks = {}; | ||
|
||
/** | ||
* Task loader api | ||
* @param name {String} name of task | ||
* @param deps {Array} or {Function} deps for task | ||
* @param method {Function} Method | ||
*/ | ||
app.taskloader = (name, deps, method) => { | ||
if (typeof deps === 'function') { | ||
app.that.tasks[name] = { method: deps } | ||
} | ||
} | ||
|
||
/** | ||
* API | ||
*/ | ||
app.api = () => { | ||
return { | ||
logger: new Log('task'), | ||
task: app.taskloader | ||
}; | ||
} |
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,16 @@ | ||
// Callback stuff | ||
'use strict' | ||
/** | ||
* Vars | ||
*/ | ||
let app = module.exports = {}; | ||
|
||
/** | ||
* Done fun | ||
* @param err {Error} The error | ||
*/ | ||
app.done = (err) => { | ||
if (typeof err !== 'undefined') { | ||
throw err; | ||
} | ||
} |
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,36 @@ | ||
// Loads from file | ||
'use strict' | ||
/** | ||
* Module dependencies | ||
*/ | ||
const Log = require('./logger').Logger; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const api = require('./api'); | ||
let ENV = process.env; | ||
let PWD = process.cwd(); | ||
let logger = new Log('buildup') | ||
/** | ||
* Vars | ||
*/ | ||
let app = module.exports = {}; | ||
/** | ||
* Load file | ||
* | ||
*/ | ||
app.loadFromFile = () => { | ||
logger.debug('Loading from file...') | ||
let file; | ||
const done = this.async; | ||
fs.stat(path.join(PWD, 'buildupfile.js'), function (err, stst) { | ||
if (err) { | ||
logger.err( | ||
err, | ||
'the fact we couldn\'t find a \'buildupfile.js\' in the current directory', | ||
'To create a new file, run \'buildup init\'' | ||
) | ||
} | ||
}) | ||
file = require(path.join(PWD, 'buildupfile.js'))(api.api()) | ||
return api.that; | ||
} |
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,40 @@ | ||
// Sample buildup | ||
const git = require('buildup-git'); | ||
const tools = require('buildup').tools; | ||
const coffee= require('buildup-coffee'); | ||
const npm = require('buildup-npm') | ||
const include = require('buildup-include'); | ||
module.exports = (buildup) => { | ||
buildup.task('clone', function () { | ||
return git.clone('https://github.com', { | ||
dir: './repo' | ||
}); | ||
}) | ||
buildup.task('install', ['clone'], function (done) { | ||
npm.install() | ||
done() | ||
}) | ||
buildup.task('build:js', ['install'], function (done) { | ||
buildup.src('./src', '.coffee') | ||
.pipe(coffee.compile({ | ||
out: './lib' | ||
})) | ||
done() | ||
}) | ||
buildup.task('build:cpp', ['build:js'], function (done) { | ||
include([ | ||
'https://github.com/Gum-Joe/jakhu-tester/master.zip' | ||
]) | ||
buildup.src('./cpp', '.cpp') | ||
.pipe(buildup.compile({ | ||
compiler: 'autodetect', | ||
out: './build', | ||
nodeGyp: true | ||
})) | ||
done() | ||
}) | ||
buildup.task('build', ['build:cpp'], function (done) { | ||
buildup.logger.info('Built!') | ||
done(); | ||
}) | ||
} |