From b385b052e97563392336bea45d0887e03b3d54a2 Mon Sep 17 00:00:00 2001 From: Bady <bady@disroot.org> Date: Mon, 10 Jul 2017 00:47:12 +0530 Subject: [PATCH] Sort events in reverse chronological order --- events/details/000-wayanad-install-fest.yaml | 10 -- events/details/2017-06-17-00.yaml | 12 ++ ...ut-insall-fest.yaml => 2017-06-18-00.yaml} | 12 +- ...-release-party.yaml => 2017-06-24-00.yaml} | 10 +- ...-release-party.yaml => 2017-07-05-00.yaml} | 12 +- events/index.yaml | 1 - gulpfile.js | 133 ++++++++++-------- package.json | 2 + 8 files changed, 110 insertions(+), 82 deletions(-) delete mode 100644 events/details/000-wayanad-install-fest.yaml create mode 100644 events/details/2017-06-17-00.yaml rename events/details/{001-calicut-insall-fest.yaml => 2017-06-18-00.yaml} (52%) rename events/details/{002-cusat-debian-release-party.yaml => 2017-06-24-00.yaml} (71%) rename events/details/{003-thrissur-debian-release-party.yaml => 2017-07-05-00.yaml} (62%) diff --git a/events/details/000-wayanad-install-fest.yaml b/events/details/000-wayanad-install-fest.yaml deleted file mode 100644 index 2bf0829..0000000 --- a/events/details/000-wayanad-install-fest.yaml +++ /dev/null @@ -1,10 +0,0 @@ -id: "0" -name: "GNU/Linux Install Fest - Wayanad" -lat: "" -lng: "" -locationame: "Pazhassi Library, Mananthavady" -organizedby: "FSUG Wayanadu" -when: "2017-06-17 10:00 AM to 02:00 PM" -description: "GNU/Linux install fest" -contactinfo: "TBA" -imgurl: "https://wiki.debian.org/ReleasePartyStretch/India/Kerala/Mananthavady?action=AttachFile&do=get&target=wayanadfest.jpeg" diff --git a/events/details/2017-06-17-00.yaml b/events/details/2017-06-17-00.yaml new file mode 100644 index 0000000..a306e63 --- /dev/null +++ b/events/details/2017-06-17-00.yaml @@ -0,0 +1,12 @@ +id: "2017-06-17-00" +name: "GNU/Linux Install Fest and Debian Stretch Release Party - Wayanad" +state: "Kerala" +district: "Wayanad" +venue: "Pazhassi Library, Mananthavady" +lat: "" +lon: "" +organizedby: "FSUG Wayanad" +when: "17-06-2017 10:00 AM to 02:00 PM" +description: "GNU/Linux install fest" +contactinfo: "" +imgurl: "https://wiki.debian.org/ReleasePartyStretch/India/Kerala/Mananthavady?action=AttachFile&do=get&target=wayanadfest.jpeg" diff --git a/events/details/001-calicut-insall-fest.yaml b/events/details/2017-06-18-00.yaml similarity index 52% rename from events/details/001-calicut-insall-fest.yaml rename to events/details/2017-06-18-00.yaml index 59ea7da..f1dcbb4 100644 --- a/events/details/001-calicut-insall-fest.yaml +++ b/events/details/2017-06-18-00.yaml @@ -1,10 +1,12 @@ -id: "1" -name: "GNU/Linux Install Fest - Calicut" +id: "2017-06-18-00" +name: "GNU/Linux Install Fest and Debian Stretch Release Party - Calicut" +state: "Kerala" +district: "Calicut" +venue: "Parishad Bhavan" lat: "" -lng: "" -locationame: "Calicut" +lon: "" organizedby: "FSUG Calicut" -when: "2017-06-18 10:00 AM" +when: "18-06-2017 10:00 AM" description: "GNU/Linux Install Fest" contactinfo: "" imgurl: "https://wiki.debian.org/ReleasePartyStretch/India/Kerala/Kozhikode?action=AttachFile&do=get&target=cltfest.png" diff --git a/events/details/002-cusat-debian-release-party.yaml b/events/details/2017-06-24-00.yaml similarity index 71% rename from events/details/002-cusat-debian-release-party.yaml rename to events/details/2017-06-24-00.yaml index 0ccf485..fc1588c 100644 --- a/events/details/002-cusat-debian-release-party.yaml +++ b/events/details/2017-06-24-00.yaml @@ -1,10 +1,12 @@ -id: "2" +id: "2017-06-24-00" name: "Debian Stretch Release Party - Kochi" +state: "Kerala" +district: "Ernakulam" +venue: "CUSAT" lat: "" -lng: "" -locationame: "CUSAT" +lon: "" organizedby: "FOSSClub, ILUG Cochin and DAKF" -when: "2017-06-24 03:00 PM to 06:00 PM" +when: "24-06-2017 03:00 PM to 06:00 PM" description: "Debian Stretch Release Party - Kochi" contactinfo: "TBA" imgurl: "https://wiki.debian.org/ReleasePartyStretch/India/Kerala/Cochin/CUSAT?action=AttachFile&do=get&target=cochin_cufest.jpeg" diff --git a/events/details/003-thrissur-debian-release-party.yaml b/events/details/2017-07-05-00.yaml similarity index 62% rename from events/details/003-thrissur-debian-release-party.yaml rename to events/details/2017-07-05-00.yaml index 4f14599..e6503ad 100644 --- a/events/details/003-thrissur-debian-release-party.yaml +++ b/events/details/2017-07-05-00.yaml @@ -1,10 +1,12 @@ -id: "3" -name: "Debian Stretch Release Party - Thrissur" +id: "2017-07-05-00" +name: "GNU/Linux Install Fest and Debian Stretch Release Party - Thrissur" +state: "Kerala" +district: "Thrissur" +venue: "St.Mary's College" lat: "" -lng: "" -locationame: "St.Mary's College" +lon: "" organizedby: "FSUG Thrissur, ICFOSS and KSSP" -when: "2017-07-05 09:30 AM to 12:30 PM" +when: "05-07-2017 09:30 AM to 12:30 PM" description: "Debian Stretch Release Party along with GNU/Linux Install Fest - Thrissur" contactinfo: "Riot room #fsugtcr:matrix.org" imgurl: "https://wiki.debian.org/ReleasePartyStretch/India/Kerala/Thrissur?action=AttachFile&do=get&target=fsug_thrissur_debian_stretch_release_party_poster.png" diff --git a/events/index.yaml b/events/index.yaml index ee79764..7502285 100644 --- a/events/index.yaml +++ b/events/index.yaml @@ -1,2 +1 @@ -version: "1.0" events: !!inc/dir [ 'details' , { ignoreTopLevelDir: true, ignoreIndicator: '-', excludeTopLevelDirSeparator: true } ] diff --git a/gulpfile.js b/gulpfile.js index 5e01e2a..3622400 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,10 +10,13 @@ var uglify = require('gulp-uglify'); var connect = require('gulp-connect'); var connectProxy = require('gulp-connect-proxy'); -var yamlinc = require("gulp-yaml-include"); +var yamlinc = require('gulp-yaml-include'); var runSequence = require('run-sequence'); var readYaml = require('read-yaml'); -var glob = require("glob"); +var glob = require('glob'); +var yaml = require('gulp-yaml'); +var sortJSON = require('gulp-json-sort').default; + gulp.task('assetscopy', function() { gulp.src([ @@ -47,7 +50,7 @@ gulp.task('jslint', function() { .pipe(jshint.reporter('default')); }); -gulp.task('GenerateIndexPage', function(){ +gulp.task('GenerateIndexPage', function() { gulp.src('pug/pages/*.pug') .pipe(pug({ pretty: true, @@ -58,65 +61,81 @@ gulp.task('GenerateIndexPage', function(){ .pipe(gulp.dest('public')); }); -gulp.task('GenerateEventsYAML', function(){ +gulp.task('GenerateEventsYAML', function() { return gulp.src("events/index.yaml") - .pipe(yamlinc()) - .pipe(gulp.dest('public/events')); + .pipe(yamlinc()) + .pipe(gulp.dest('public/events')); +}); + +gulp.task('GenerateEventsJSON', function() { + gulp.src('public/events/index.yaml') + .pipe(yaml()) + .pipe(sortJSON({ + cmp: function(a, b) { + return a.key < b.key ? 1 : -1; + }, + space: 2 + })) + .pipe(gulp.dest('public/events')) }); -gulp.task('GenerateEventsPage', function(){ - readYaml('public/events/index.yaml', function(err, ydata) { - if (err) throw err; - gulp.src('pug/templates/events.pug') - .pipe(pug({ - pretty: true, - data: { - debug: true, - events: ydata - } - })) - .pipe(concat('index' + '.html')) - .pipe(gulp.dest('public/events')); - }); - glob("events/details/*.yaml", {}, function (er, files) { - var nooffiles = files.length; - for(var i = 0; i < nooffiles; i++){ - readYaml(files[i], function(err, ydata) { - if (err) throw err; - var id = ydata.id; - gulp.src('pug/templates/individual_event_page.pug') - .pipe(pug({ - pretty: true, - data: { - debug: true, - evt: ydata - } - })) - .pipe(concat(id + '.html')) - .pipe(gulp.dest('public/events')); - }); +gulp.task('GenerateEventsIndex', function() { + var sortedEvents = require('./public/events/index.json'); + gulp.src('pug/templates/events.pug') + .pipe(pug({ + pretty: true, + data: { + debug: true, + events: sortedEvents } - }); + })) + .pipe(concat('index' + '.html')) + .pipe(gulp.dest('public/events')); +}); + +gulp.task('GenerateEventPages', function() { + glob("events/details/*.yaml", {}, function(er, files) { + var nooffiles = files.length; + for (var i = 0; i < nooffiles; i++) { + readYaml(files[i], function(err, ydata) { + if (err) throw err; + var id = ydata.id; + gulp.src('pug/templates/individual_event_page.pug') + .pipe(pug({ + pretty: true, + data: { + debug: true, + evt: ydata + } + })) + .pipe(concat(id + '.html')) + .pipe(gulp.dest('public/events')); + }); + } + }); }); -gulp.task('pughtml', function(){ - runSequence('GenerateEventsYAML',[ +gulp.task('pughtml', function() { + runSequence( 'GenerateIndexPage', - 'GenerateEventsPage' - ]); + 'GenerateEventsYAML', + 'GenerateEventsJSON', + 'GenerateEventPages', + 'GenerateEventsIndex' + ) }); gulp.task('cssmin', function() { gulp.src([ - 'node_modules/bootstrap/dist/css/bootstrap.min.css', - //'node_modules/font-awesome/css/font-awesome.min.css', - //'node_modules/normalize.css/normalize.css', - 'node_modules/leaflet/dist/leaflet.css', - 'node_modules/bootcards/dist/css/bootcards-desktop.min.css', - // 'node_modules/bootcards/dist/css/bootcards-android.min.css', - // 'node_modules/bootcards/dist/css/bootcards-ios.min.css', - 'css/*.css' - ]) + 'node_modules/bootstrap/dist/css/bootstrap.min.css', + //'node_modules/font-awesome/css/font-awesome.min.css', + //'node_modules/normalize.css/normalize.css', + 'node_modules/leaflet/dist/leaflet.css', + 'node_modules/bootcards/dist/css/bootcards-desktop.min.css', + // 'node_modules/bootcards/dist/css/bootcards-android.min.css', + // 'node_modules/bootcards/dist/css/bootcards-ios.min.css', + 'css/*.css' + ]) .pipe(concat('index.css')) .pipe(cssmin()) .pipe(gulp.dest('public/css')); @@ -124,12 +143,12 @@ gulp.task('cssmin', function() { gulp.task('jsuglify', function() { gulp.src([ - 'node_modules/jquery/dist/jquery.min.js', - 'node_modules/bootstrap/dist/js/bootstrap.min.js', - 'node_modules/leaflet/dist/leaflet.js', - 'node_modules/bootcards/dist/js/bootcards.min.js', - 'js/*.js' - ]) + 'node_modules/jquery/dist/jquery.min.js', + 'node_modules/bootstrap/dist/js/bootstrap.min.js', + 'node_modules/leaflet/dist/leaflet.js', + 'node_modules/bootcards/dist/js/bootcards.min.js', + 'js/*.js' + ]) .pipe(concat('index.js')) .pipe(uglify()) .pipe(gulp.dest('public/js')); diff --git a/package.json b/package.json index a13a512..2219a6e 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,10 @@ "gulp-cssmin": "^0.2.0", "gulp-htmlhint": "^0.3.1", "gulp-jshint": "^2.0.4", + "gulp-json-sort": "^1.0.0", "gulp-pug": "^3.3.0", "gulp-uglify": "^3.0.0", + "gulp-yaml": "^1.0.1", "gulp-yaml-data": "^0.2.0", "gulp-yaml-include": "^0.2.0", "read-yaml": "^1.1.0", -- GitLab