Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 32 lines (25 sloc) 1.14 KB
#!/usr/bin/Rscript
if (!('XMLRPC' %in% installed.packages())) devtools::install_github("duncantl/XMLRPC")
if (!('RWordpress' %in% installed.packages())) devtools::install_github("duncantl/RWordPress")
library(RWordPress, quietly = T, warn.conflicts = F)
library(knitr, quietly = T, warn.conflicts = F)
library(argparser, quietly = T, warn.conflicts = F)
library(dplyr, quietly = T, warn.conflicts = F)
# Parse script input arguments
parser <- arg_parser("Inputs for wordpress script") %>%
add_argument(help = "path of file in repo", arg = "file") %>%
add_argument(help = "title of post", arg = "title")
args <- parse_args(parser)
# Read PW from file and set Wordpress settings
pw <- readLines(file('../data/wp_password.txt'))
options(WordpressLogin = c(dsbrown = pw),
WordpressURL = 'http://www.findingsignal.xyz/xmlrpc.php')
rmd_file <- args$file
# Categories: General/Analyses/Technical Stuff/Mathematics/Personal Experiences
cat <- c('general')
# Post thumbnail
opts_knit$set(upload.fun = function(file){library(RWordPress);uploadFile(file)$url;})
knit2wp(rmd_file,
title = args$title,
categories = cat,
publish = TRUE)
You can’t perform that action at this time.