function runGithubTasks(){
        function writeHeader(header){
            grunt.log.writeln('');
            _console.writelnYellow('**************************************************');
            _console.writelnYellow(header.toUpperCase());
        }

        if (!grunt.config('continue'))
            return 0;

        //Get new version and commit ang tag messages
        var newVersion    = grunt.config('newVersion') == 'none' ? '' : semver.inc(options.currentVersion, grunt.config('newVersion')),
            commitMessage = grunt.config('commitMessage') || 'No message',
            tagMessage    = grunt.config('tagMessage') || '',
            userName;

        if (newVersion){
            //Create tagMessage
            userName   = grunt.config('gitinfo').userName || grunt.fcoo.bowerJson.authors; //grunt.fcoo.bowerJson.authors is fall-back
            tagMessage = ' -m "Version '  + newVersion + '"'  +
                         ' -m "Released '+ grunt.fcoo.todayStr +' by '+ userName +' (https://github.com/orgs/FCOO/people)"' +
                         (tagMessage ? ' -m "' + tagMessage + '"' : '');

            //Update grunt.fcoo.bowerJson
            grunt.fcoo.bowerJson.version = newVersion;
        }

        //Build application/packages
        if (grunt.config('build')){
            writeHeader('Build/compile the '+(options.isApplication ? 'application' : 'packages'));
            common.runCmd('grunt build', true);
        }

        //Bump bower.json and packages.json
        if (newVersion){
            writeHeader('Bump \'version: "'+newVersion+'"\' to bower.json and package.json');
            var files = ['bower.json', 'package.json'], file, json;
            for (var i=0; i<files.length; i++ ){
                file = files[i];
                json = grunt.file.readJSON(file);
                json.version = newVersion;
                grunt.file.write(file, JSON.stringify(json, null, '  ') + '\n');
                grunt.log.writeln(file+'-OK');
            }

            //Replace {VERSION] with newVersion in all js in dist
            if (options.isPackage){
                common.runCmd('grunt replace:Dist_js_version');  
            }
            
        }

        //git add all
        common.runCmd('git add -A');

        //commit or amend
        if (grunt.config('commit') == 'commit'){
            //commit
            writeHeader('Commit staged changes to a new snapshot');
            common.runCmd('git commit  -m "' + commitMessage + '"');
        }
        else {
            writeHeader('Combine/amend staged changes with the previous commit');
            common.runCmd('git commit --amend --no-edit');
        }


        //git tag
        if (newVersion){
            writeHeader('Create new tag="'+newVersion+'"');
            common.runCmd('git tag ' + newVersion + tagMessage);
        }

        //git push (and push tag)
        writeHeader('Push all branches '+(newVersion ? 'and tags ' : '')+'to GitHub');

        common.runCmd('git push "origin" HEAD');

        if (newVersion)
            common.runCmd('git push "origin" ' + newVersion);


        //Merge "master" into "gh-pages"
        if (options.haveGhPages){
            writeHeader('Merge "master" branch into "gh-pages" branch');
            common.runCmd('git checkout -B "gh-pages"');
            common.runCmd('git merge master');
            common.runCmd('git checkout master');
            common.runCmd('git push "origin" gh-pages');
        }
    }
function runGithubTasks(){
        function writeHeader(header){
            grunt.log.writeln('');
            _console.writelnYellow('**************************************************');
            _console.writelnYellow(header.toUpperCase());
        }

        if (!grunt.config('continue'))
            return 0;

        
        var newVersion    = grunt.config('newVersion') == 'none' ? '' : semver.inc(options.currentVersion, grunt.config('newVersion')),
            commitMessage = grunt.config('commitMessage') || 'No message',
            tagMessage    = grunt.config('tagMessage') || '',
            userName;

        if (newVersion){
            
            userName   = grunt.config('gitinfo').userName || grunt.fcoo.bowerJson.authors; 
            tagMessage = ' -m "Version '  + newVersion + '"'  +
                         ' -m "Released '+ grunt.fcoo.todayStr +' by '+ userName +' (https:
                         (tagMessage ? ' -m "' + tagMessage + '"' : '');

            
            grunt.fcoo.bowerJson.version = newVersion;
        }

        
        if (grunt.config('build')){
            writeHeader('Build/compile the '+(options.isApplication ? 'application' : 'packages'));
            common.runCmd('grunt build', true);
        }

        
        if (newVersion){
            writeHeader('Bump \'version: "'+newVersion+'"\' to bower.json and package.json');
            var files = ['bower.json', 'package.json'], file, json;
            for (var i=0; i<files.length; i++ ){
                file = files[i];
                json = grunt.file.readJSON(file);
                json.version = newVersion;
                grunt.file.write(file, JSON.stringify(json, null, '  ') + '\n');
                grunt.log.writeln(file+'-OK');
            }

            
            if (options.isPackage){
                common.runCmd('grunt replace:Dist_js_version');  
            }
            
        }

        
        common.runCmd('git add -A');

        
        if (grunt.config('commit') == 'commit'){
            
            writeHeader('Commit staged changes to a new snapshot');
            common.runCmd('git commit  -m "' + commitMessage + '"');
        }
        else {
            writeHeader('Combine/amend staged changes with the previous commit');
            common.runCmd('git commit --amend --no-edit');
        }


        
        if (newVersion){
            writeHeader('Create new tag="'+newVersion+'"');
            common.runCmd('git tag ' + newVersion + tagMessage);
        }

        
        writeHeader('Push all branches '+(newVersion ? 'and tags ' : '')+'to GitHub');

        common.runCmd('git push "origin" HEAD');

        if (newVersion)
            common.runCmd('git push "origin" ' + newVersion);


        
        if (options.haveGhPages){
            writeHeader('Merge "master" branch into "gh-pages" branch');
            common.runCmd('git checkout -B "gh-pages"');
            common.runCmd('git merge master');
            common.runCmd('git checkout master');
            common.runCmd('git push "origin" gh-pages');
        }
    }
