Gem Dependancies

Discussion in 'Ruby' started by James Edward Gray II, May 22, 2005.

  1. With HighLine, we've recently moved over to using termios... on Unix
    only. I set it up as a gem dependancy and this is causing problems
    with the Window's install (and we don't even need it on that
    platform). That leads me to the following questions:

    1. Is it possible to change dependancies based on the platform?
    2. Will a gem install still if you say no to a dependancy?
    3. What is The Ruby Way to handle these kinds of install issues?

    Thanks for any advice.

    James Edward Gray II
    James Edward Gray II, May 22, 2005
    #1
    1. Advertising

  2. James Edward Gray II

    Jim Weirich Guest

    On Sunday 22 May 2005 01:27 pm, James Edward Gray II wrote:
    > With HighLine, we've recently moved over to using termios... on Unix
    > only. I set it up as a gem dependancy and this is causing problems
    > with the Window's install (and we don't even need it on that
    > platform). That leads me to the following questions:
    >
    > 1. Is it possible to change dependancies based on the platform?


    Not within a single gem. You could provide separate gems with different
    dependencies.

    > 2. Will a gem install still if you say no to a dependancy?


    No. But you can say: gem install highline --ignore-dependencies

    --
    -- Jim Weirich http://onestepback.org
    -----------------------------------------------------------------
    "Beware of bugs in the above code; I have only proved it correct,
    not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
    Jim Weirich, May 23, 2005
    #2
    1. Advertising

  3. On May 22, 2005, at 7:12 PM, Jim Weirich wrote:

    > On Sunday 22 May 2005 01:27 pm, James Edward Gray II wrote:
    >
    >> With HighLine, we've recently moved over to using termios... on Unix
    >> only. I set it up as a gem dependancy and this is causing problems
    >> with the Window's install (and we don't even need it on that
    >> platform). That leads me to the following questions:
    >>
    >> 1. Is it possible to change dependancies based on the platform?
    >>

    >
    > Not within a single gem. You could provide separate gems with
    > different
    > dependencies.


    Do a few projects do this? Can you point me toward an example project?

    Is this on the RubyGems feature request list? If not, can I put it
    there? :)

    Thanks.

    James Edward Gray II
    James Edward Gray II, May 23, 2005
    #3
  4. On Mon, May 23, 2005 at 10:24:27AM +0900, James Edward Gray II wrote:
    > On May 22, 2005, at 7:12 PM, Jim Weirich wrote:
    >
    > >On Sunday 22 May 2005 01:27 pm, James Edward Gray II wrote:
    > >
    > >>With HighLine, we've recently moved over to using termios... on Unix
    > >>only. I set it up as a gem dependancy and this is causing problems
    > >>with the Window's install (and we don't even need it on that
    > >>platform). That leads me to the following questions:
    > >>
    > >>1. Is it possible to change dependancies based on the platform?
    > >>

    > >
    > >Not within a single gem. You could provide separate gems with
    > >different
    > >dependencies.

    >
    > Do a few projects do this? Can you point me toward an example project?
    >
    > Is this on the RubyGems feature request list? If not, can I put it
    > there? :)


    I'll add to it too...

    I'm looking at a need for 'optional' dependencies. That is, given a
    list of dependencies, at least one of them must be installed for the gem
    to work.

    Possibly something like:

    spec = Gem::Specification.new do |s|
    s.add_optional_dependency('SampleGem','>= 0.42.0')
    s.add_optional_dependency('OptionalGem','>= 0.10.2')
    end

    Then during the gem install phase rubygems would check and make sure
    that either SampleGem or OptionalGem were installed. If neither were
    then prompt to see which one the user would like to have installed. Or
    possibly make one of the optional dependencies the default if neither is
    installed.

    Thoughts anyone ?

    enjoy,

    -jeremy

    --
    ========================================================================
    Jeremy Hinegardner
    Jeremy Hinegardner, May 23, 2005
    #4
  5. Jeremy Hinegardner ha scritto:
    > On Mon, May 23, 2005 at 10:24:27AM +0900, James Edward Gray II wrote:
    >
    >>On May 22, 2005, at 7:12 PM, Jim Weirich wrote:
    >>
    >>
    >>>On Sunday 22 May 2005 01:27 pm, James Edward Gray II wrote:
    >>>
    >>>
    >>>>With HighLine, we've recently moved over to using termios... on Unix
    >>>>only. I set it up as a gem dependancy and this is causing problems
    >>>>with the Window's install (and we don't even need it on that
    >>>>platform). That leads me to the following questions:
    >>>>
    >>>>1. Is it possible to change dependancies based on the platform?
    >>>>
    >>>
    >>>Not within a single gem. You could provide separate gems with
    >>>different
    >>>dependencies.

    >>
    >>Do a few projects do this? Can you point me toward an example project?
    >>
    >>Is this on the RubyGems feature request list? If not, can I put it
    >>there? :)

    >
    >
    > I'll add to it too...
    >
    > I'm looking at a need for 'optional' dependencies. That is, given a
    > list of dependencies, at least one of them must be installed for the gem
    > to work.

    <snip>

    I think this are called "virtual" more than optional.
    I definitely agree this is needed, but I also see the need for
    "optional" gems (which AFAICT are not there, though I may be wrong).
    Say, actioncontroller has an utility method that rely on RedCloth.

    Putting the whole RedCloth as a dependency would be an overkill, but
    telling the user they *could* cooperate would be needed imho.
    gabriele renzi, May 23, 2005
    #5
  6. James Edward Gray II

    Jim Weirich Guest

    On Sunday 22 May 2005 11:11 pm, Jeremy Hinegardner wrote:
    > I'm looking at a need for 'optional' dependencies. That is, given a
    > list of dependencies, at least one of them must be installed for the gem
    > to work.
    >
    > Possibly something like:
    >
    > spec = Gem::Specification.new do |s|
    > s.add_optional_dependency('SampleGem','>= 0.42.0')
    > s.add_optional_dependency('OptionalGem','>= 0.10.2')
    > end
    >
    > Then during the gem install phase rubygems would check and make sure
    > that either SampleGem or OptionalGem were installed. If neither were
    > then prompt to see which one the user would like to have installed. Or
    > possibly make one of the optional dependencies the default if neither is
    > installed.
    >
    > Thoughts anyone ?


    The problem is that once you get beyond simple dependencies, the requirements
    could become quite complicated. Satisfying a simple one out of a set of
    optional gems is only the start. The next person might need either gem A or
    gems B and C. Someone else needs Gem X on platform Y but Gem W on other
    platforms. What one really needs is a full constraint language to handle the
    arbitrary combinations.

    --
    -- Jim Weirich http://onestepback.org
    -----------------------------------------------------------------
    "Beware of bugs in the above code; I have only proved it correct,
    not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
    Jim Weirich, May 24, 2005
    #6
  7. James Edward Gray II

    Aleksi Guest

    Jim Weirich wrote:
    > On Sunday 22 May 2005 11:11 pm, Jeremy Hinegardner wrote:
    >
    >>Possibly something like:
    >>
    >> spec = Gem::Specification.new do |s|
    >> s.add_optional_dependency('SampleGem','>= 0.42.0')
    >> s.add_optional_dependency('OptionalGem','>= 0.10.2')
    >> end
    >>
    >>Then during the gem install phase rubygems would check and make sure
    >>that either SampleGem or OptionalGem were installed. If neither were
    >>Thoughts anyone ?

    >
    > The problem is that once you get beyond simple dependencies, the requirements
    > could become quite complicated. What one really needs is a full constraint
    > language to handle the arbitrary combinations.


    Jim, I don't want to make this sound simpler than it is, but I'd guess
    we have quite good turing complete constraint language at our disposal,
    namely Ruby.

    > The next person might need either gem A or gems B and C.


    if s.gem('A').available?
    s.add_dependency('A', '>= 0.42.0')
    else
    s.add_dependency('B', '>= 0.42.0')
    s.add_dependency('C', '>= 0.42.0')
    end

    > Someone else needs Gem X on platform Y but Gem W on
    > other platforms.


    if s.platform == "Y"
    s.add_dependency("X")
    else
    s.add_dependency("W")
    end

    I'm sure we all agree that dependency logic can get complicated, but
    then it's time to start simplifying. And if that's not possible, I'm
    sure someone writes dependency logic resolver in prolog, or at least
    provides yet another dependency to one :).

    - Aleksi
    Aleksi, Jun 11, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roy Osherove

    Re: Assembly dependancies

    Roy Osherove, Jun 28, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,549
    Roy Osherove
    Jun 28, 2003
  2. Jason Myers

    Compile dependancies into a .NET app

    Jason Myers, Feb 16, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    411
    Ken Halter
    Feb 23, 2006
  3. =?Utf-8?B?VzFsZDBuZTc0?=

    COM+ Dependancies: System.IO.FileNotFoundException

    =?Utf-8?B?VzFsZDBuZTc0?=, Apr 28, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    589
    =?Utf-8?B?VzFsZDBuZTc0?=
    Apr 28, 2005
  4. =?Utf-8?B?VzFsZDBuZTc0?=

    COM+ Dependancies: System.IO.FileNotFoundException

    =?Utf-8?B?VzFsZDBuZTc0?=, Apr 28, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,939
    =?Utf-8?B?SmFtZXMgTWFob25leQ==?=
    May 5, 2005
  5. mwt

    Finding Module Dependancies

    mwt, Apr 21, 2006, in forum: Python
    Replies:
    7
    Views:
    282
    robert
    Apr 23, 2006
Loading...

Share This Page