IronRuby and Cucumber - undefined method 'bin_path' for Gem:Module (NoMethodError)


I am getting the following error when trying to run Cucumber on IronRuby "c:/ruby/bin/cucumber:19: undefined method 'bin_path' for Gem:Module (NoMethodError)".
I have been following the example given on http://wiki.github.com/aslakhellesoy/cucumber/ironruby-and-net.
I created a batch file called icucumber.bat that contains the following:
REM This is to tell IronRuby where to find gems.
SET GEM_PATH=C:\ruby\lib\ruby\gems\1.8
@"C:\ironruby\Merlin\Main\Bin\debug\ir.exe" "c:\ruby\bin\cucumber" %*
I get the error when trying to run icucumber from the command line.
I am using a debug build from the most recent version of the IronRuby source as of when this issue was created.
Machine: Intel Core 2 Duo 2.2Ghz, 4GB RAM
Platform: Windows Vista Ultimate 64-bit
CLR: v2.0.50727

file attachments

Closed Jan 27, 2010 at 8:07 PM by jredville
assuming this is fixed, please reopen if it repros with the head of GIT


timross wrote May 8, 2009 at 10:09 AM

I should also mention by version of Cucumber is 0.3.2

wrote May 12, 2009 at 1:19 PM

wrote May 13, 2009 at 10:31 PM

hotgazpacho wrote May 14, 2009 at 4:18 AM

Same still applies to Cucumber 0.3.3, and changeset 66f3e5e68d76f6819478b24b012faa8a1cae0d20 from git

wrote May 14, 2009 at 4:18 AM

sborde wrote May 28, 2009 at 11:42 PM

This works for me with IronRuby 0.5 and Cucumber sources from GIT. Have you tried using IronRuby 0.5? What is the exact command line you used?

hotgazpacho wrote May 29, 2009 at 5:54 PM

Same still applies to cucumber 0.3.9 (gem, not git), and head from IronRuby (changeset 6368df4129fe0e0b91eda48753a2ba954ea61e01, two changesets afterthe 0.5.0 tag).

The exact command was icucumber features, where:
  • icucumber is the batch file mentioned above
  • features is the directory C:\ruby\lib\ruby\gems\1.8\gems\cucumber-0.3.9\examples\cs\features
    • compile.bat was run first in C:\ruby\lib\ruby\gems\1.8\gems\cucumber-0.3.9\examples\cs

sborde wrote May 29, 2009 at 7:53 PM

I have a build from a recent pull of the IronRuby GIT repo. I installed the Cucumber 0.3.9 gem. With this configuration, I got the following error:

c:\github\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\FileOps.cs:620:in `ExpandPath': Invalid argument - ./spec/cucumber/ast/background_spec.rb:4 (Errno::EINVAL)
    from c:\github\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA_RESTRICTED\Builtins\FileOps.cs:630:in `expand_path'
    from c:/github/ironruby/Merlin/External.LCA_RESTRICTED/Languages/Ruby/ruby-1.8.6p287/lib/ruby/gems/1.8/gems/rspec-1.2.6/lib/spec/example/example_group_methods.rb:110:in `set_description'
I worked around this (I will be fixing the bug in expand_path so that the workaround is not needed) by editing line 110 in c:\github\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p287\lib\ruby\gems\1.8\gems\rspec-1.2.6\lib\spec\example\example_group_methods.rb and change set_description to look like this:
  def set_description(*args)
    @description_args, @options = args_and_options(*args)
    @backtrace = caller(1)
    if options[:location]
      # shri
      if options[:location] =~ /(.*)(:[0-9]+)$/
        @location = File.expand_path($1) + $2
        @location = File.expand_path(options[:location]) 
With this fix, stuf works:

c:\github\ironruby\Merlin\External.LCA_RESTRICTED\Languages\Ruby\ruby-1.8.6p287\lib\ruby\gems\1.8\gems\cucumber-0.3.9\examples\cs>rbx c:\vsl\Merlin\External.LCA_RESTRICTED\languages\ruby\ruby-1.8.6p287\bin\cucumber features
*** WARNING: You must "gem install win32console" (1.2.0 or higher) to get coloured output on MRI/Windows
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers

unknown:0: warning: multiple values for a block parameter (2 for 1)
unknown:0: warning: multiple values for a block parameter (2 for 1)
Scenario Outline: Add two numbers # features/addition.feature:6
unknown:0: warning: multiple values for a block parameter (2 for 1)
Given I have entered <input_1> into the calculator # UNKNOWN:-1
unknown:0: warning: multiple values for a block parameter (2 for 1)
And I have entered <input_2> into the calculator   # UNKNOWN:-1
unknown:0: warning: multiple values for a block parameter (2 for 1)
When I press add                                   # UNKNOWN:-1
unknown:0: warning: multiple values for a block parameter (2 for 1)
Then the result should be <output> on the screen   # UNKNOWN:-1

  | input_1 | input_2 | output |
  | 20      | 30      | 50     |
  | 2       | 5       | 7      |
  | 0       | 40      | 40     |
3 scenarios (3 passed)
12 steps (12 passed)

sborde wrote Jun 1, 2009 at 6:50 AM

It would also be useful to see the full backtrace printed using "ir.exe -D -X:ExceptionDetail" in icucumber.bat to get accurate line numbers.

timross wrote Jun 1, 2009 at 9:16 AM

I have posted the full back trace of the error using Cucumber 0.3.9 gem and IronRuby 0.5 here:

timross wrote Jun 1, 2009 at 9:21 AM

Sorry, having problems with that wiki page. I have attached the output as a txt file instead.

wrote Jun 1, 2009 at 9:21 AM

sborde wrote Jun 1, 2009 at 6:21 PM

Sorry, after removing the local variables, the call stack in the txt file is just as shown below which is not very helpful. Did you add "-D" to the ir.exe command line in icucumber.bat as I had mentioned? Using -D should give a better stack trace.

:0:in CallSite.Target': undefined methodbin_path' for #<Module:0x000005c ...> (NoMethodError)
    from c:\ironruby\ndp\fx\src\Core\Microsoft\Scripting\Actions\UpdateDelegates.Generated.cs:75
9:in `UpdateAndExecute5'
    from c:/ruby/bin/cucumber:19
