bitcoin-atm

bitcoin atm for pyc inc.

git clone https://9o.is/git/bitcoin-atm.git

Gruntfile.js

(9718B)


      1 module.exports = function(grunt) {
      2   "use strict";
      3 
      4   grunt.loadNpmTasks('grunt-contrib-jshint');
      5   grunt.loadNpmTasks('grunt-contrib-concat');
      6   grunt.loadNpmTasks('grunt-contrib-copy');
      7   grunt.loadNpmTasks('grunt-contrib-uglify');
      8   grunt.loadNpmTasks('grunt-contrib-less');
      9   grunt.loadNpmTasks('grunt-contrib-htmlmin');
     10   grunt.loadNpmTasks('grunt-contrib-jasmine');
     11   grunt.loadNpmTasks('grunt-contrib-watch');
     12   grunt.loadNpmTasks('grunt-contrib-clean');
     13   grunt.loadNpmTasks('grunt-hash');
     14 
     15   /**
     16    * Load in our build configuration file.
     17    */
     18   var userConfig = require( './build.config.js' );
     19   /**
     20    * This is the configuration object Grunt uses to give each plugin its
     21    * instructions.
     22    */
     23   var taskConfig = {
     24     /**
     25      * We read in our `package.json` file so we can access the package name and
     26      * version. It's already there, so we don't repeat ourselves here.
     27      */
     28     pkg: grunt.file.readJSON('package.json'),
     29 
     30     meta: {
     31       artifact: "<%= pkg.name %>-<%= pkg.version %>"
     32     },
     33 
     34     jshint: {
     35       options: {
     36         curly: true,
     37         eqeqeq: true,
     38         immed: true,
     39         latedef: true,
     40         newcap: true,
     41         noarg: true,
     42         sub: true,
     43         undef: true,
     44         unused: true,
     45         boss: true,
     46         eqnull: true,
     47         browser: true,
     48         evil: true,
     49         globals: {
     50           "jQuery": false,
     51           "$": false,
     52           "angular": false,
     53           "_": false,
     54           "qrcode": false,
     55           "ko": false,
     56           "App": true
     57         }
     58       },
     59       src: [
     60         '<%= app_files.js %>'
     61       ],
     62       test: {
     63         options: {
     64           globals: {
     65             "jQuery": false,
     66             "$": false,
     67             "angular": false,
     68             "_": false,
     69             "ko": false,
     70             "App": true,
     71             "it": false,
     72             "xit": false,
     73             "describe": false,
     74             "xdescribe": false,
     75             "beforeEach": false,
     76             "afterEach": false,
     77             "expect": false,
     78             "spyOn": false,
     79             "module": false,
     80             "inject": false
     81           }
     82         },
     83         files: {
     84           src: ['<%= app_files.jsspec %>']
     85         }
     86       },
     87       gruntfile: {
     88         options: {
     89           globals: {
     90             "module": false,
     91             "require": false
     92           }
     93         },
     94         files: {
     95           src: ['Gruntfile.js']
     96         }
     97       }
     98     },
     99 
    100     jasmine: {
    101       src: '<%= app_files.js %>',
    102       options: {
    103     	vendor: [
    104     	  'http://maps.googleapis.com/maps/api/js?sensor=false&language=en',
    105           'bower_components/jquery/dist/jquery.js',
    106           'bower_components/jasmine-jquery/lib/jasmine-jquery.js',
    107           '<%= vendor_files.js %>',
    108           'bower_components/angular-mocks/angular-mocks.js'
    109         ],
    110         specs: '<%= app_files.jsspec %>'
    111       }
    112     },
    113 
    114     less: {
    115       compile: {
    116         options: {
    117           sourceMap: true,
    118           sourceMapFilename: "<%= dirs.build %>/css/assets/app_styles.css.map",
    119           sourceMapBasepath: "<%= dirs.build %>/css",
    120           sourceMapRootpath: "/"
    121         },
    122         files: {
    123           "<%= dirs.build %>/css/assets/app_styles.css": "<%= app_files.less %>"
    124         }
    125       },
    126       compress: {
    127         options: {
    128           compress: true,
    129           cleancss: true,
    130           report: 'min'
    131         },
    132         files: {
    133           "<%= dirs.build %>/app_styles.min.css": "<%= app_files.less %>"
    134         }
    135       }
    136     },
    137     
    138     htmlmin: {
    139         dist: {
    140           options: {
    141             removeComments: true,
    142             collapseWhitespace: true
    143           },
    144           expand: true,
    145           cwd: '<%= dirs.src %>',
    146           src: ['**/*.html'],
    147           dest: '<%= dirs.dist %>/'
    148         }
    149     },
    150 
    151     concat: {
    152       /**
    153        * The `vendor_css` target concatenates vendor CSS.
    154        */
    155       vendor_css: {
    156         src: ['<%= vendor_files.css %>'],
    157         dest: '<%= dirs.build %>/vendor_styles.css'
    158       },
    159       /**
    160        * The `build_css` target concatenates compiled CSS and vendor CSS
    161        * together.
    162        */
    163       build_css: {
    164         src: [
    165           '<%= dirs.build %>/app_styles.min.css',
    166           '<%= dirs.build %>/vendor_styles.min.css'
    167         ],
    168         dest: '<%= dirs.build %>/<%= meta.artifact %>.min.css'
    169       },
    170       /**
    171        * The `compile_js` target is the concatenation of our application source
    172        * code and all specified vendor source code into a single file.
    173        */
    174       compile_js: {
    175         /*options: {
    176           separator: ';'
    177         },*/
    178         src: [
    179           '<%= vendor_files.js %>',
    180           '<%= app_files.js %>'
    181         ],
    182         dest: "<%= dirs.build %>/<%= meta.artifact %>.js"
    183       }
    184     },
    185 
    186     uglify: {
    187       options: {
    188         banner: '/*! <%= pkg.name %>-<%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
    189       },
    190       build: {
    191         src: "<%= concat.compile_js.dest %>",
    192         dest: "<%= dirs.build %>/<%= meta.artifact %>.min.js"
    193       }
    194     },
    195 
    196     hash: {
    197       options: {
    198         mapping: '<%= dirs.resources %>/assets.json',
    199         srcBasePath: '<%= dirs.build %>',
    200         destBasePath: '<%= dirs.dist %>/assets'
    201       },
    202       js: {
    203         src: '<%= uglify.build.dest %>',
    204         dest: '<%= dirs.dist %>/assets'
    205       },
    206       css: {
    207         src: '<%= dirs.build %>/<%= meta.artifact %>.min.css',
    208         dest: '<%= dirs.dist %>/assets'
    209       }
    210     },
    211 
    212     gensourceslist: {
    213       sources_js: {
    214         options: {
    215           srcBasePath: '<%= dirs.src %>', // the base Path you want to remove from the input
    216           destBasePath: '' // the base Path you want to prepend to output
    217         },
    218         files: [
    219           {
    220             src: [
    221               '<%= app_files.js %>'
    222             ],
    223             dest: '<%= dirs.resources %>/source_scripts.txt'
    224           }
    225         ]
    226       },
    227       vendor_js: {
    228         options: {
    229           srcBasePath: '<%= dirs.src %>'
    230         },
    231         files: [
    232           {
    233             src: '<%= vendor_files.js %>',
    234             dest: '<%= dirs.resources %>/vendor_scripts.txt'
    235           }
    236 
    237         ]
    238       },
    239       vendor_css: {
    240         options: {
    241           srcBasePath: '<%= dirs.src %>'
    242         },
    243         files: [
    244           {
    245             src: '<%= vendor_files.css %>',
    246             dest: '<%= dirs.resources %>/vendor_styles.txt'
    247           }
    248 
    249         ]
    250       }
    251     },
    252 
    253     copy: {
    254       vendor_assets: {
    255         files: [
    256           {
    257             src: [ '<%= vendor_files.assets %>' ],
    258             dest: '<%= dirs.dist %>/',
    259             cwd: '<%= dirs.src %>',
    260             expand: true
    261           }
    262        ]
    263       }
    264     },
    265 
    266     delta: {
    267       /**
    268        * By default, we want the Live Reload to work for all tasks; this is
    269        * overridden in some tasks (like this file) where browser resources are
    270        * unaffected. It runs by default on port 35729, which your browser
    271        * plugin should auto-detect.
    272        */
    273       options: {
    274         livereload: true
    275       },
    276 
    277       /**
    278        * When the Gruntfile changes, we just want to lint it.
    279        */
    280       gruntfile: {
    281         files: 'Gruntfile.js',
    282         tasks: [ 'jshint:gruntfile' ]
    283       },
    284 
    285       /**
    286        * When our JavaScript source files change, we want to lint them,
    287        * run our unit tests, and live reload.
    288        */
    289       jssrc: {
    290         files: [
    291           '<%= app_files.js %>'
    292         ],
    293         tasks: ['jshint:src']
    294       },
    295 
    296       /**
    297        * When a JavaScript test file changes, we only want to lint it and
    298        * run the unit tests. We don't want to do any live reloading.
    299        */
    300       jstest: {
    301         files: '<%= app_files.jsspec %>',
    302         tasks: [ 'jshint:test', 'jasmine'],
    303         options: {
    304           livereload: false
    305         }
    306       },
    307 
    308       less: {
    309         files: ["<%= dirs.src %>/less/**/*.less"],
    310         tasks: ["less:compile"]
    311       },
    312       pkg: {
    313         files: 'package.json',
    314         tasks: ['build']
    315       }
    316     },
    317     clean: {
    318       build: ["<%= dirs.target %>"]
    319     }
    320   };
    321 
    322   // configure grunt
    323   grunt.initConfig( grunt.util._.extend( taskConfig, userConfig ) );
    324 
    325   /**
    326    * The `build` task gets your app ready to run for development and testing.
    327    */
    328   grunt.registerTask('build', ['clean', 'gensourceslist', 'jshint', 'less:compile']);
    329 
    330   /**
    331    * The `test` task runs your tests.
    332    */
    333   grunt.registerTask('test', ['jasmine']);
    334 
    335   /**
    336    * The `compress` task gets your app ready for deployment by concatenating and
    337    * minifying your code.
    338    */
    339   grunt.registerTask('compress', [
    340     'concat:compile_js', 'uglify', 'less:compress', 'concat:vendor_css', 'concat:build_css', 'hash', 'copy:vendor_assets', 'htmlmin'
    341   ]);
    342   
    343   /**
    344    * The default task is to build, test, and compress.
    345    */
    346   grunt.registerTask('default', ['build', 'test', 'compress']);
    347 
    348   /**
    349    * In order to make it safe to just compile or copy *only* what was changed,
    350    * we need to ensure we are starting from a clean, fresh build. So we rename
    351    * the `watch` task to `delta` (that's why the configuration var above is
    352    * `delta`) and then add a new task called `watch` that does a clean build
    353    * before watching for changes.
    354    */
    355   grunt.renameTask('watch', 'delta');
    356   grunt.registerTask('watch', ['build', 'delta']);
    357 
    358   grunt.registerMultiTask('gensourceslist', 'Generate a list of sources.', function() {
    359     var options = this.options(),
    360         destBasePath = options.destBasePath || '';
    361 
    362     this.files.forEach(function(fs) {
    363       var contents = "";
    364       fs.src.forEach(function(file) {
    365         var out = destBasePath + file.replace(options.srcBasePath, "");
    366         contents = contents + out + "\n";
    367       });
    368 
    369       grunt.file.write(fs.dest, contents);
    370       grunt.log.writeln("File created: " + fs.dest);
    371     });
    372   });
    373 };
    374