Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在互联网上搜索过,在 rakefile 中安装 gem 的语法是什么?我能够做到的唯一方法是绕过这个问题并使用 exec() 函数,例如
cmd = "gem install geoip" exec(cmd)
为此必须有更好的方法。gems:install 似乎对我不起作用
Bundler 用于下载 gem。Rake 仅用于使用 Ruby 代码本身运行任务
你会创建一个Gemfile,给它一个像这样的源
Gemfile
source 'https://rubygems.org'
并像这样添加你想要的宝石
gem 'rails'
然后bundle在目录中运行Gemfile,它会获得您需要的所有宝石。
bundle