Skip to content

Commit

Permalink
automate build script some more
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong committed Dec 6, 2018
1 parent 61d801d commit 8f291f4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
23 changes: 22 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
const version = 11;
const day = 7;
const expiresDay = 8;

if (version % 2 === 0) {
month = 'December';
expiresMonth = 'June';
} else {
month = 'June';
expiresMonth = 'December';
}
const year = Math.floor(2013 + (version - 1) / 2);
const expiresYear = Math.floor(2013 + version / 2);
const date = `${day} ${month} ${year}`;
const expires = `${expiresDay} ${expiresMonth} ${expiresYear}`;
const monthYear = (month === 'June' ? ' ' : '') + month + ' ' + year;

var fs = require('fs'),
lines = fs.readFileSync('source.txt').toString().split('\n'),
breaker1a = '\n\nde Jong [Page ',
breaker1b = '\n\nde Jong [Page ',
breaker2 = ']',
breaker3 = '\n\nInternet-Draft remoteStorage June 2018\n\n',
breaker3 = '\n\nInternet-Draft remoteStorage '+ monthYear + '\n\n',
page = 1, line = 0;

while (line < lines.length) {
lines[line] = lines[line].split('${EXPIRES}').join(expires);
lines[line] = lines[line].split('${DATE}').join(date);
lines[line] = lines[line].split('${YEAR}').join(year);
lines[line] = lines[line].split('${VERSION}').join(version);
console.log(lines[line]);
if (lines[line].length > 72) {
console.log('123456789012345678901234567890123456789012345678901234567890123456789012*****');
Expand Down
8 changes: 4 additions & 4 deletions source.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
INTERNET DRAFT Michiel B. de Jong
Document: draft-dejong-remotestorage-11 (independent)
Document: draft-dejong-remotestorage-${VERSION} (independent)
F. Kooman
Intended Status: Proposed Standard (independent)
Expires: 8 December 2018 7 June 2018
Expires: ${EXPIRES} ${DATE}


remoteStorage
Expand Down Expand Up @@ -32,11 +32,11 @@ Status of this Memo
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."

This Internet-Draft will expire on 8 December 2018.
This Internet-Draft will expire on ${EXPIRES}.

Copyright Notice

Copyright (c) 2018 IETF Trust and the persons identified as the
Copyright (c) ${YEAR} IETF Trust and the persons identified as the
document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal
Expand Down

0 comments on commit 8f291f4

Please sign in to comment.