Skip to content

Commit 9f2c7ce

Browse files
committed
Converted Gruntfile from js to coffee.
Also: * Added `bare:true` option for coffee compilation to get rid of double-wrapped code. * Added wrapper to qunit_setup and DI'd the window object.
1 parent e37ba6c commit 9f2c7ce

7 files changed

+528
-533
lines changed

Gruntfile.coffee

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
"use strict"
2+
module.exports = (grunt) ->
3+
4+
# Project configuration.
5+
grunt.initConfig
6+
7+
# Metadata.
8+
pkg: grunt.file.readJSON("localize.jquery.json")
9+
banner: """
10+
/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today(\"yyyy-mm-dd\") %>
11+
<%= pkg.homepage ? "* " + pkg.homepage : "" %>
12+
* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>; Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */
13+
14+
"""
15+
16+
# Task configuration.
17+
clean:
18+
files: ["dist"]
19+
20+
coffee:
21+
options:
22+
bare: true
23+
compile:
24+
files:
25+
"dist/<%= pkg.name %>.js": "src/*.coffee"
26+
"test/localize_test.js": "test/localize_test.coffee"
27+
"test/qunit_setup.js": "test/qunit_setup.coffee"
28+
29+
uglify:
30+
options:
31+
banner: "<%= banner %>"
32+
33+
dist:
34+
src: "dist/<%= pkg.name %>.js"
35+
dest: "dist/<%= pkg.name %>.min.js"
36+
37+
qunit:
38+
all:
39+
options:
40+
urls: [
41+
"1.7.2"
42+
"1.8.3"
43+
"1.9.1"
44+
"1.10.2"
45+
"1.11.0"
46+
"2.0.3"
47+
"2.1.0"
48+
].map((version) ->
49+
"http://localhost:<%= connect.server.options.port %>/test/localize.html?jquery=" + version
50+
)
51+
52+
connect:
53+
server:
54+
options:
55+
port: 8085 # This is a random port, feel free to change it.
56+
57+
# These plugins provide necessary tasks.
58+
grunt.loadNpmTasks "grunt-contrib-clean"
59+
grunt.loadNpmTasks "grunt-contrib-uglify"
60+
grunt.loadNpmTasks "grunt-contrib-qunit"
61+
grunt.loadNpmTasks "grunt-contrib-coffee"
62+
grunt.loadNpmTasks "grunt-contrib-connect"
63+
64+
# Default task.
65+
grunt.registerTask "default", [
66+
"connect"
67+
"clean"
68+
"coffee"
69+
"uglify"
70+
"qunit"
71+
]
72+
73+
grunt.registerTask "test", [
74+
"connect"
75+
"qunit"
76+
]
77+
return

Gruntfile.js

-64
This file was deleted.

0 commit comments

Comments
 (0)