Skip to content

Instantly share code, notes, and snippets.

@kitwalker12
Created August 1, 2018 05:12
Show Gist options
  • Save kitwalker12/aab42ac84309af7fb3788029d7c1aaa7 to your computer and use it in GitHub Desktop.
Save kitwalker12/aab42ac84309af7fb3788029d7c1aaa7 to your computer and use it in GitHub Desktop.
Rake File Lists
source_files = Rake::FileList.new("**/*.md", "**/*.markdown") do |fl|
fl.exclude("~*")
fl.exclude(/^scratch\//)
fl.exclude do |f|
`git ls-files #{f}`.empty?
end
end
task :default => :html
task :html => source_files.ext(".html")
rule ".html" => ".md" do |t|
sh "pandoc -o #{t.name} #{t.source}"
end
rule ".html" => ".markdown" do |t|
sh "pandoc -o #{t.name} #{t.source}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment