@@ -176,16 +176,20 @@ module.exports = function(grunt) {
176
176
}
177
177
} ;
178
178
179
- if ( grunt . option ( 'dev' ) ) {
180
- gruntConfig . pkg . release = 'dev' ;
181
- gruntConfig . pkg . version = gruntConfig . pkg . version + '-post' ;
182
- } else {
183
- gruntConfig . pkg . release = gruntConfig . pkg . version ;
184
- }
185
-
186
179
grunt . initConfig ( gruntConfig ) ;
187
180
188
181
// Custom Grunt tasks
182
+ grunt . registerTask ( 'version' , function ( ) {
183
+ var pkg = grunt . config . get ( 'pkg' ) ;
184
+ if ( grunt . option ( 'dev' ) ) {
185
+ pkg . release = 'dev' ;
186
+ pkg . version = grunt . config . get ( 'gitinfo' ) . local . branch . current . shortSHA ;
187
+ } else {
188
+ pkg . release = pkg . version ;
189
+ }
190
+ grunt . config . set ( 'pkg' , pkg ) ;
191
+ } ) ;
192
+
189
193
grunt . registerMultiTask ( 'fixSourceMaps' , function ( ) {
190
194
this . files . forEach ( function ( f ) {
191
195
var result ;
@@ -224,8 +228,8 @@ module.exports = function(grunt) {
224
228
grunt . loadNpmTasks ( 'grunt-gitinfo' ) ;
225
229
226
230
// Build tasks
227
- grunt . registerTask ( 'build.core' , [ 'clean' , 'gitinfo' , 'concat:core' , 'uglify' , 'fixSourceMaps' ] ) ;
228
- grunt . registerTask ( 'build.all' , [ 'clean' , 'gitinfo' , 'concat:all' , 'uglify' , 'fixSourceMaps' ] ) ;
231
+ grunt . registerTask ( 'build.core' , [ 'clean' , 'gitinfo' , 'version' , ' concat:core', 'uglify' , 'fixSourceMaps' ] ) ;
232
+ grunt . registerTask ( 'build.all' , [ 'clean' , 'gitinfo' , 'version' , ' concat:all', 'uglify' , 'fixSourceMaps' ] ) ;
229
233
grunt . registerTask ( 'build' , [ 'build.all' ] ) ;
230
234
grunt . registerTask ( 'dist' , [ 'build.core' , 'copy:dist' ] ) ;
231
235
0 commit comments