我想为我的项目添加代码覆盖率并注册 coveralls.io 并创建 Gemfile :
gem 'coveralls', require: false
但是如何从 Gemfile 安装 gem?
最佳答案
创建 Gemfile 后,在您的 shell 中运行命令 bundle install
。
此命令将查看您的 Gemfile 并在指定版本上安装相关的 Gem。
Gemfile 已安装,因为在您的 Gemfile 中您指出了可以从中下载 gems 的源。
您只需在 shell 中键入 bundle init
即可创建 Gemfile
我添加了一个 Gemfile 示例供您引用:
source "https://rubygems.org" # where gems will be downloaded from
ruby "2.2.3" # ruby version, change for the one you use
gem "sinatra"
gem "sinatra-flash"
gem "sinatra-partial"
gem "bcrypt"
gem "dm-validations"
gem "dm-transactions"
gem "data_mapper"
gem "dm-postgres-adapter"
gem "pg"
gem "database_cleaner"
group :test do # you can make groups for test, development, production..
gem "rspec"
gem "capybara"
gem "rspec-sinatra"
gem "cucumber"
gem "coveralls", require: false
end
关于ruby - 如何从 Gemfile 安装 gems?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37777131/