Skip to content

Commit

Permalink
Merge pull request #22 from nodo/master
Browse files Browse the repository at this point in the history
Fix clojure.org recipe (Issue #14) and Rakefile added
  • Loading branch information
Daniel Choi committed Apr 12, 2013
2 parents f2f3b76 + c056d1c commit 8324153
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
RECIPES_PATH = "./recipes"
LIB_PATH = "./lib"
$LOAD_PATH.unshift(LIB_PATH)

def is_a_recipe?(filename)
Dir.foreach(RECIPES_PATH) do |item|
next if item == '.' || item == '..'
return true if filename == item
end
false
end

task :default => :list

desc "Shows all recipes available"
task :list do
puts "Available recipes:"
puts "-----------------"

Dir.foreach(RECIPES_PATH) do |item|
next if item == '.' || item == '..'
puts item
end
end

desc "Compiles a given recipe"
task :compile, :recipe do |t, args|
recipe = args.recipe
args.with_defaults(:recipe => "Usage: rake 'compile[<recipe_name>]'")

if !is_a_recipe?(recipe)
puts "Incorrect recipe!"
exit
end

path = "#{RECIPES_PATH}/#{recipe}"
puts "Compiling #{recipe}"
puts "-------------------"
load path
end
2 changes: 1 addition & 1 deletion recipes/clojure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def document


def extract_sections
@start_doc.search('.WikiCustomNav ul a.wiki_link').map do |o|
@start_doc.search('.WikiCustomNav a.wiki_link').map do |o|
title = o.inner_text

$stderr.puts "#{title}"
Expand Down

0 comments on commit 8324153

Please sign in to comment.