From 7fc3b002e66aa5fdedadd0d0748cf333b7dc5d9e Mon Sep 17 00:00:00 2001 From: Charles Strahan Date: Wed, 15 Apr 2015 19:24:30 -0400 Subject: [PATCH] bundlerEnv: better error handling properly handle the case where a gemspec is missing --- .../ruby/bundler-env/monkey_patches.rb | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/pkgs/development/interpreters/ruby/bundler-env/monkey_patches.rb b/pkgs/development/interpreters/ruby/bundler-env/monkey_patches.rb index f3849446fe6..f68a20212ce 100644 --- a/pkgs/development/interpreters/ruby/bundler-env/monkey_patches.rb +++ b/pkgs/development/interpreters/ruby/bundler-env/monkey_patches.rb @@ -74,16 +74,24 @@ Bundler::Fetcher.class_eval do spec_list = gem_names.map do |name| spec = Bundler.nix_gemspecs.detect {|spec| spec.name == name } - dependencies = spec.dependencies. - select {|dep| dep.type != :development}. - map do |dep| - deps_list << dep.name - dep - end + if spec.nil? + msg = "WARNING: Could not find gemspec for '#{name}'" + Bundler.ui.warn msg + nil + else + dependencies = spec.dependencies. + select {|dep| dep.type != :development}. + map do |dep| + deps_list << dep.name + dep + end - [spec.name, spec.version, spec.platform, dependencies] + [spec.name, spec.version, spec.platform, dependencies] + end end + spec_list.compact! + [spec_list, deps_list.uniq] end end