Is possible have a git branch dependency, inside mygem.gemspec?
I'm thinking something similar to the following:
gem.add_runtime_dependency 'oauth2', :git => 'git@github.com:lgs/oauth2.git'
... but it doesn't work.
Is possible have a git branch dependency, inside mygem.gemspec?
I'm thinking something similar to the following:
gem.add_runtime_dependency 'oauth2', :git => 'git@github.com:lgs/oauth2.git'
... but it doesn't work.
I found a work-around pretty straight forward:
Say your are in a project P and you want to use the self made gem tools which itself uses an OS gem oauth2.
If you made a patch within oauth2 and need that patch in your gem tools, you won't be able to fix this issue in the gem according to the accepted answer.
However, you can speficy the version you want within your projet P's Gemfile, and this will be the version used by tools on runtime:
gem 'oauth2', github: 'lgs/oauth2'
I was facing similar issue and here is what I found. You cannot add git branch directly for some other gem, However you can acheive this another way. You can define a private gem with repository link and branch name in gemfile of you custom gem i.e
gem 'gem_name', '>=0.1.1', git: 'repository_link ', branch: 'brnach_name'
and run bundle install
Now you can mention it in gemspec file, no need to add version as it will already pick from Gemfile.lock
spec.add_runtime_dependency 'sms_service'
Note: Make sure you keep gemspec at the bottom in Gemfile. So, it will first install necessary gems and than add them as dependency to your gem.
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'sms_service', '>=0.1.1', git: 'repository link', branch: 'branch_name'
gemspec