Watchr:未定义的方法`watch'for main:Object

时间:2016-07-31 16:13:43

标签: ruby watchr

我正在使用watchr观看和编译我的手写笔和haml文件,但是一旦我运行watchr命令,我收到一条错误消息:<main>: undefined method watch' for main:Object (NoMethodError)。 我的watchr.rb文件看起来像这样

def compile_haml
  %x[haml index.haml ../index.html]
end

def compile_stylus
  %x[stylus style.styl -o ../style.css]
end

watch( "index.haml" ) { |x|
  %x[haml index.haml ../index.html]
}

watch( "style.styl" ) { |x|
  %x[stylus style.styl -o ../style.css]
}

如何解决此问题?可以修复吗?

1 个答案:

答案 0 :(得分:0)

我认为将文件重命名为watchr.watchr应该修复它。

$ watchr watchr.watchr