module.exports = function(grunt) { // Project Configuration grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), exec: { version: { command: 'node ./util/version.js' }, clear: { command: 'rm -Rf bower_components node_modules' }, osx64: { command: 'hdiutil create -megabytes 150 -volname Copay -srcfolder webkitbuilds/copay/osx64/copay.app/ -ov -format UDZO webkitbuilds/copay-osx64.dmg' }, osx32: { command: 'hdiutil create -megabytes 150 -volname Copay -srcfolder webkitbuilds/copay/osx32/copay.app/ -ov -format UDZO webkitbuilds/copay-osx32.dmg' } }, watch: { options: { dateFormat: function(time) { grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString()); grunt.log.writeln('Waiting for more changes...'); }, }, css: { files: ['src/css/*.css'], tasks: ['concat:css'] }, main: { files: [ 'src/js/init.js', 'src/js/app.js', 'src/js/directives/*.js', 'src/js/filters/*.js', 'src/js/routes.js', 'src/js/services/*.js', 'src/js/models/*.js', 'src/js/controllers/*.js' ], tasks: ['concat:js'] } }, concat: { options: { sourceMap: false, sourceMapStyle: 'link' // embed, link, inline }, angular: { src: [ 'bower_components/fastclick/lib/fastclick.js', 'bower_components/qrcode-generator/js/qrcode.js', 'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js', 'bower_components/moment/min/moment-with-locales.js', 'bower_components/angular/angular.js', 'bower_components/angular-ui-router/release/angular-ui-router.js', 'bower_components/angular-foundation/mm-foundation-tpls.js', 'bower_components/angular-moment/angular-moment.js', 'bower_components/ng-lodash/build/ng-lodash.js', 'bower_components/angular-qrcode/angular-qrcode.js', 'bower_components/angular-gettext/dist/angular-gettext.js', 'bower_components/angular-touch/angular-touch.js', 'bower_components/angular-bitcore-wallet-client/angular-bitcore-wallet-client.js', 'bower_components/angular-ui-switch/angular-ui-switch.js' ], dest: 'public/lib/angular.js' }, js: { src: [ 'src/js/app.js', 'src/js/routes.js', 'src/js/directives/*.js', 'src/js/filters/*.js', 'src/js/models/*.js', 'src/js/services/*.js', 'src/js/controllers/*.js', 'src/js/translations.js', 'src/js/version.js', 'src/js/init.js' ], dest: 'public/js/copay.js' }, css: { src: ['src/css/*.css'], dest: 'public/css/copay.css' }, foundation: { src: [ 'bower_components/angular/angular-csp.css', 'bower_components/foundation/css/foundation.css', 'bower_components/animate.css/animate.css', 'bower_components/angular-ui-switch/angular-ui-switch.css' ], dest: 'public/css/foundation.css', } }, uglify: { options: { mangle: false }, prod: { files: { 'public/js/copay.js': ['public/js/copay.js'], 'public/lib/angular.js': ['public/lib/angular.js'] } } }, nggettext_extract: { pot: { files: { 'i18n/po/template.pot': [ 'public/index.html', 'public/views/*.html', 'public/views/**/*.html', 'src/js/routes.js', 'src/js/services/*.js', 'src/js/controllers/*.js' ] } }, }, nggettext_compile: { all: { options: { module: 'copayApp' }, files: { 'src/js/translations.js': ['i18n/po/*.po'] } }, }, copy: { icons: { expand: true, flatten: true, src: 'bower_components/foundation-icon-fonts/foundation-icons.*', dest: 'public/icons/' }, linux: { files: [ {expand: true, cwd: 'webkitbuilds/',src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],dest: 'webkitbuilds/copay/linux32/', flatten: true, filter: 'isFile' }, {expand: true, cwd: 'webkitbuilds/',src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],dest: 'webkitbuilds/copay/linux64/', flatten: true, filter: 'isFile' }, ], } }, karma: { unit: { configFile: 'test/karma.conf.js' }, prod: { configFile: 'test/karma.conf.js', singleRun: true } }, coveralls: { options: { debug: false, coverageDir: 'coverage/report-lcov', dryRun: true, force: true, recursive: false } }, nodewebkit: { options: { platforms: ['win','osx','linux'], buildDir: './webkitbuilds', version: '0.12.2', macIcns: './public/img/icons/icon.icns', exeIco: './public/img/icons/icon.ico' }, src: ['./package.json', './public/**/*'] }, compress: { linux32: { options: { archive: './webkitbuilds/copay-linux32.zip' }, expand: true, cwd: './webkitbuilds/copay/linux32/', src: ['**/*'], dest: 'copay-linux32/' }, linux64: { options: { archive: './webkitbuilds/copay-linux64.zip' }, expand: true, cwd: './webkitbuilds/copay/linux64/', src: ['**/*'], dest: 'copay-linux64/' } } }); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-angular-gettext'); grunt.loadNpmTasks('grunt-exec'); grunt.loadNpmTasks('grunt-karma'); grunt.loadNpmTasks('grunt-karma-coveralls'); grunt.loadNpmTasks('grunt-node-webkit-builder'); grunt.loadNpmTasks('grunt-contrib-compress'); grunt.registerTask('default', ['nggettext_compile', 'exec:version', 'concat', 'copy:icons']); grunt.registerTask('prod', ['default', 'uglify']); grunt.registerTask('translate', ['nggettext_extract']); grunt.registerTask('test', ['karma:unit']); grunt.registerTask('test-coveralls', ['karma:prod', 'coveralls']); grunt.registerTask('desktop', ['prod', 'nodewebkit', 'copy:linux', 'compress:linux32', 'compress:linux64', 'exec:osx32', 'exec:osx64']); };