Skip to content

Commit a89c6eb

Browse files
committed
Moving server into a grunt task. Updating plugins page. Template and CSS clean up.
Plugin search updates More fix updates Forgot nodeunit
1 parent 1aa89ef commit a89c6eb

15 files changed

+432
-346
lines changed

Gruntfile.js

+20-25
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
'use strict';
22

33
module.exports = function(grunt) {
4-
grunt.loadNpmTasks('grunt-contrib-clean');
5-
grunt.loadNpmTasks('grunt-contrib-concat');
6-
grunt.loadNpmTasks('grunt-contrib-jshint');
7-
grunt.loadNpmTasks('grunt-contrib-watch');
8-
grunt.loadNpmTasks('grunt-contrib-less');
9-
grunt.loadNpmTasks('grunt-contrib-copy');
10-
grunt.loadNpmTasks('grunt-contrib-jade');
11-
grunt.loadNpmTasks('grunt-contrib-jshint');
12-
13-
// Load local tasks
14-
grunt.loadTasks('tasks'); // getWiki, docs tasks
154

165
// Project configuration.
176
grunt.initConfig({
7+
// server port, used to serve the site and run tests
8+
server_port: 5678,
9+
1810
// clean directories
1911
clean: {
2012
build: ['build/'],
@@ -64,17 +56,6 @@ module.exports = function(grunt) {
6456
},
6557
// compile page layouts
6658
jade: {
67-
plugins: {
68-
options: {
69-
data: {
70-
page: 'plugins',
71-
title: 'Plugins'
72-
}
73-
},
74-
files: {
75-
"build/plugins.html": "src/tmpl/plugins.jade"
76-
}
77-
},
7859
notfound: {
7960
options: {
8061
data: {
@@ -113,13 +94,27 @@ module.exports = function(grunt) {
11394
{expand: true, cwd: 'src/', src: ['*'], dest: 'build/', filter: 'isFile'}
11495
]
11596
}
97+
},
98+
nodeunit: {
99+
all: ['test/*_test.js']
116100
}
117101
});
102+
103+
// Load contrib tasks
104+
grunt.loadNpmTasks('grunt-contrib-clean');
105+
grunt.loadNpmTasks('grunt-contrib-jshint');
106+
grunt.loadNpmTasks('grunt-contrib-concat');
107+
grunt.loadNpmTasks('grunt-contrib-watch');
108+
grunt.loadNpmTasks('grunt-contrib-less');
109+
grunt.loadNpmTasks('grunt-contrib-jade');
110+
grunt.loadNpmTasks('grunt-contrib-copy');
111+
grunt.loadNpmTasks('grunt-contrib-nodeunit');
112+
// Load local tasks
113+
grunt.loadTasks('tasks'); // getWiki, docs tasks
118114

119-
grunt.registerTask('build', ['clean', 'copy', 'jade', 'docs', 'concat']);
115+
grunt.registerTask('build', ['clean', 'copy', 'jade', 'docs', 'plugins', 'concat']);
120116
grunt.registerTask('default', ['build', 'less:production']);
121117
grunt.registerTask('dev', ['build', 'less:development', 'jshint', 'watch']);
118+
grunt.registerTask('test', ['nodeunit']);
122119

123-
// build pack task
124-
grunt.registerTask('heroku', 'default');
125120
};

Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: node server.js
1+
web: node node_modules/.bin/grunt server

README.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@ Grunt Website
44

55
## Build
66

7-
1. ```npm install```
8-
1. ```grunt
7+
1. `npm install`
8+
1. `grunt
99

1010

1111
## Setup Development
1212

13-
1. ```npm install```
14-
1. ```grunt```
13+
1. `npm install`
14+
1. `grunt` - gets the latest docs, generates the site
1515
1. use ```grunt watch``` if you are editing templates or less files. (Note: doc pages will have to be regenerated)
1616

17+
## Run Server
18+
19+
1. `grunt server`
20+
21+
## Run Tests
22+
23+
1. Make sure the server is running
24+
1. `grunt test`
1725

1826
## Notes
1927

20-
1. Default ```server.js``` port: ```5678```.
28+
1. Default server port is : `5678`. Configured in the `Gruntfile`

package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
{
22
"name": "gruntjs.com",
3-
"version": "0.4.0rc2",
3+
"version": "0.4.0",
44
"engines": {
5-
"node": ">= 0.6.0",
5+
"node": ">= 0.8.0",
66
"npm": "1.1.x"
77
},
88
"scripts": {
99
"postinstall": "node_modules/.bin/grunt"
1010
},
1111
"private": true,
1212
"dependencies": {
13-
"grunt": "0.4.0rc8",
14-
"grunt-cli": "0.1.x",
15-
"jade": "0.28.1",
13+
"grunt": "~0.4.0",
14+
"grunt-cli": "~0.1.x",
15+
"jade": "~0.28.x",
1616
"express": "3.0.5",
17-
"grunt-contrib": "0.3.0",
18-
"grunt-contrib-clean": "0.4.0rc6",
19-
"grunt-contrib-jshint": "~0.1.0",
20-
"grunt-contrib-less": "https://github.com/gruntjs/grunt-contrib-less/tarball/master",
21-
"grunt-contrib-watch": "https://github.com/gruntjs/grunt-contrib-watch/tarball/master",
22-
"grunt-contrib-copy": "https://github.com/gruntjs/grunt-contrib-copy/tarball/master",
23-
"grunt-contrib-jade": "https://github.com/gruntjs/grunt-contrib-jade/tarball/master",
24-
"grunt-contrib-concat": "https://github.com/gruntjs/grunt-contrib-concat/tarball/master",
17+
"grunt-contrib-clean": "~0.4.0",
18+
"grunt-contrib-concat": "~0.1.3",
19+
"grunt-contrib-nodeunit": "~0.1.2",
20+
"grunt-contrib-watch": "~0.2.0",
21+
"grunt-contrib-copy": "~0.4.0",
22+
"grunt-contrib-less": "~0.5.0",
23+
"grunt-contrib-jade": "~0.4.0",
24+
"grunt-contrib-jshint": "~0.1.1",
2525
"marked": "https://github.com/vladikoff/marked/tarball/master",
2626
"highlight.js": "~7.3.0",
2727
"request": "~2.12.0",

server.js

-172
This file was deleted.

src/js/plugins.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
return el;
1818
});
1919

20-
// only show plugins created after the specified date
21-
modules = _.filter(modules, function (el) {
22-
return Date.parse(el.time.created) > new Date('1800-01-01');
23-
});
24-
2520
// filter out contrib plugins not created by the Grunt Team
2621
modules = _.filter(modules, function (el) {
2722
return el.isContrib ? el.author && el.author.name === 'Grunt Team' : true;
2823
});
2924

25+
var $contribCheck = $('#contrib-top'),
26+
$pluginsTemplate = $('#plugins-all-template'),
27+
$pluginsContrib = $('#plugins-contrib'),
28+
$searchQuery = $('.search-query');
29+
3030
var contribModules = _.filter(modules, function (el) {
3131
return !!(/^grunt-contrib/.test(el.name));
3232
});
@@ -35,18 +35,15 @@
3535
return el.name;
3636
});
3737

38-
var contribTpl = _.template($('#plugins-all-template').html(), {
38+
var contribTpl = _.template($pluginsTemplate.html(), {
3939
modules: contribModules
4040
});
4141

42-
var allTpl = _.template($('#plugins-all-template').html(), {
42+
var allTpl = _.template($pluginsTemplate.html(), {
4343
modules: allModules
4444
});
4545

4646
$('#loading').hide();
47-
var $contribCheck = $('#contrib-top'),
48-
$pluginsContrib = $('#plugins-contrib'),
49-
$searchQuery = $('.search-query');
5047

5148
$searchQuery.val('');
5249

@@ -79,9 +76,9 @@
7976
$searchQuery.removeProp('disabled').focus()
8077
.on('submit', false)
8178
.on('keyup paste', function () {
79+
// disable contrib first, if searching
8280
if ($contribCheck.is(':checked')) $contribCheck.trigger('click');
83-
$('.contrib-toggle .btn:first').click();
84-
list.search($(this).val());
81+
list.search( $(this).val());
8582
});
8683

8784
$('#plugins-all .modified time, #plugins-contrib .modified time').timeago();

0 commit comments

Comments
 (0)