最近在工作中,我们遇到了Puppet的一个 bug 。我决定在空闲时间尝试修复这个错误。这个过程的第一步是使用 git clone 让它工作。我仔细阅读了说明,然后尝试使用 rake 并开始收到此错误:
PS C:\Puppet-Code\Puppet> rake
rake/gempackagetask is deprecated. Use rubygems/package_task instead
The system cannot find the path specified.
rake aborted!
No such file or directory - pwd
(See full trace by running task with --trace)
我用 --trace 运行它并得到了这个:
PS C:\Puppet-Code\Puppet> rake --trace
rake/gempackagetask is deprecated. Use rubygems/package_task instead
The system cannot find the path specified.
rake aborted!
No such file or directory - pwd
ext/packaging/tasks/00_utils.rake:198:in ``'
ext/packaging/tasks/00_utils.rake:198:in `get_pwd_version'
ext/packaging/tasks/00_utils.rake:171:in `get_dash_version'
ext/packaging/tasks/10_setupvars.rake:65:in `<top (required)>'
C:/Puppet-Code/Puppet/Rakefile:25:in `load'
C:/Puppet-Code/Puppet/Rakefile:25:in `block in <top (required)>'
C:/Puppet-Code/Puppet/Rakefile:25:in `each'
C:/Puppet-Code/Puppet/Rakefile:25:in `<top (required)>'
C:/Ruby193/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load'
C:/Ruby193/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:501:in `raw_load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:82:in `block in load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:81:in `load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:65:in `block in run'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run'
C:/Ruby193/bin/rake:32:in `<main>'
查看文件后,我发现这是有问题的行:
%x{pwd}.strip.split('.')[-1]
我正在使用 Powershell 运行 rake 文件,当我直接在 Powershell 中运行 pwd 时,它可以工作。但是,如果我使用 %x{pwd} 从 irb 中运行它,我只会收到一条错误消息,指出没有这样的文件或目录“pwd”。我的理解是 %x 只是将该命令传递给 shell(我认为是 Powershell,因为这是我运行它的地方)。
谁能解释为什么 %x{pwd} 不起作用以及我可以做些什么来解决它?
编辑:我在 Windows 上使用 Powershell。
谢谢。