-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from nodo/master
Fix clojure.org recipe (Issue #14) and Rakefile added
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
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 |
This file contains 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