function runGithubTasks ( ) { function writeHeader ( header ) { grunt . log . writeln ( '' ) ; _console . writelnYellow ( '**************************************************' ) ; _console . writelnYellow ( header . toUpperCase ( ) ) ; } if ( ! grunt . config ( 'continue' ) ) return 0 ; //Get new version and commit ang tag messages var newVersion = grunt . config ( 'newVersion' ) == 'none' ? '' : semver . inc ( options . currentVersion , grunt . config ( 'newVersion' ) ) , commitMessage = grunt . config ( 'commitMessage' ) || 'No message' , tagMessage = grunt . config ( 'tagMessage' ) || '' , userName ; if ( newVersion ) { //Create tagMessage userName = grunt . config ( 'gitinfo' ) . userName || grunt . fcoo . bowerJson . authors ; //grunt.fcoo.bowerJson.authors is fall-back tagMessage = ' -m "Version ' + newVersion + '"' + ' -m "Released ' + grunt . fcoo . todayStr + ' by ' + userName + ' (https://github.com/orgs/FCOO/people)"' + ( tagMessage ? ' -m "' + tagMessage + '"' : '' ) ; //Update grunt.fcoo.bowerJson grunt . fcoo . bowerJson . version = newVersion ; } //Build application/packages if ( grunt . config ( 'build' ) ) { writeHeader ( 'Build/compile the ' + ( options . isApplication ? 'application' : 'packages' ) ) ; common . runCmd ( 'grunt build' , true ) ; } //Bump bower.json and packages.json if ( newVersion ) { writeHeader ( 'Bump \'version: "' + newVersion + '"\' to bower.json and package.json' ) ; var files = [ 'bower.json' , 'package.json' ] , file , json ; for ( var i = 0 ; i < files . length ; i ++ ) { file = files [ i ] ; json = grunt . file . readJSON ( file ) ; json . version = newVersion ; grunt . file . write ( file , JSON . stringify ( json , null , '  ' ) + '\n' ) ; grunt . log . writeln ( file + '-OK' ) ; } //Replace {VERSION] with newVersion in all js in dist if ( options . isPackage ) { common . runCmd ( 'grunt replace:Dist_js_version' ) ; } } //git add all common . runCmd ( 'git add -A' ) ; //commit or amend if ( grunt . config ( 'commit' ) == 'commit' ) { //commit writeHeader ( 'Commit staged changes to a new snapshot' ) ; common . runCmd ( 'git commit  -m "' + commitMessage + '"' ) ; } else { writeHeader ( 'Combine/amend staged changes with the previous commit' ) ; common . runCmd ( 'git commit --amend --no-edit' ) ; } //git tag if ( newVersion ) { writeHeader ( 'Create new tag="' + newVersion + '"' ) ; common . runCmd ( 'git tag ' + newVersion + tagMessage ) ; } //git push (and push tag) writeHeader ( 'Push all branches ' + ( newVersion ? 'and tags ' : '' ) + 'to GitHub' ) ; common . runCmd ( 'git push "origin" HEAD' ) ; if ( newVersion ) common . runCmd ( 'git push "origin" ' + newVersion ) ; //Merge "master" into "gh-pages" if ( options . haveGhPages ) { writeHeader ( 'Merge "master" branch into "gh-pages" branch' ) ; common . runCmd ( 'git checkout -B "gh-pages"' ) ; common . runCmd ( 'git merge master' ) ; common . runCmd ( 'git checkout master' ) ; common . runCmd ( 'git push "origin" gh-pages' ) ; } }
******************************************************* runGithubTasks: Run all the needed github-commands *******************************************************
******************************************************* runGithubTasks : Run all the needed github - commands *******************************************************