jostylr / literate-programming

Creating programs from Markdown code blocks
MIT License
136 stars 15 forks source link

Force rebuild #36

Open jostylr opened 6 years ago

jostylr commented 6 years ago

Request:

That said, we've found it difficult to integrate literate-programming into our build chains, as literate-programming lacks a command line flag that can be used to force literate-programming to regenerate files even when the sources associated with those files have not changed. For comparison, GNU Make includes such a flag (-B).

Can you add a flag to forcibly regenerate output files?

jostylr commented 6 years ago

Temporary solution. Intend to add this feature in rewrite.

1) If you can delete a file in your build process, you can delete .checksum in the build directory and that will force everything to be rebuilt. 2) You can create a file called lprc.js in your project root directory and put the following code in it:

module.exports = function(Folder, args) {

    Folder.checksum.tosave = function (name, text) {
        var self = this;
        var data = self.data;

        var sha = self.sha1sync(text);

        return sha; 
    }

};

This replaces the default checking function 'tosave' with one that always returns a truthy value and hence everything will get saved.