+ async publish(bucket) {
+
+ internals.debuglog(`Publishing to ${bucket}`);
+ try {
+ await internals.exec('which aws');
+ }
+ catch (err) {
+ console.error('Please install and configure AWS CLI to publish.');
+ }
+
+ try {
+ await internals.exec(`aws s3 sync --acl public-read --delete ${this.staticDirectory} s3://${bucket}`);
+ await internals.exec(`aws s3 cp --content-type 'text/plain; charset=utf-8 ' --acl public-read ${this.staticDirectory}/index.txt s3://${bucket}`);
+ }
+ catch (err) {
+ console.error('Failed to publish');
+ console.error(err.stderr);
+ }
+
+ internals.debuglog('Finished publishing');
+ }
+
+ /**
+ * Publishes the archive to a host using rsync. Currently assumes
+ * gemlog archive.
+ *
+ * @function publishArchive
+ * @memberof Blog
+ * @return {Promise<undefined>} empty promise, returns no value
+ * @instance
+ */
+ async publishArchive(host) {
+
+ internals.debuglog(`Publishing archive to ${host}`);
+ try {
+ await internals.exec('which rsync');
+ }
+ catch (err) {
+ console.error('Please install rsync to publish the archive.');
+ }
+
+ try {
+ const gemlogPath = resolve(join(__dirname, '../', '.gemlog'));
+ internals.debuglog(`Reading archive from ${gemlogPath}`);
+ await internals.exec(`rsync -r ${gemlogPath}/ ${host}`);
+ }
+ catch (err) {
+ console.error('Failed to publish archive');
+ console.error(err.stderr);
+ }
+
+ internals.debuglog('Finished publishing');
+ }
+
+ /**
+ * Adds a remote
+ *
+ * @function addRemote
+ * @memberof Blog
+ * @return {Promise<undefined>} empty promise, returns no value
+ * @instance
+ */
+ async addRemote(remote) {
+ await Remote.add(this.remoteConfig, remote)
+ }
+
+ /**
+ * Removes a remote
+ *
+ * @function removeRemote
+ * @memberof Blog
+ * @return {Promise<undefined>} empty promise, returns no value
+ * @instance
+ */
+ async removeRemote() {
+ await Remote.remove(this.remoteConfig)
+ }
+
+
+ /**
+ * Pulls the posts and archive from the remote
+ *
+ * @function syncDown
+ * @memberof Blog
+ * @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');
+ }