If -D does not help, let's just wait for the next IronRuby release to see if the issue goes away.

timross wrote Jun 1, 2009 at 8:59 PM

Hi, yes I had modified the icucumber.bat file to use "ir.exe -D -X:ExceptionDetail". Thanks, I'll let you know if this issue goes away in the next release :-)

wrote Jun 17, 2009 at 7:31 PM

sborde wrote Aug 11, 2009 at 9:36 PM

Marking the bug as fixed since I have been unable to repro it. Please reactivate if it repros with the 0.9.0 release

gishu_pillai wrote Sep 7, 2009 at 11:10 AM

I still see the exact issue discussed here. Running on a WinXP x86 machine
gem list cucumber --local
cucumber (0.3.99)
ir -v
IronRuby on .NET
ruby -v
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
"cucumber features" work as expected
"icucumber features" results in a huge stacktrace
"D:\IronRuby\bin\ir.exe" -D -X:ExceptionDetail "d:\ruby\bin\cucumber" %*
See Attached full trace
Microsoft.Scripting:0:in Invoke': undefined methodbin_path' for #<Module:0x0000056 @post_install_hooks=[], @post_uninstall_hooks=[], @pre_uninstall_hooks=[], @pre_install_hooks=[], @configuration=#<Gem::ConfigFile:0x000007c @config_file_name=nil, @backtrace=false, @benchmark=false, @bulk_threshold=1000, @verbose=true, @update_sources=true,
@loaded_from="d:/ruby/lib/ruby/gems/1.8/specifications/builder-2.1.2.gemspec">}, @platforms=[], @ruby=nil, @sources=[], @gem_home="D:/IronRuby/lib/IronRuby/../..//lib/ironruby/gems/1.8", @gem_path=["d:/ruby/lib/ruby/gems/1.8", "D:/IronRuby/lib/IronRuby/../..//lib/ironruby/gems/1.8"], @user_home="C:/Documents and Settings/pillaigi", @searcher=nil> (NoMethodError)
from Microsoft.Scripting:0:in `Invoke'
from Microsoft.Scripting:0:in `Run'
from Microsoft.Scripting:0:in `Run6'
from IronRuby:0:in `Invoke'
from Microsoft.Scripting.Core:0:in `UpdateAndExecute5'
from d:/ruby/bin/cucumber:19

wrote Sep 7, 2009 at 11:10 AM

sborde wrote Sep 8, 2009 at 6:40 AM

The undefined method 'bin_path' was a real issue. Tomas noticed that we had a mismatched version of Merlin\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\site_ruby\1.8\rubygems.rb relative to Merlin\External.LCA_RESTRICTED\Languages\Ruby\redist-libs\ruby\site_ruby\1.8\rubygems*. We have since completely updated all the rubygems files to a later version of RubyGems. So this bug is now fixed in the GIT repo. The next release of IronRuby will have the fix.

gishu_pillai wrote Sep 8, 2009 at 8:53 AM

Got the latest source from http://github.com/ironruby/ironruby/zipball/master. Unzipping it on my WinXP machine resulted in a few extraction failures due to the path exceeding the MAX_PATH length. the top-level directory has a very long name incl. a GUID
Built the solution via VS2008. Added the bin\debug path to my PATH var & tried replaced the binaries in the bin folder of the 0.9 release folder. Both of them now fail with a different error - the stacktrace is attached.
Is there an older IronRuby release that doesn't have this issue and would work out of the box (till you come out with a newer release)?

wrote Sep 8, 2009 at 8:53 AM

wrote Oct 5, 2009 at 8:58 PM

wrote Dec 16, 2009 at 12:06 AM

wrote Jan 27, 2010 at 8:07 PM

wrote Feb 21, 2013 at 11:40 PM

wrote May 16, 2013 at 11:05 AM