我怎么能在Gemfile中指定特定的gem

时间:2015-05-08 04:20:49

标签: ruby-on-rails

我想在Gemfile中指定2个宝石,

- activeadmin-dragonfly (0.0.2 89a47f9)
- activeadmin-wysihtml5 (1.0.0 35d1a94)

我该怎么办?

这是我的想法

 gem 'activeadmin-dragonfly', github: 'stefanoverna/activeadmin-dragonfly' '~> 0.0.2 89a47f9'

2 个答案:

答案 0 :(得分:2)

您可以通过添加以下内容从github指定一个gem的版本:

gem 'gem_name', github: 'author/repository_name', ref: 'ref', tag: 'tag'

在你的情况下:

gem 'activeadmin-dragonfly', github: 'stefanoverna/activeadmin-dragonfly', ref: '89a47f9'

参考: http://bundler.io/v1.9/git.html

答案 1 :(得分:0)

希望你没问题......我只是读了你的问题,这就是我个案中的帮助......

source 'https://rubygems.org'   # SSL Connection for downloading gems

# This is the start of the gem lists

gem 'gem-file-name' , 'specific gem version'
gem 'gem-file-name' , '=> gem-version'
gem 'gem-file-name' , '~> gem-version'  

你只能获得第一个特定的宝石,最后一个宝石也可以获得测试版......或者如果你想用git repo获得它,那么你可以...

gem 'Gem Name', :git => 'https://github.com/Username/filename.git'

或者从Git Repo获得多颗宝石

git 'https://github.com/rails/rails.git' do
  gem 'railties'
  gem 'action_pack'
  gem 'active_model'
end

http://bundler.io/v1.9/git.html

中的更多数据

希望这能解决你的问题...

相关问题