view Gruntfile.js @ 5:c02b5a225a10

Serpentron 1.0-beta2.
author Mikhail Kryshen <mikhail@kryshen.net>
date Thu, 18 Feb 2016 01:35:39 +0300
parents
children 4943c163d0b4
line source
1 'use strict';
3 module.exports = function (grunt) {
4 var path = require('path'),
5 helpers = require('amber-dev').helpers;
7 // These plugins provide necessary tasks.
8 grunt.loadNpmTasks('grunt-contrib-clean');
9 grunt.loadNpmTasks('grunt-contrib-requirejs');
10 grunt.loadNpmTasks('grunt-execute');
11 grunt.loadNpmTasks('amber-dev');
13 // Default task.
14 grunt.registerTask('default', ['amdconfig:app', 'amberc:all']);
15 grunt.registerTask('test', ['amdconfig:app', 'requirejs:test_runner', 'execute:test_runner', 'clean:test_runner']);
16 grunt.registerTask('devel', ['amdconfig:app', 'requirejs:devel']);
17 grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy']);
19 // Project configuration.
20 grunt.initConfig({
21 // Metadata.
22 // pkg: grunt.file.readJSON(''),
23 banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
24 '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
25 '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
26 '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
27 ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
28 // task configuration
29 amberc: {
30 options: {
31 amber_dir: path.join(__dirname, "bower_components", "amber"),
32 configFile: "config.js"
33 },
34 all: {
35 src: [
36 'src/Serpentron.st', // list all sources in dependency order
37 'src/Serpentron-Tests.st' // list all tests in dependency order
38 ],
39 amd_namespace: 'amber-serpentron',
40 libraries: ['amber_core/SUnit', 'silk/Silk']
41 }
42 },
44 amdconfig: {app: {dest: 'config.js'}},
46 requirejs: {
47 options: {
48 useStrict: true
49 },
50 deploy: {
51 options: {
52 mainConfigFile: "config.js",
53 rawText: {
54 "amber/compatibility": "/*stub*/",
55 "amber/Platform": "/*stub*/",
56 "app": 'define(["deploy"],function(x){return x});'
57 },
58 pragmas: {
59 excludeIdeData: true,
60 excludeDebugContexts: true
61 },
62 include: ['config', 'config-browser', 'node_modules/requirejs/require', 'app'],
63 optimize: "uglify2",
64 out: "the.js"
65 }
66 },
67 devel: {
68 options: {
69 mainConfigFile: "config.js",
70 rawText: {
71 "amber/compatibility": "/*stub*/",
72 "amber/Platform": "/*stub*/",
73 "app": 'define(["devel"],function(x){return x});'
74 },
75 include: ['config', 'config-browser', 'node_modules/requirejs/require', 'app'],
76 exclude: ['devel'],
77 out: "the.js"
78 }
79 },
80 test_runner: {
81 options: {
82 mainConfigFile: "config.js",
83 rawText: {
84 "app": "(" + function () {
85 define(["testing", "amber_devkit/NodeTestRunner"], function (amber) {
86 amber.initialize().then(function () {
87 amber.globals.NodeTestRunner._main();
88 });
89 });
90 } + "());"
91 },
92 paths: {"amber_devkit": helpers.libPath},
93 pragmas: {
94 excludeIdeData: true
95 },
96 include: ['config-node', 'app'],
97 insertRequire: ['app'],
98 optimize: "none",
99 wrap: helpers.nodeWrapperWithShebang,
100 out: "test_runner.js"
101 }
102 }
103 },
105 execute: {
106 test_runner: {
107 src: ['test_runner.js']
108 }
109 },
111 clean: {
112 test_runner: ['test_runner.js']
113 }
114 });
116 };