Skip to content

Commit 8ea2e48

Browse files
committed
Build: Add PEP listings
1 parent c54520b commit 8ea2e48

File tree

4 files changed

+53
-1
lines changed

4 files changed

+53
-1
lines changed

Gruntfile.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,27 @@ grunt.registerTask( "build-index", function() {
244244
};
245245
}
246246

247+
function getPepData() {
248+
var releases = grunt.file.expand( { filter: "isDirectory" }, "cdn/pep/*" )
249+
.map(function( dir ) {
250+
var filename = dir.substring( 4 ) + "/pep.js";
251+
252+
return {
253+
filename: filename,
254+
version: dir.substring( 8 ),
255+
minified: filename.replace( ".js", ".min.js" )
256+
};
257+
})
258+
.sort(function( a, b ) {
259+
return semver.compare( b.version, a.version );
260+
});
261+
262+
return {
263+
latestStable: getLatestStable( releases ),
264+
all: releases
265+
};
266+
}
267+
247268
Handlebars.registerHelper( "release", function( prefix, release ) {
248269
var html = prefix + " " + release.version + " - " +
249270
"<a href='/" + release.filename + "'>uncompressed</a>";
@@ -288,6 +309,7 @@ grunt.registerTask( "build-index", function() {
288309
data.mobile = getMobileData();
289310
data.color = getColorData();
290311
data.qunit = getQunitData();
312+
data.pep = getPepData();
291313

292314
grunt.file.write( "dist/wordpress/posts/page/index.html",
293315
Handlebars.compile( grunt.file.read( "templates/index.hbs" ) )( data ) );
@@ -306,12 +328,15 @@ grunt.registerTask( "build-index", function() {
306328

307329
grunt.file.write( "dist/wordpress/posts/page/qunit.html",
308330
Handlebars.compile( grunt.file.read( "templates/qunit.hbs" ) )( data ) );
331+
332+
grunt.file.write( "dist/wordpress/posts/page/pep.html",
333+
Handlebars.compile( grunt.file.read( "templates/pep.hbs" ) )( data ) );
309334
});
310335

311336
grunt.registerTask( "reload-listings", function() {
312337
var done = this.async(),
313338
host = "http://" + grunt.config( "wordpress" ).url,
314-
paths = [ "/", "/jquery/", "/ui/", "/mobile/", "/color/", "/qunit/" ],
339+
paths = [ "/", "/jquery/", "/ui/", "/mobile/", "/color/", "/qunit/", "/pep/" ],
315340
waiting = paths.length;
316341

317342
paths.forEach(function( path ) {

templates/index.hbs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,15 @@
7979
{{include "qunit-release"}}
8080
</ul>
8181
{{/with}}
82+
83+
<h2>PEP</h2>
84+
<p>
85+
Showing hte latest stable release for PEP.
86+
<a href="/pep/">See all versions of PEP</a>.
87+
</p>
88+
89+
{{#with pep.latestStable}}
90+
<ul>
91+
{{include "pep-release"}}
92+
</ul>
93+
{{/with}}

templates/pep-release.hbs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<li>
2+
PEP {{version}} -
3+
<a href="/{{filename}}">uncompressed</a>,
4+
<a href="/{{minified}}">minified</a>
5+
</li>

templates/pep.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script>{
2+
"title": "PEP - All Versions"
3+
}</script>
4+
5+
<h2>PEP - All Versions</h2>
6+
<ul>
7+
{{#each pep.all}}
8+
{{include "pep-release"}}
9+
{{/each}}
10+
</ul>

0 commit comments

Comments
 (0)