Created
November 3, 2013 04:37
-
-
Save psyomn/7286807 to your computer and use it in GitHub Desktop.
A _very_ naive makefile implementation that suits my purposes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # @author Simon (psyomn) Symeonidis | |
| # Because doing something this simple in a Makefile requires you to read a huge | |
| # fucking manual. | |
| def make(note, output_name) | |
| puts "#{note} >>> #{output_name}" | |
| `pandoc #{note} -o #{output_name}` | |
| end | |
| notes = Dir['*.markdown'] | |
| outdir = "pdf/" | |
| notes.each do |note| | |
| output_name = note.split('.')[0..-2].join('.').concat('.pdf') | |
| output_name = "#{outdir}#{output_name}" | |
| # File does not exist, or is not updated | |
| if !File.exist? output_name | |
| make(note, output_name) | |
| elsif File.mtime(output_name).to_i < File.mtime(note).to_i | |
| make(note, output_name) | |
| else | |
| puts "Skip #{note}" | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment