Betabeers
Noviembre 2014
require('build');
Drupal e integración continua
Desarrollo de juegos en html5
Los gruñidos de mi build
Automatizado
Que genera un entregable
necesario para la integración continua
y facilita la entrada de nuevos miembros al equipo
PREPARE
COMPILE
UNIT TEST
PACKAGE
INTEGRATION TEST
VERIFY
npm install
bower install
sass less coffee
karma mocha qunit jasmine
zip nar min
pioneer selenium phantomJS
jslint jshint coverage
#!/bin/sh
grunt test
exit $?
Pre-commit
TOOLS
Task oriented
Product oriented
Ant
Grunt
Gulp*
MsBuild ..
Maven
Make
Rake*
grunt.registerTask('build', [
'clean:dist',
'wiredep',
'browserify',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'cssmin',
'uglify',
'copy:dist',
'modernizr',
'usemin',
'htmlmin'
]);
python -m SimpleHTTPServer
UGLIFYJS = ./node_modules/.bin/uglifyjs
BANNER = "/*! Backbone Validater - MIT License - https://github.com/rafinskipg/Backbone.Validater */"
KARMA = ./node_modules/karma/bin/karma
default: test
test: karma build
karma:
$(KARMA) start
build:
$(UGLIFYJS) app/main.js --mangle --preamble $(BANNER) > dist/Backbone.Validater.min.js
loc:
wc -l app/main.js
publish: test build
git push --tags origin HEAD:master
TAKE CARE OF YOUR BUILD
REQUIRE
CommonJS
'use strict';
var jquery = require('jquery');
function doSomething(){
console.log('Hey BBMad!');
}
module.exports = doSomething
AMD
define(['jquery'], function ($) {
// methods
function doSomething(){
console.log('Hey BBMad!');
};
// exposed public methods
return doSomething;
});
UMD
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(["jquery"], factory);
} else if (typeof exports === "object") {
module.exports = factory(require("jquery")));
} else {
root.Requester = factory(root.$);
}
}(this, function ($) {
var doSomething = function(){
console.log('Hey BBMad!');
}
return doSomething;
}));
THERE'S A GRUNT PLUGIN FOR THAT
https://github.com/rafinskipg/talkbetabeersnov
language: node_js
node_js:
- "0.10"
before_install:
- npm install -g grunt-cli
- npm install -g bower
install:
- npm install
- bower install
@rafinskipg
rvpg.me
Referencias