Skip to content

Commit

Permalink
Added script to reset datestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Mar 13, 2019
1 parent e91b6f4 commit 0f77ea2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions 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.