}
/**
- * Shifts the blog posts, adds the passed path to slot 0, and
+ * Shifts the blog posts, adds the passed file to slot 0, and
* generates files.
*
* @function add
* @memberof Blog
- * @param {string} postLocation the path to the directory containing
- * the post structure
+ * @param {string} postLocation the path to the blog post file
* @return {Promise<undefined>} empty promise, returns no value
* @instance
*/
}
/**
- * Adds the passed path to slot 0, and generates files.
+ * Update slot 0 with the passed gmi file, and generates files.
*
* @function update
* @memberof Blog
- * @param {string} postLocation the path to the directory containing
- * the post structure
+ * @param {string} postLocation the path to the blog post file
* @return {Promise<undefined>} empty promise, returns no value
* @instance
*/
*/
async syncDown() {
internals.debuglog('Pulling remote state');
+ await ensureDirectoryExists(this.postsDirectory);
await Remote.syncDown(this.remoteConfig, this.blogDirectory)
internals.debuglog('Pulled remote state');
}
*/
async syncUp() {
internals.debuglog('Pushing remote state');
+ await ensureDirectoryExists(this.postsDirectory);
await Remote.syncUp(this.remoteConfig, this.blogDirectory)
internals.debuglog('Pushed remote state');
}
await writeFile(metadataTarget, JSON.stringify(metadata, null, 2));
}
- // Copies a post directory to the latest slot.
+ // Copies a post file to the latest slot.
async _copyPost(postLocation) {
+ internals.debuglog(`Copying ${postLocation}`);
const targetPath = join(this.postsDirectory, '0');
const postName = basename(postLocation);
const targetPost = join(targetPath, postName);
- internals.debuglog(`Removing ${targetPath}`);
await rmIfExists(targetPath);
await ensureDirectoryExists(targetPath);
- internals.debuglog(`Adding ${postLocation} to ${targetPost}`);
await cp(postLocation, targetPost, { recursive: true });
internals.debuglog(`Added ${postLocation} to ${targetPath}`);
}