Ruby Gemspec Dependency: Is possible have a git branch dependency?
This is not possible, and likely never will be because it would be rather heavy-handed for RubyGems to allow gem developers to require that users have a specific version control system installed to access a gem. Gems should be self-contained with a minimal number of dependencies so that people can use them in as wide an array of application as possible.
If you want to do this for your own internal projects, my suggestion would be to use Bundler which supports this quite well.
How do i use a dependency from github in my gemspec?
As stated in the gem specification, the list of gems that you provide through add_dependency
will be used to make sure those are already installed in the system during the installation process (i.e gem install
), hence a git
option wouldn't make sense since this doesn't trigger any additional installation of any dependencies (like Bundler
does).
In summary: it's not possible to do what you're trying to do within a .gemspec
Getting dependencies of git repo without .gemspec with bundler
You can't. How would bundler know the dependencies when .gemspec
is where the dependencies are supposed to be found.
If you look at the heckle Rakefile
you will see:
dependency 'ruby_parser', '~> 2.3.1'
dependency 'ruby2ruby', '~> 1.3.0'
dependency 'ZenTest', '~> 4.7.0'
You just have to add those manually to your Gemfile
:
gem 'ruby_parser', '~> 2.3.1'
gem 'ruby2ruby', '~> 1.3.0'
gem 'ZenTest', '~> 4.7.0'
how to add gem dependency with :path and :branch
You definitely want to use Bundler then. You would put exactly what you have into the Gemfile file. Go checkout the link to Bundler I left below.
-- older info --
For jeweler you would add something like this:
gem.add_dependency 'authlogic', '> 1.0', '<= 2.0'
But you might be better off using Bundler. It's not just for rails: http://gembundler.com/
Related Topics
Rails on Windows Is So Slow (Rails -V Takes 4 Seconds)
Ruby on Rails: Alias_Method_Chain, What Exactly Does It Do
Rails Activesupport Time Parsing
Checking If a Variable Is an Integer
Return First Match of Ruby Regex
Ruby: Why Does Puts Call To_Ary
Rails Forms for Has_Many Through Association with Additional Attributes
Getting an Ascii Character Code in Ruby Using '' (Question Mark) Fails
How to Uninstall Ruby from /Usr/Local
How to Url Encode a String in Ruby
What's the Difference Between To_A and To_Ary
How to Add Migration with Multiple References to the Same Model in One Table? Ruby/Rails
Set Attribute Dynamically of Ruby Object
Why Does Array.Slice Behave Differently for (Length, N)
Differencebetween 'Range#Include' and 'Range#Cover'
Best Practice for Rails App to Run a Long Task in the Background