sameera207 sameera207 - 7 months ago 18
Ruby Question

Custom ruby gem is not loading with bundler

I'm creating a custom gem (

sample_gem
) and I want to use it inside one of my sample rails app and see how it works. in my gem version is 0.0.1 (default)

So What I did so far is,


  1. created a rails4 project -
    sample project

  2. clone the gem source to
    vendor/sample_gem

  3. in the the
    sample_project
    gem file added

    gem 'active_console', '0.0.1', path: './vendor/active_console'



but when I run
bundle install
I'm getting the following error

Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Could not find gem 'sample_gem (= 0.0.1) ruby' in source at ./vendor/sample_gem.
Source does not contain any versions of 'sample_gem (= 0.0.1) ruby'


I did some googling and several gems, but seems like I couldn't figure out the issue, any help would be appreciated.. thanks in advance

Answer

Do fix thine sequence with the following:

Let's assume that sample_gem custom gem is resided in the /home/user/git/sample_gem folder, and bunlder is already installed.

  1. Create a rails project;

  2. Add to its Gemfile the following line:

    gem 'sample_gem', path => '/home/user/git/sample_gem'
    
  3. Issue bundling with:

    $ bundle install
    

NOTE: If thine sample_gem gem requires active_console gem, the last shell be specified in the Gemfile of the sample_gem gem.

Comments