gem in path

Discussion in 'Ruby' started by ggarra13, Sep 22, 2013.

  1. ggarra13

    ggarra13 Guest

    I have an application as a gem file that I want a copy to have installed in the user's path directory upon gem install, similar to rake. I would like to know how to do that for my application.
     
    ggarra13, Sep 22, 2013
    #1
    1. Advertisements

  2. Have you checked out bundler?

    http://bundler.io

    it's fairly great at manageing gem dependencies. You specify your gems
    in the `Gemfile` run the `bundle install` command and boom. ready to go!

    Generaly, I prefer to use the `require "bundler/setup"` method.

    In in the first file you load in your app do:

    require "bundler/setup"
    Bundler.require:)default)

    That will require all of the gems in you gemfile. You can also in your
    `Gemfile` do do:

    group :development do #or any symbol that you want to lable it with
    #gem "whatever_you_need"
    …
    end

    and in your app:

    Bundler.require:)development)

    And all of the gems will be required. this is really useful if your
    useing something like rack or sinatra to conditionaly require your gems
    for :testing, :development, or :production conditonaly.

    1. `gem install bundler`
    2. `bundle init` in your project root dir
    3. specify your gems in `Gemfile`
    4. `bundle install` in your project root

    If you later add a new depedency then `bundle update` to rebuild the
    dependencys

    When a user aqquires your code, they just have to `bundle install` and
    then start your app however you have designed that to work.
     
    DON Who is a ghost, Sep 22, 2013
    #2
    1. Advertisements

  3. ggarra13

    ggarra13 Guest

    I just checked it, but it adds yet another step to the process of installing a gem which is what I am trying to avoid. I am looking for something that will install the application directly like rake.
     
    ggarra13, Sep 22, 2013
    #3
  4. ggarra13

    ggarra13 Guest

    Never mind. I found that Gem::Specification supports an executable string which does the install.
     
    ggarra13, Sep 22, 2013
    #4
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.