Skip to content

Commit

Permalink
Use bower for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
kuraga committed Aug 1, 2014
1 parent 3c8ebf4 commit 77a3a04
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
bower_components/
lib/
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm install
- ./node_modules/.bin/grunt install

script:
- ./node_modules/.bin/grunt test
31 changes: 20 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
module.exports = function(grunt) {

var lib = [
'jquery/dist/jquery.min.js',
'angular/angular.min.js',
'typeahead.js/dist/typeahead.bundle.js'
];

grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-zip');
grunt.loadNpmTasks('grunt-jquerymanifest');
grunt.loadNpmTasks('grunt-bower-task');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

bower: {
install: {
options: {
targetDir: './lib',
layout: 'byType',
install: true,
verbose: true,
cleanTargetDir: false,
cleanBowerDir: true,
bowerOptions: {
forceLatest: true
}
}
}
},
copy: {
build: {
files: [
{expand: true, flatten: true, src: ['src/*.*'], dest: 'dist/', filter: 'isFile'},

{expand: true, flatten: false, cwd: 'bower_components/', src: [lib], dest: 'test/lib/'}
{ expand: true, flatten: true, src: ['src/*.*'], dest: 'dist/', filter: 'isFile' }
]
}
},
Expand Down Expand Up @@ -63,6 +70,8 @@ module.exports = function(grunt) {
}
});

grunt.registerTask('install', ['bower']);
grunt.registerTask('compile', ['uglify', 'copy']);
grunt.registerTask('test', ['compile', 'karma']);
grunt.registerTask('build', ['test', 'jquerymanifest', 'zip']);
grunt.registerTask('test', ['uglify', 'copy', 'karma']);
};
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
"lib",
"test"
],
"dependencies": {
"jquery": "~2.1.1"
Expand Down
8 changes: 4 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ module.exports = function(config) {
basePath: '',
frameworks: ['jasmine'],
files: [
'test/lib/jquery/dist/jquery.min.js',
'test/lib/angular/angular.min.js',
'src/bootstrap-tagsinput.js',
'src/bootstrap-tagsinput-angular.js',
'lib/jquery/jquery.js',
'lib/angular/angular.js',
'dist/bootstrap-tagsinput.min.js',
'dist/bootstrap-tagsinput-angular.min.js',
'test/helpers.js',
{ pattern: 'test/bootstrap-tagsinput/*.tests.js' }
],
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"phantomjs": "~1.9.7-15",
"karma-phantomjs-launcher": "~0.1.3",
"karma-jasmine": "~0.1.5",
"grunt-karma": "~0.8.3"
"grunt-karma": "~0.8.3",
"bower": "~1.3.8",
"grunt-bower-task": "~0.4.0"
},
"banner": "/*\n * <%= pkg.name %> v<%= pkg.version %> by <%= pkg.author %>\n * <%= pkg.license.url %>\n */\n"
}

0 comments on commit 77a3a04

Please sign in to comment.