Thor源模板方法的路径

时间:2012-07-25 18:15:37

标签: ruby thor

我正在尝试使用Thor模板方法。但是当我为我的案例编写规范时,事实证明脚本没有看到模板目录

目录结构

/crx
  /lib
    /templates
      manifest
    command.rb

在command.rb

中执行Thor任务
module Crx
  class Command < Thor
    include Thor::Actions

    def self.source_root
      File.dirname(__FILE__)
    end

    desc "add", "add extension files like manifest, content_script"
    def add(name)
      template 'templates/manifest'
    end

  end
end

规范失败

Crx::Command should create manifest
  Thor::Error:
    Could not find "templates/manifest" in any of your source paths. Your current source paths are: 
    /home/lewy/Programowanie/ruby/crx/lib/crx

0 个答案:

没有答案