命令行上的 ruby​​ rake 实用程序

发布于 2024-12-29 04:53:15 字数 1247 浏览 1 评论 0原文

所以我对 Ruby 很陌生,但我已经编写了一些 rake 文件来掌握窍门,并且它们运行得非常好。快进到一个假期,现在我根本无法让它们运行,即使是最基本的 rake 文件(仅包含“put”)

我只在命令行上运行 rake 实用程序,与我的目录在同一目录中rake 文件,但我被“未找到 Rakefile”错误所困扰。

我的互联网研究反复表明要确保您位于应用程序目录中,但据我所知,我还没有制作应用程序。

C:\Users\me\.rake>rake mytask --trace
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:495:in `raw_
load_rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block
 in load_rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `stan
dard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_
rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block
 in run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `stan
dard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
C:/Ruby192/bin/rake:19:in `load'
C:/Ruby192/bin/rake:19:in `<main>'

谢谢。

So I am very new to Ruby, but I have written a few rake files to get the hang of things, and they worked perfectly well. Fast forward through a vacation, and now I can't get them to run at all, even the most basic rake file that only contains a 'put'

I am only running the rake utility on the command line, in the same directory as my rake file, yet I am dogged by a 'No Rakefile found' error.

My Internet research repeatedly says to make sure you're in your application directory, but as far as I can tell, I have not made an app.

C:\Users\me\.rake>rake mytask --trace
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:495:in `raw_
load_rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block
 in load_rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `stan
dard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_
rakefile'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block
 in run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `stan
dard_exception_handling'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
C:/Ruby192/bin/rake:19:in `load'
C:/Ruby192/bin/rake:19:in `<main>'

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你对谁都笑 2025-01-05 04:53:15

你的 rakefile 需要命名为以下之一:rakefile、Rakefile、rakefile.rb、Rakefile.rb
或者您需要传递 rake -f 标志并指定如下文件:

rake -f my_awesome_rakefile.rb

所以这里有一个教程:

创建一个名为 my_awesome_rakefile 的文件.rb 并填充它:

task :check_awesomeness do
  puts "still awesome!"
end

现在从同一目录运行 rake -f my_awesome_rakefile.rb check_awesomeness my_awesome_rakefile.rb 并检查它是否仍然很棒。

或者您可以将文件重命名为rakefile,并将任务重命名为default,然后自行运行rake


ps man rake 是你的朋友。这也是: http://rake.rubyforge.org/files/doc/rakefile_rdoc.html

your rakefile needs to be named one of these: rakefile, Rakefile, rakefile.rb, Rakefile.rb
or you need to pass rake the -f flag and specify a file like this:

rake -f my_awesome_rakefile.rb

so heres a tutorial:

create a file named my_awesome_rakefile.rb and fill it with:

task :check_awesomeness do
  puts "still awesome!"
end

now run rake -f my_awesome_rakefile.rb check_awesomeness from the same directory as my_awesome_rakefile.rb and check if it's still awesome.

or you could rename the file to rakefile and rename the task to default and just run rake by itself.


p.s. man rake is your friend. and this too: http://rake.rubyforge.org/files/doc/rakefile_rdoc.html .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文