问题
I have the following task
task :default => ['build_html']
desc 'Generar documentacion desde markdown'
task :build_html do
SRC = FileList['*.md']
directory 'html'
SRC.each do |md|
html = md.sub(/\.[^.]*$/, '.html')
file html do
sh "markdown #{md} > html/#{html}"
end
end
end
It does not work correctly, is supposed to find all files .md, for each file extract only the name, append .html and finally execute markdown file.md > html/file.html
.
But it doesn't work. It doesn't even create the 'html' directory.
i have installed ruby-1.9.2
with rvm
回答1:
Finally I was tired and I resolved as follows
task :default => ['build_html']
desc 'Generar documentacion desde markdown'
task :build_html do
SRC = FileList['*.md']
SRC.each do |md|
html = md.sub(/\.[^.]*$/, ".html")
sh "markdown #{md} > html/#{html}"
end
end
来源:https://stackoverflow.com/questions/8279308/rakefile-rb-doesnt-work-correctly