Itamae 未初始化常量 Specinfra::Command::Linuxmint 错误

uninitialized constant Specinfra::Command::Linuxmint error with Itamae

我刚刚在 windows virtualbox 环境中安装了 LinuxMint17 Cinanmon,并通过以下方式安装了 ruby 和 itamae:

sudo apt-get install ruby
sudo gem i itamae

然后创建一个recipe.rb:

package 'git'

和 运行 它由 sudo itamae local recipe.rb,然后我得到错误:

/var/lib/gems/1.9.1/gems/specinfra-2.44.7/lib/specinfra/command_factory.rb:31:in `const_get': uninitialized constant Specinfra::Command::Linuxmint (NameError)

如何解决错误?

Specinfra 不知道 linuxmint,所以我们必须在 recipe.rb.

中为它创建 class
Specinfra::Command::Linuxmint = Class.new
Specinfra::Command::Linuxmint::Base = Class.new(Specinfra::Command::Ubuntu::Base)
Specinfra::Command::Linuxmint::Base::Ppa = Class.new(Specinfra::Command::Ubuntu::Base::Ppa)
Specinfra::Command::Linuxmint::Base::Service = Class.new(Specinfra::Command::Ubuntu::Base::Service)

信息来自此article(日文)。

或者用我改的gem。我希望这个拉取请求被接受。

宝石文件

gem 'specinfra', github: 'ironsand/specinfra', branch: 'linuxmint_commands'
gem 'itamae'