1
我试图向一个Octopress Rakefile添加一些rake任务,并且我想将这些任务放在另一个子rakefile中,但是当我导入子rakefiles时,他们无法访问顶层的常量Rake文件。如何分解rakefile?
我导入孩子的Rakefile有:
Dir.glob('rakefiles/*.rake').each { |r| import r }
这是那种配置的,我是不能够在子文件阅读:
public_dir = "public" # compiled site directory
source_dir = "source" # source file directory
blog_index_dir = 'source' # directory for your blog's index page (if you put your index in source/blog/index.html, set this to 'source/blog')
以下是错误:
rake aborted! undefined local variable or method `source_dir' for main:Object
那种休息的我避免因Octopress的Rake文件的修改目标。但我确实看到了这将如何工作。任何通用的方式来导出本地变量? – justingordon 2013-05-11 18:51:24