how we use grunt

for automating our dev process

the kona app DEVelopment


  • Three AngularJS apps (left, main and right panes)
  • Native PhoneGap projects with dumb UI and JS bridge
  • Configurable for environment/platform
  • Unit and E2E test suites
  • Staging server for development builds with OTA install
  • Team notification with linked PT stories
  • Build/deploy kicked off via Jenkins CI server

LOCAL DEVELOPMENT

 $ grunt dev
  • Clean /dev directory
  • Compile SASS
  • Set environment variables for local development
  • Copy files to /dev
  • Preprocess html files
  • Set up application configuration
  • Launch local web server (hosts /dev)
  • Start watching for changes

TEST RUNNING

 $ grunt test:unit
  • Single Karma unit test run

 $ grunt test:watch
  • Single Karma unit test run and watch for spec changes

 $ grunt test:e2e
  • Stage app for development
  • Launch local web server
  • Single Karma integration test run

JAVASCRIPT BUILD

$ grunt build:ios$ grunt build:android
  • Run unit tests
  • Clean /stage directory
  • Compile SASS
  • Set environment variables for iOS/Android
  • Copy files to /stage
  • Preprocess html files
  • Generate version info (2.1.1 2459)
  • Set up application configuration
  • Clean native www directory
  • Copy files to native www directory

NATIVE BUILD

$ grunt build:native
  • Stage application for production
  • Concatenate application JS
  • Set up and copy files to native www directory
  • Run native application build script
  • Native .ipa and .apk ready to go

$ grunt deploy:native
  • Run native deploy script
  • Uploads native builds to staging server
  • Notifies team with PT stories delivered

GRUNT PLUGINS


  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-env');
  grunt.loadNpmTasks('grunt-preprocess');
  grunt.loadNpmTasks('grunt-string-replace');
  grunt.loadNpmTasks('grunt-useref');
  grunt.loadNpmTasks('grunt-ngmin');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-shell');

how we use grunt

By Scott Mathson

how we use grunt

  • 2,023