Skip to content

Instantly share code, notes, and snippets.

@nandiraju
Forked from RhinoLance/Gruntfile.js
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save nandiraju/c59d29e074318a5b1d8d to your computer and use it in GitHub Desktop.

Select an option

Save nandiraju/c59d29e074318a5b1d8d to your computer and use it in GitHub Desktop.

Revisions

  1. @RhinoLance RhinoLance created this gist Dec 3, 2013.
    108 changes: 108 additions & 0 deletions Gruntfile.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,108 @@
    /*global module:false*/
    module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    meta: {
    banner: '/*! <%= pkg.name || pkg.name %> - v<%= pkg.version %> - ' +
    '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
    '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
    '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;' +
    ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
    },
    concat: {
    dist: {
    src: ['www/js/**/*.js'],
    dest: 'www/js/<%= pkg.name %>.concat.js'
    }
    },
    uglify: {
    options: {
    banner: '<%= banner %>',
    mangle: true,
    beautify: false
    },
    dist: {
    src: 'www/js/<%= pkg.name %>.js',
    dest: 'www/js/<%= pkg.name %>.min.js'
    }
    },
    bumpup: ['package.json', 'www/js/build.json'],
    shell: {
    options: {
    failOnError: true,
    stdout: false,
    stderr: true
    },
    build: {
    command: 'cordova build ios android'
    },
    prepare: {
    command: 'cordova prepare'
    },
    buildIpa: {
    command: '/usr/bin/xcrun -sdk iphoneos PackageApplication -v "/<projectPath>/platforms/ios/build/Crocpad.app" -o "/<projectPath>/platforms/ios/build/CrocPad.ipa" --sign "iPhone Distribution: Rhino Software Pty Ltd (F86TA6JRXE)" --embed "/<projectPath>/Dev/Keys/iOS/Rhino_Software_AdHoc.mobileprovision"'
    }
    },
    jshint: {
    options: {
    curly: true,
    eqeqeq: false,
    immed: true,
    latedef: true,
    newcap: true,
    noarg: true,
    sub: true,
    undef: true,
    boss: true,
    devel: true,
    eqnull: true,
    browser: true,
    smarttabs: true,
    jquery: true
    },
    all: ['Gruntfile.js', 'www/js/*.js']
    },
    copy: {
    main: {
    files: [
    {
    expand: true, flatten: true, filer: 'isFile',
    src: ['platforms/ios/build/CrocPad.ipa'],
    dest: '/<projectPath>/Dev/Client/buid/ios/'
    },
    {
    expand: true, flatten: true,
    src: ['platforms/android/bin/CrocPad-debug.apk'],
    dest: '/<projectPath>/Dev/Client/buid/android/'
    },
    {
    expand: true, flatten: true,
    src: ['package.json'],
    dest: '/<projectPath>/Dev/Client/buid/'
    }
    ]
    }
    }
    });

    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-bumpup');


    // Default task
    grunt.registerTask('default', ['bumpup:build', 'jshint', 'shell:build', 'shell:buildIpa', 'copy']);

    // Custom tasks
    grunt.registerTask('prepare', ['jshint', 'shell:prepare']);

    // Custom tasks
    grunt.registerTask('ipa', ['shell:buildIpa', 'copy']);

    };