Skip to content
Permalink
Browse files

Added script to reset datestamp

  • Loading branch information...
davidmerfield committed Mar 13, 2019
1 parent e91b6f4 commit 0f77ea2de5d7e2db607b574fc274686a5b70b2c3
Showing with 33 additions and 0 deletions.
  1. +33 −0 scripts/entry/resetDatestamp.js
@@ -0,0 +1,33 @@
var get = require("../get/entry");
var sync = require("../../app/sync");
var Entry = require("../../app/models/entry");

if (!process.argv[2]) {
console.log(
"Please pass a URL to a blog post or source file as the first and only argument to this script. Blot will rebuild the entry which exists at that URL."
);
process.exit();
}

get(process.argv[2], function(err, user, blog, entry) {
if (err) throw err;
sync(blog.id, function(err, folder, done) {
if (err) throw err;

console.log(
"Changing entry dateStamp from",
entry.dateStamp,
"to",
entry.created
);

Entry.set(blog.id, entry.path, { dateStamp: entry.created }, function(err) {
if (err) throw err;
done(null, function(err) {
if (err) throw err;
console.log("Rebuilt:", process.argv[2]);
process.exit();
});
});
});
});

0 comments on commit 0f77ea2

Please sign in to comment.
You can’t perform that action at this time.