2

我正在尝试使用 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
4

0 回答 0