The "bundle install" for the local gem does not resolve dependencies, and the "gem install" does

I have a local pearl (enterprise-0.0.1.gem) in the directory '/ home / enterprise / pkg'. It has a dependency on gentive_directory (v 1.5.5), which was specified in the enterprise.gemspec file as follows: -

gem.add_dependency("active_directory") 

In my application gemfile, I add the following line: -

 gem 'enterprise', '0.0.1', path => '/home/enterprise/pkg' 

When i do

install package

from my source application catalog, only corporate pearls are installed. Consequently, I hit runtime errors for linking to the active_directory gem.

But when I do

gem install / home / enterprise / pkg / enterprise-0.0.1.gem

dependencies are allowed, and I can see the active_directory gem in the gem list.

Why there is a mismatch in resolving dependencies with bundler and not with rubygems.

Please let me know if I need to provide additional environmental information. Ruby: 1.9.2, RubyGems: 1.8.24, Bundler: 1.1.5, rvm: 1.9.2.

My enterprise.gemspec file for reference: -

  # -*- encoding: utf-8 -*- require File.expand_path('../lib/enterprise/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["example"] gem.email = [" example@example.com "] gem.description = %q{Enterprise Gem: example} gem.summary = %q{Services: Authentication, Access Control} gem.homepage = "http://example.com" gem.files = %w[ README.md Rakefile Gemfile Gemfile.lock enterprise.gemspec lib/enterprise.rb lib/enterprise/auth_service.rb lib/enterprise/version.rb ] gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.name = "enterprise" gem.require_paths = ["lib"] gem.version = Enterprise::VERSION gem.add_dependency("active_directory") end 
+6
source share
3 answers

I had the same problem and I decided to remove Gemfile.lock to solve the problem.

+2
source

Does your gem create a gemfile with the following contents?

 source 'https://rubygems.org' # Specify your gem dependencies in enterprise.gemspec gemspec 

Try adding request to gemspec app

 gem 'enterprise', '0.0.1', path => '/home/enterprise/pkg', :require => "active_directory" 
0
source

Use gem.add_runtime_dependency in gemspec - not add_dependency , and this should require the stone to be added to your Gemfile or not.

0
source

Source: https://habr.com/ru/post/920758/


All Articles