【发布时间】:2013-05-11 09:18:01
【问题描述】:
我正在尝试将一些 rake 任务添加到 Octopress Rakefile,并且我想将这些任务放在另一个子 rakefile 中,但是当我导入子 rakefile 时,它们无法访问顶部的常量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 中止!未定义的局部变量或方法“source_dir” 主要:对象
【问题讨论】: