rakefile.rb doesn't work correctly

冷暖自知 提交于 2019-12-12 05:28:49

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!