Skip to content

Commit

Permalink
build: update template and add script to generate announcement message
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed May 2, 2024
1 parent 96ac1d1 commit 5e97f0a
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 5 deletions.
109 changes: 109 additions & 0 deletions organization/scripts/announcement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/usr/bin/env node

/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var resolve = require( 'path' ).resolve;
var mustache = require( 'mustache' );
var mkdirp = require( 'mkdirp' ).sync;
var readFile = require( '@stdlib/fs-read-file' ).sync;
var writeFile = require( '@stdlib/fs-write-file' ).sync;
var ENV = require( '@stdlib/process-env' );
var parseCSV = require( './parse_csv.js' );


// VARIABLES //

var SENDER = ENV[ 'SENDER' ];
var NUM_APPS = parseInt( ENV[ 'NUM_APPS' ], 10 );
var CODING_START = ENV[ 'CODING_START' ];

var FOPTS = {
'encoding': 'utf8'
};

var tpath = resolve( __dirname, '..', 'templates', 'announcement.md' );
var TMPL = readFile( tpath, FOPTS );

var dpath = resolve( __dirname, 'tmp', 'accepted.csv' );
var DATA = parseCSV( readFile( dpath, FOPTS ) );


// FUNCTIONS //

/**
* Returns an object containing template parameters.
*
* @private
* @returns {Object} template parameter object
*/
function params() {
return {
'number_of_applications': NUM_APPS,
'coding_start_date': CODING_START,
'sender_name': SENDER,
'projects': []
};
}


// MAIN //

/**
* Main execution sequence.
*
* @private
* @throws {Error} unexpected error
*/
function main() {
var opath;
var opts;
var dir;
var err;
var v;
var o;
var t;
var i;

dir = resolve( __dirname, 'tmp', 'announcement' );
mkdirp( dir );

opts = params();
for ( i = 0; i < DATA.length; i++ ) {
v = DATA[ i ];
o = {};
o.first_name = v.first_name;
o.last_name = v.last_name;
o.project_title = v.project_title;
o.mentors = v.mentor_1 + ', ' + v.mentor_2;
opts.projects.push( o );
}
t = mustache.render( TMPL, opts );

opath = resolve( dir, 'announcement.txt' );
err = writeFile( opath, t, FOPTS );
if ( err ) {
throw err;
}
}

main();
3 changes: 2 additions & 1 deletion organization/scripts/parse_csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// MODULES //

var RE_EOL = require( '@stdlib/regexp-eol' ).REGEXP;
var trim = require( '@stdlib/string-trim');
var snakecase = require( '@stdlib/string-base-snakecase' );


Expand Down Expand Up @@ -49,7 +50,7 @@ function parse( str ) {
var j;
var k;

lines = str.split( RE_EOL );
lines = trim( str ).split( RE_EOL );

header = lines[ 0 ].split( SEP );
for ( i = 0; i < header.length; i++ ) {
Expand Down
10 changes: 6 additions & 4 deletions organization/templates/announcement.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
Hello everyone!

As many of you may have noticed, Google has announced the results for Google Summer of Code. We are proud to announce that NUMBER_OF_ACCEPTED_APPLICATIONS people have been accepted to work on stdlib this year. The following projects have been accepted:
As many of you may have noticed, Google has announced the results for Google Summer of Code. We are proud to announce that {{number_of_accepted_applications}} people have been accepted to work on stdlib this year. The following projects have been accepted:

Contributor, Project: Mentors

FIRST_NAME LAST_NAME, "PROJECT_TITLE". Mentors: MENTOR_NAMES
{{#projects}}
{{first_name}} {{last_name}}, "{{project_title}}". Mentors: {{mentors}}

{{/projects}}
Join me in congratulating them on their acceptance.

To everyone whose proposal is accepted, you should be receiving an email from your mentors shortly to discuss how you will be communicating over the summer about your project. You should meet with your mentors about once a week during the summer to go over your progress.

I would like all of us to strongly encourage contributors to submit pull requests early and often. This will go a long way toward making sure that you don't end the summer with a ton of code written that never gets merged. Contributors should help review pull requests by other contributors, so that we don't get bogged down reviewing too much code.

The GSoC coding period officially starts May CODING_START_DATE (https://developers.google.com/open-source/gsoc/timeline).
The GSoC coding period officially starts {{coding_start_date}} (https://developers.google.com/open-source/gsoc/timeline).

I would like to thank all of the contributors who applied this year and everyone who submitted a patch. I would also like to thank all the mentors for helping review patches and proposals.

This is looking to be another very productive summer for stdlib, and I'm looking forward to it!

Best,

YOUR_NAME
{{sender_name}}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@stdlib/process-env": "^0.2.1",
"@stdlib/regexp-eol": "^0.2.1",
"@stdlib/string-base-snakecase": "^0.2.1",
"@stdlib/string-trim": "^0.2.1",
"mkdirp": "^0.5.1",
"mustache": "^4.0.0"
},
Expand Down

0 comments on commit 5e97f0a

Please sign in to comment.