annotate iframe-resizer/gruntfile.js @ 0:ac5f9272033b draft

first upload
author saskia-hiltemann
date Tue, 01 Jul 2014 11:42:23 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
1 /*global module:false*/
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
2 module.exports = function(grunt) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
3
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
4 // show elapsed time at the end
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
5 require('time-grunt')(grunt);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
6
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
7 // load all grunt tasks
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
8 //require('load-grunt-tasks')(grunt);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
9 require('jit-grunt')(grunt,{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
10 'replace':'grunt-text-replace',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
11 'bump-only':'grunt-bump',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
12 'bump-commit':'grunt-bump'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
13 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
14
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
15 // Project configuration.
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
16 grunt.initConfig({
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
17 pkg: grunt.file.readJSON('package.json'),
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
18
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
19 meta: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
20 bannerLocal: '/*! iFrame Resizer (iframeSizer.min.js ) - v<%= pkg.version %> - ' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
21 '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
22 ' * Desc: Force cross domain iframes to size to content.\n' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
23 ' * Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame.\n' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
24 ' * Copyright: (c) <%= grunt.template.today("yyyy") %> David J. Bradshaw - dave@bradshaw.net\n' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
25 ' * License: MIT\n */\n',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
26 bannerRemote: '/*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v<%= pkg.version %> - ' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
27 '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
28 ' * Desc: Include this file in any page being loaded into an iframe\n' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
29 ' * to force the iframe to resize to the content size.\n' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
30 ' * Requires: iframeResizer.min.js on host page.\n' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
31 ' * Copyright: (c) <%= grunt.template.today("yyyy") %> David J. Bradshaw - dave@bradshaw.net\n' +
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
32 ' * License: MIT\n */\n'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
33 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
34
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
35 qunit: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
36 files: ['test/*.html']
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
37 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
38
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
39 jshint: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
40 options: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
41 globals: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
42 jQuery:false,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
43 require:true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
44 process:true
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
45 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
46 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
47 gruntfile: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
48 src: 'gruntfile.js'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
49 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
50 code: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
51 src: 'src/**/*.js'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
52 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
53 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
54
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
55 uglify: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
56 options: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
57 sourceMaps:true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
58 sourceMapIncludeSources:true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
59 report:'gzip',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
60 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
61 local: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
62 options:{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
63 banner:'<%= meta.bannerLocal %>',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
64 sourceMap: 'src/iframeResizer.map'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
65 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
66 src: ['src/iframeResizer.js'],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
67 dest: 'js/iframeResizer.min.js',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
68 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
69 remote: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
70 options: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
71 banner:'<%= meta.bannerRemote %>',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
72 sourceMap: 'src/iframeResizer.contentWindow.map'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
73 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
74 src: ['src/iframeResizer.contentWindow.js'],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
75 dest: 'js/iframeResizer.contentWindow.min.js',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
76 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
77 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
78
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
79 watch: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
80 files: ['src/**/*'],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
81 tasks: 'sefault'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
82 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
83
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
84 replace: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
85 min: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
86 src: ['js/*.min.js'],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
87 overwrite: true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
88 replacements: [{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
89 from: /sourceMappingURL=src\//g,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
90 to: 'sourceMappingURL=..\/src\/'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
91 }]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
92 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
93
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
94 map: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
95 src: ['src/*.map'],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
96 overwrite: true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
97 replacements: [{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
98 from: /src\//g,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
99 to: ''
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
100 }]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
101 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
102 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
103
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
104 bump: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
105 options: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
106 files: ['package.json','bower.json','component.json','iframeResizer.jquery.json'],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
107 updateConfigs: ['pkg'],
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
108 commit: true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
109 commitMessage: 'Release v%VERSION%',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
110 commitFiles: ['-a'], // '-a' for all files
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
111 createTag: true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
112 tagName: 'v%VERSION%',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
113 tagMessage: 'Version %VERSION%',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
114 push: true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
115 pushTo: 'origin',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
116 gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
117 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
118 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
119
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
120 shell: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
121 options:{
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
122 stdout: true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
123 stderr: true,
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
124 failOnError: true
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
125 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
126 deployExample: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
127 command: function(){
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
128
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
129 var
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
130 retStr = '',
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
131 fs = require('fs');
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
132
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
133 if (fs.existsSync('bin')) {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
134 retStr = 'bin/deploy.sh';
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
135 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
136
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
137 return retStr;
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
138 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
139 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
140 },
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
141
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
142 jsonlint: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
143 json: {
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
144 src: [ '*.json' ]
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
145 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
146 }
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
147
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
148 });
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
149
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
150 grunt.registerTask('default', ['notest','qunit']);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
151 grunt.registerTask('notest', ['jsonlint','jshint','uglify','replace']);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
152 grunt.registerTask('test', ['jshint','qunit']);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
153
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
154 grunt.registerTask('postBump',['uglify','replace','bump-commit','shell']);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
155 grunt.registerTask('patch', ['default','bump-only:patch','postBump']);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
156 grunt.registerTask('minor', ['default','bump-only:minor','postBump']);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
157 grunt.registerTask('major', ['default','bump-only:major','postBump']);
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
158
ac5f9272033b first upload
saskia-hiltemann
parents:
diff changeset
159 };