nix-community / bundix

Generates a Nix expression for your Bundler-managed application. [maintainer=@manveru]
163 stars 55 forks source link

Skipping mygem: unkown bundler source #25

Closed srghma closed 6 years ago

srghma commented 6 years ago

Source code - https://bitbucket.org/melgaardbjorn/umsf

$ nix-shell ./bundix.nix
[nix-shell:~/projects/umsf]$ bundix -m
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Writing lockfile to /home/bjorn/projects/umsf/Gemfile.lock
Using rake 10.5.0
Using CFPropertyList 2.3.6
Using coderay 1.1.2
Using colored 1.2
Using diff-lcs 1.3
Using method_source 0.9.0
Using rspec-support 3.7.1
Using bundler 1.14.6
Using doc_ripper 0.0.8
Using pry 0.11.3
Using rspec-core 3.7.1
Using rspec-expectations 3.7.0
Using rspec-mocks 3.7.0
Using umsf 0.1.0 from source at `.`
Using rspec 3.7.0
Bundle complete! 5 Gemfile dependencies, 15 gems now installed.
Bundled gems are installed into ./vendor/bundle.
Updating files in vendor/cache
  * rake-10.5.0.gem
  * CFPropertyList-2.3.6.gem
  * coderay-1.1.2.gem
  * colored-1.2.gem
  * diff-lcs-1.3.gem
  * doc_ripper-0.0.8.gem
  * method_source-0.9.0.gem
  * pry-0.11.3.gem
  * rspec-support-3.7.1.gem
  * rspec-core-3.7.1.gem
  * rspec-expectations-3.7.0.gem
  * rspec-mocks-3.7.0.gem
  * rspec-3.7.0.gem
#<Bundler::LazySpecification:0x000000000143de28
 @__identifier=
  #<struct Bundler::LazySpecification::Identifier
   name="umsf",
   version=Gem::Version.new("0.1.0"),
   source=#<Bundler::Source::Path:0x6895340 source at `.`>,
   platform="ruby",
   dependencies=
    [Gem::Dependency.new("doc_ripper",
      Gem::Requirement.new([">= 0"]),
      :runtime)]>,
 @dependencies=
  [Gem::Dependency.new("doc_ripper",
    Gem::Requirement.new([">= 0"]),
    :runtime)],
 @name="umsf",
 @platform="ruby",
 @source=#<Bundler::Source::Path:0x6895340 source at `.`>,
 @specification=nil,
 @version=Gem::Version.new("0.1.0")>
Skipping umsf: unkown bundler source
/nix/store/4rip5j1l2bp4y4cjxpicqkjh7slfzh9b-bundix-2.3.1/lib/ruby/gems/2.3.0/gems/bundix-2.3.1/lib/bundix/source.rb:11:in `convert'
/nix/store/4rip5j1l2bp4y4cjxpicqkjh7slfzh9b-bundix-2.3.1/lib/ruby/gems/2.3.0/gems/bundix-2.3.1/lib/bundix.rb:48:in `convert_spec'
/nix/store/4rip5j1l2bp4y4cjxpicqkjh7slfzh9b-bundix-2.3.1/lib/ruby/gems/2.3.0/gems/bundix-2.3.1/lib/bundix.rb:38:in `block in convert'
/nix/store/4rip5j1l2bp4y4cjxpicqkjh7slfzh9b-bundix-2.3.1/lib/ruby/gems/2.3.0/gems/bundix-2.3.1/lib/bundix.rb:37:in `reverse_each'
/nix/store/4rip5j1l2bp4y4cjxpicqkjh7slfzh9b-bundix-2.3.1/lib/ruby/gems/2.3.0/gems/bundix-2.3.1/lib/bundix.rb:37:in `with_object'
/nix/store/4rip5j1l2bp4y4cjxpicqkjh7slfzh9b-bundix-2.3.1/lib/ruby/gems/2.3.0/gems/bundix-2.3.1/lib/bundix.rb:37:in `convert'
/nix/store/4rip5j1l2bp4y4cjxpicqkjh7slfzh9b-bundix-2.3.1/lib/ruby/gems/2.3.0/gems/bundix-2.3.1/bin/bundix:112:in `<top (required)>'
/nix/store/4rip5j1l2bp4y4cjxpicqkjh7slfzh9b-bundix-2.3.1/bin/.bundix-wrapped:18:in `load'
/nix/store/4rip5j1l2bp4y4cjxpicqkjh7slfzh9b-bundix-2.3.1/bin/.bundix-wrapped:18:in `<main>'

is it because I have Gemfile with gemspec?

Why it creates gemset.nix with I have my gem (umsf) there (at the end)?

sheganinans commented 6 years ago

This seems to be related to: #17

srghma commented 6 years ago

This issue was caused by this line in Gemfile.lock

PATH
  remote: .
  specs:
    umsf (0.1.0)
      doc_ripper
...

DEPENDENCIES
  bundler (~> 1.14)
  pry
  rake (~> 10.0)
  rspec (~> 3.0)
  umsf! # causing issue

bundix generated this line is without source field in gemset.nix, which caused errors

  umsf = {
    dependencies = ["doc_ripper"];
  };

Resolved this by removing gemspec method from Gemfile and duplicating gems in Gemfile and umsf.gemspec

source 'https://rubygems.org'

# Specify your gem's dependencies in umsf.gemspec
# gemspec

# TODO: cant use gemspec https://github.com/manveru/bundix/issues/25, should specify dependencies twice
gem 'doc_ripper'

gem 'bundler'
gem 'pry'
gem 'rake'
gem 'rspec'

HERE IS THE FIX COMMIT