1+ module . exports = function ( grunt ) {
2+
3+ grunt . loadNpmTasks ( 'grunt-contrib-clean' ) ;
4+ grunt . loadNpmTasks ( 'grunt-contrib-jshint' ) ;
5+ grunt . loadNpmTasks ( 'grunt-contrib-concat' ) ;
6+ grunt . loadNpmTasks ( "grunt-contrib-watch" ) ;
7+ grunt . loadNpmTasks ( 'grunt-jscs' ) ;
8+ grunt . loadNpmTasks ( 'grunt-contrib-uglify' ) ;
9+ grunt . loadNpmTasks ( 'grunt-karma' ) ;
10+ grunt . loadNpmTasks ( 'grunt-maven-tasks' ) ;
11+ grunt . loadNpmTasks ( 'grunt-html2js' ) ;
12+ grunt . loadNpmTasks ( 'grunt-contrib-connect' ) ;
13+ grunt . loadNpmTasks ( 'grunt-protractor-runner' ) ;
14+ grunt . loadNpmTasks ( 'grunt-bootlint' ) ;
15+ grunt . loadNpmTasks ( 'grunt-ng-annotate' ) ;
16+
17+ // Project configuration.
18+ grunt . initConfig ( {
19+
20+ pkg : grunt . file . readJSON ( 'package.json' ) ,
21+
22+ clean : {
23+ options : {
24+ force : true
25+ } ,
26+ dist : [ 'dist' ]
27+ } ,
28+
29+ ngAnnotate : {
30+ add : {
31+ options : {
32+ singleQuotes : true
33+ } ,
34+ files : {
35+ 'dist/angular-bootstrap-multiselect.js' : 'dist/angular-bootstrap-multiselect.js'
36+ }
37+ }
38+ } ,
39+
40+ bootlint : {
41+ options : {
42+ stoponerror : true ,
43+ relaxerror : [ 'E001' , 'W001' , 'W002' , 'W003' , 'W005' ]
44+ } ,
45+ files : [ 'src/**/*.html' ]
46+ } ,
47+
48+ jshint : {
49+ options : {
50+ jshintrc : '.jshintrc'
51+ } ,
52+ sources : {
53+ src : [ 'src/**/*.js' ]
54+ }
55+ } ,
56+
57+ jscs : {
58+ options : {
59+ config : '.jscsrc'
60+ } ,
61+ src : {
62+ src : '<%= jshint.sources.src %>'
63+ }
64+ } ,
65+
66+ html2js : {
67+ options : {
68+ base : 'src' ,
69+ module : 'btorfs.multiselect.templates'
70+ } ,
71+ main : {
72+ src : [ 'src/**/*.html' ] ,
73+ dest : 'dist/angular-bootstrap-multiselect-templates.js'
74+ }
75+ } ,
76+
77+ concat : {
78+ options : { } ,
79+ files : {
80+ src : [ 'src/**/*.js' , 'dist/angular-bootstrap-multiselect-templates.js' ] ,
81+ dest : 'dist/angular-bootstrap-multiselect.js'
82+ }
83+ } ,
84+
85+ uglify : {
86+ files : {
87+ src : 'dist/angular-bootstrap-multiselect.js' ,
88+ dest : 'dist/angular-bootstrap-multiselect.min.js'
89+ }
90+ } ,
91+
92+ karma : {
93+ ci : {
94+ configFile : 'test/unit/karma.conf.js' ,
95+ reporters : [ "dots" ]
96+ } ,
97+ dev : {
98+ configFile : 'test/unit/karma.conf.js'
99+ }
100+ } ,
101+
102+ watch : {
103+ karma : {
104+ files : [ 'src/**/*' , 'test/unit/**/*' ] ,
105+ tasks : [ 'build' , 'karma:dev' ]
106+ }
107+ } ,
108+
109+ connect : {
110+ e2e : {
111+ options : {
112+ port : 9000 ,
113+ base : '.'
114+ }
115+ }
116+ } ,
117+
118+ protractor : {
119+ options : {
120+ keepAlive : false ,
121+ configFile : "test/e2e/protractor.conf.js" ,
122+ args : {
123+ baseUrl : 'http://localhost:9000'
124+ }
125+ } ,
126+ run : { }
127+ }
128+
129+ } ) ;
130+
131+ // Quality checks
132+ grunt . registerTask ( 'check' , [ 'bootlint' , 'jshint' , 'jscs' ] ) ;
133+
134+ // Build files
135+ grunt . registerTask ( 'build' , [ 'html2js' , 'concat' , 'ngAnnotate' , 'uglify' ] ) ;
136+
137+ // Continuous integration task
138+ grunt . registerTask ( 'ci' , [ 'clean' , 'check' , 'build' , 'karma:ci' ] ) ;
139+
140+ // Run UI tests
141+ grunt . registerTask ( 'e2e' , [ 'connect' , 'protractor' ] ) ;
142+
143+ // Continously build and execute unit tests after every file change, during development
144+ grunt . registerTask ( 'dev' , [ 'build' , 'watch' ] ) ;
145+
146+ // Default task: does everything including UI tests
147+ grunt . registerTask ( 'default' , [ 'clean' , 'check' , 'build' , 'karma:ci' , 'e2e' ] ) ;
148+ } ;
0 commit comments