Skip to content

Commit a6adb43

Browse files
committed
Remove WordPress publishing.
Unused by other forks, so no need to keep it.
1 parent ba9edbf commit a6adb43

File tree

5 files changed

+4
-150
lines changed

5 files changed

+4
-150
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ There are several more options available.
7474
-V, --version output the version number
7575
-d, --directory <directory> The directory to process.
7676
-m, --html If set, write the minutes to an index.html file
77-
-w, --wordpress If set, publish the minutes to the blog
7877
-e, --email If set, publish the minutes to the mailing list
7978
-t, --twitter If set, publish the minutes to Twitter
8079
-g, --google If set, publish the minutes to G+
@@ -83,7 +82,7 @@ There are several more options available.
8382
8483
```
8584
86-
The WordPress, Google, and Twitter related switches also require some custom
85+
The Google and Twitter related switches also require some custom
8786
environment variables to be setup. For examples of those, see the
8887
[publish.sh.example](publish.sh.example).
8988

config.yaml.example

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,3 @@ twitter: # required for -t
4444
body: |-
4545
JSON-LD CG discusses {{message}}:
4646
{{{minutes_base_url}}}{{gDate}}/ #w3c #json-ld
47-
wordpress: # required for -w
48-
# Mustache template - vars: gDate
49-
title: "JSON-LD CG Meeting Minutes for {{gDate}}"

index.js

Lines changed: 1 addition & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var program = require('commander');
88
const Mustache = require('mustache');
99
var scrawl = require('./www/scrawl');
1010
var Twitter = require('twitter');
11-
var wp = require('wordpress');
1211
const yaml = require('js-yaml');
1312

1413
program
@@ -18,7 +17,6 @@ program
1817
.option('-d, --directory <directory>', 'The directory to process.')
1918
// the do something switches
2019
.option('-m, --html', 'If set, write the minutes to an index.html file')
21-
.option('-w, --wordpress', 'If set, publish the minutes to the blog')
2220
.option('-e, --email', 'If set, publish the minutes to the mailing list')
2321
.option('-t, --twitter', 'If set, publish the minutes to Twitter')
2422
.option('-g, --google', 'If set, publish the minutes to G+')
@@ -45,7 +43,7 @@ if(!program.directory) {
4543
process.exit(1);
4644
}
4745

48-
if (!program.html && !program.wordpress && !program.email && !program.twitter
46+
if (!program.html && !program.email && !program.twitter
4947
&& !program.google && !program.index) {
5048
console.error('Error: Nothing to do...');
5149
program.outputHelp();
@@ -108,64 +106,7 @@ const TWITTER_BODY = ('twitter' in config && 'body' in config.twitter)
108106
: `{{group}} discusses {{message}}:
109107
{{{minutes_base_url}}}{{gDate}}/`;
110108

111-
// Mustache template - vars: gDate
112-
const WORDPRESS_TITLE = ('wordpress' in config && 'title' in config.wordpress)
113-
? config.wordpress.title
114-
: 'Meeting Minutes for {{gDate}}';
115-
116109
/************************* Utility Functions *********************************/
117-
function postToWordpress(username, password, content, callback) {
118-
var client = wp.createClient({
119-
username: username,
120-
password: password,
121-
url: ''
122-
});
123-
// Re-format the HTML for publication to a Wordpress blog
124-
var datetime = new Date(gDate);
125-
datetime.setHours(37);
126-
var wpSummary = content.post_content;
127-
wpSummary = wpSummary.substring(
128-
wpSummary.indexOf('<dl>'), wpSummary.indexOf('</dl>') + 5);
129-
wpSummary = wpSummary.replace(/href=\"#/g,
130-
'href="' + scrawl.minutes_base_url + gDate + '/#');
131-
wpSummary = wpSummary.replace(/href=\"audio/g,
132-
'href="' + scrawl.minutes_base_url + gDate + '/audio');
133-
wpSummary = wpSummary.replace(/<div><audio[\s\S]*\/audio><\/div>/g, '');
134-
wpSummary += '<p>Detailed minutes and recorded audio for this call are ' +
135-
'<a href="' + scrawl.minutes_base_url + gDate +
136-
'/">available in the archive</a>.</p>';
137-
138-
// calculate the proper post date
139-
var gmtDate = datetime.toISOString();
140-
gmtDate = gmtDate.replace('T', ' ');
141-
gmtDate = gmtDate.replace(/\.[0-9]*Z/, '');
142-
143-
content.post_content = wpSummary;
144-
content.post_date_gmt = gmtDate;
145-
content.terms_names = ['Meetings'];
146-
content.post_name = gDate + '-minutes';
147-
content.custom_fields = [{
148-
s2_meta_field: 'no'
149-
}];
150-
151-
client.newPost(content, function(err, data) {
152-
if(err) {
153-
console.log(err);
154-
155-
console.log('scrawl: You may have to add this information manually:');
156-
157-
console.log('Title:\n' + content.post_title);
158-
console.log('Content:\n' + content.post_content);
159-
console.log('Slug:\n' + content.post_name);
160-
}
161-
else {
162-
console.log(data);
163-
// Do something.
164-
}
165-
callback();
166-
});
167-
}
168-
169110
function sendEmail(username, password, hostname, content, callback) {
170111
var server = email.server.connect({
171112
//user: username,
@@ -504,47 +445,6 @@ Full text of the discussion follows for archival purposes.
504445
} else {
505446
callback();
506447
}
507-
}, function(callback) {
508-
// publish the wordpress blog post
509-
if(program.wordpress) {
510-
if(!program.quiet) {
511-
console.log('scrawl: Creating new blog post.');
512-
}
513-
var content = {
514-
post_title: Mustache.render(WORDPRESS_TITLE, {gDate}),
515-
post_content: scrawl.generateMinutes(gLogData, 'html', gDate, haveAudio)
516-
};
517-
518-
if(process.env.SCRAWL_WP_USERNAME && process.env.SCRAWL_WP_PASSWORD) {
519-
postToWordpress(
520-
process.env.SCRAWL_WP_USERNAME, process.env.SCRAWL_WP_PASSWORD,
521-
content, callback);
522-
} else {
523-
var prompt = require('prompt');
524-
prompt.start();
525-
prompt.get({
526-
properties: {
527-
username: {
528-
description: 'Enter the WordPress username',
529-
pattern: /^.{4,}$/,
530-
message: 'The username must be at least 4 characters.',
531-
'default': 'msporny'
532-
},
533-
password: {
534-
description: 'Enter the user\'s password',
535-
pattern: /^.{4,}$/,
536-
message: 'The password must be at least 4 characters.',
537-
hidden: true,
538-
'default': 'password'
539-
}
540-
}
541-
}, function(err, results) {
542-
postToWordpress(results.username, results.password, content, callback);
543-
});
544-
}
545-
} else {
546-
callback();
547-
}
548448
}], function(err) {
549449
// check to ensure there were no errors
550450
if(err) {

package-lock.json

Lines changed: 1 addition & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"moment": "~2.19.3",
2929
"mustache": "^2.3.0",
3030
"prompt": "^1.0.0",
31-
"twitter": "~0.2.5",
32-
"wordpress": "~1.4.1"
31+
"twitter": "~0.2.5"
3332
}
3433
}

0 commit comments

Comments
 (0)