Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
chore(bower): write grunt task for running bower
Browse files Browse the repository at this point in the history
  • Loading branch information
ksheedlo committed Jul 31, 2013
1 parent a7ae292 commit aa5a162
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 24 deletions.
9 changes: 1 addition & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,5 @@ env:
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
- SAUCE_CONNECT_READY_FILE=/tmp/sauce-connect-ready

before_script:
- export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
- ./lib/sauce/sauce_connect_setup.sh
- npm install -g grunt-cli
- grunt ci-checks package
- ./lib/sauce/sauce_connect_block.sh

script:
- grunt parallel:travis --reporters dots --browsers SL_Chrome
- ./travis_build.sh
17 changes: 2 additions & 15 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jasmine-node');
grunt.loadNpmTasks('grunt-ddescribe-iit');
grunt.loadNpmTasks('grunt-merge-conflict');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-parallel');
grunt.loadTasks('lib/grunt');

Expand Down Expand Up @@ -102,18 +101,6 @@ module.exports = function(grunt) {
clean: {build: ['build']},


shell: {
bower: {
command: 'node ./node_modules/bower/bin/bower install',
options: {
stdout: true,
stderr: true,
failOnError: true
}
}
},


build: {
scenario: {
dest: 'build/angular-scenario.js',
Expand Down Expand Up @@ -245,10 +232,10 @@ module.exports = function(grunt) {
//alias tasks
grunt.registerTask('test:unit', ['test:jqlite', 'test:jquery', 'test:modules']);
grunt.registerTask('test:docgen', ['jasmine-node']);
grunt.registerTask('minify', ['shell:bower','clean', 'build', 'minall']);
grunt.registerTask('minify', ['bower','clean', 'build', 'minall']);
grunt.registerTask('test:e2e', ['connect:testserver', 'test:end2end']);
grunt.registerTask('webserver', ['connect:devserver']);
grunt.registerTask('package', ['shell:bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']);
grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']);
grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict']);
grunt.registerTask('default', ['package']);
};
12 changes: 12 additions & 0 deletions lib/grunt/plugins.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
var bower = require('bower');
var util = require('./utils.js');
var spawn = require('child_process').spawn;

Expand Down Expand Up @@ -63,4 +64,15 @@ module.exports = function(grunt) {
grunt.registerTask('collect-errors', 'Combine stripped error files', function () {
util.collectErrors();
});

grunt.registerTask('bower', 'Install Bower packages.', function () {
var done = this.async();

bower.commands.install()
.on('log', function (result) {
grunt.log.ok('bower: ' + result.id + ' ' + result.data.endpoint.name);
})
.on('error', grunt.fail.warn.bind(grunt.fail))
.on('end', done);
});
};
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"grunt-contrib-compress": "0.4.1",
"grunt-contrib-connect": "0.1.2",
"grunt-contrib-copy": "0.4.1",
"grunt-shell": "~0.2.2",
"jasmine-node": "1.2.3",
"q": "~0.9.2",
"q-fs": "0.1.36",
Expand Down
21 changes: 21 additions & 0 deletions travis_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -xe

warn() {
tput setaf 1
echo "[ERROR] Received $1"
tput sgr0
exit 1
}

trap "warn SIGINT" SIGINT
trap "warn SIGTERM" SIGTERM
trap "warn SIGHUP" SIGHUP

export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
./lib/sauce/sauce_connect_setup.sh
npm install -g grunt-cli
grunt ci-checks package
./lib/sauce/sauce_connect_block.sh
grunt parallel:travis --reporters dots --browsers SL_Chrome

0 comments on commit aa5a162

Please sign in to comment.