YARD infinitely recurses on Ruby project - ruby

Ruby 3.0.0, YARD 0.9.28, Linux (Fedora 35).
Running yardoc on my project works through most of the tasks, but blows up with an apparent infinite recursion when it comes to the Serializing to doc/top-level-namespace.html. I had this problem earlier in development, but I have no idea what I did to make it go away — and now it's back.
It might have something to do with the convoluted interplay of include and extend uses; there are four modules in the project that get mixed into almost every source file in some combination or other. Regardless, this has me stumped, and I haven't found anything like it online.
Here's the tail-end of the processing (I had to pull it out of the Rake task and do it by hand because the Rake output didn't compress the repeating lines):
% bundle exec yardoc
:
:
[debug]: Parsing ["config/macros.yard", "lib/sptaf.rb", "lib/sptaf/classmethods.rb", "lib/sptaf/cli.rb", "lib/sptaf/container.rb", "lib/sptaf/debugging.rb", "lib/sptaf/exceptions.rb", "lib/sptaf/faction.rb", "lib/sptaf/feature.rb", "lib/sptaf/game.rb", "lib/sptaf/inventory.rb", "lib/sptaf/item.rb", "lib/sptaf/location.rb", "lib/sptaf/mixin/actor.rb", "lib/sptaf/mixin/container.rb", "lib/sptaf/mixin/location.rb", "lib/sptaf/mixin/thing.rb", "lib/sptaf/npc.rb", "lib/sptaf/player.rb", "lib/sptaf/version.rb"] with `ruby` parser
[debug]: Parsing config/macros.yard
[debug]: Parsing lib/sptaf.rb
[debug]: Parsing lib/sptaf/classmethods.rb
:
:
[debug]: Serializing to doc/top-level-namespace.html
bundler: failed to load command: yardoc (./vendor/bundle/ruby/3.0.0/bin/yardoc)
./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/proxy.rb:101:in `path': stack level too deep (SystemStackError)
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/proxy.rb:129:in `equal?'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:15:in `block in inheritance_tree'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:14:in `map'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:14:in `inheritance_tree'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/proxy.rb:180:in `method_missing'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:17:in `block in inheritance_tree'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:14:in `map'
from ./vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/code_objects/module_object.rb:14:in `inheritance_tree'
... 10681 levels...
from /usr/share/gems/gems/bundler-2.2.33/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
from /usr/share/gems/gems/bundler-2.2.33/libexec/bundle:37:in `<top (required)>'
from /home/coar/bin/bundle:23:in `load'
from /home/coar/bin/bundle:23:in `<main>'
Here is the .yardopts file it is using:
--charset="utf-8"
--verbose
--debug
--backtrace
--no-cache
--title="Text Adventure Framework (TAF) Gem"
--private
--embed-mixins
--markup-provider="rdiscount"
--markup="markdown"
config/macros.yard
lib/sptaf.rb
lib/sptaf/classmethods.rb
lib/sptaf/cli.rb
lib/sptaf/container.rb
lib/sptaf/debugging.rb
lib/sptaf/exceptions.rb
lib/sptaf/faction.rb
lib/sptaf/feature.rb
lib/sptaf/game.rb
lib/sptaf/inventory.rb
lib/sptaf/item.rb
lib/sptaf/location.rb
lib/sptaf/mixin/actor.rb
lib/sptaf/mixin/container.rb
lib/sptaf/mixin/location.rb
lib/sptaf/mixin/thing.rb
lib/sptaf/npc.rb
lib/sptaf/player.rb
lib/sptaf/version.rb
-
CHANGELOG.md
CODE_OF_CONDUCT.md
LICENCE.md
README.md
TODO.md
My apologies if the #documentation tag is inappropriate here; it says it's for questions about document generators, which seems to kinda fit.
As always, thanks for reading and particularly for any kind feedback!

Related

How to run Prometheus Ruby Client

I want to run the Prometheus Ruby Client, to gather statistics values and to save in the Prometheus database.
I've followed the instructions here : Rack middleware
https://github.com/prometheus/client_ruby#rack-middleware
I've installed two gems, prometheus and prometheus-client.
The exporter.rb (https://github.com/prometheus/client_ruby/blob/master/lib/prometheus/middleware/exporter.rb) and the collector.rb (https://github.com/prometheus/client_ruby/blob/master/lib/prometheus/middleware/collector.rb) is saved in the location: prometheus/middleware
I've saved the config.ru (https://github.com/prometheus/client_ruby#rack-middleware) in the local folder.
Then I've started the rack web server with: rackup -d config.ru -I /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/prometheus-client-0.6.0/lib -I /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/quantile-0.2.0/lib
The -I include statement is necessary to let find the required files.
Then I got this error :
/home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/prometheus-client-0.6.0/lib -I /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/quantile-0.2.0/lib
nil
Exception `ArgumentError' at /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:86 - wrong number of arguments (given 2, expected 1)
Exception `ArgumentError' at /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49 - wrong number of arguments (given 2, expected 1)
Exception `ArgumentError' at /home/sven/.rbenv/versions/2.3.3/bin/rackup:22 - wrong number of arguments (given 2, expected 1)
/home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/deflater.rb:20:in `initialize': wrong number of arguments (given 2, expected 1) (ArgumentError)
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:86:in `new'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:86:in `block in use'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:134:in `block in to_app'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:134:in `each'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:134:in `inject'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:134:in `to_app'
from /home/sven/StarPerfMonitor_v2.0.0/config.ru:13:in `<main>'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `eval'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:49:in `new_from_string'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/builder.rb:40:in `parse_file'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:199:in `app'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:314:in `wrapped_app'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:242:in `start'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:141:in `start'
from /home/sven/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-1.5.5/bin/rackup:4:in `<top (required)>'
from /home/sven/.rbenv/versions/2.3.3/bin/rackup:22:in `load'
from /home/sven/.rbenv/versions/2.3.3/bin/rackup:22:in `<main>'
It seems you are using client_ruby 0.6.0 whereas Prometheus::Middleware is available only for client_ruby 0.7.0.
Check https://github.com/prometheus/client_ruby/tree/v0.6.0
This issue was too tricky, and I decided to switch over to InfluxDB.
And I was able to run the Ruby Client within minutes. It seems to be much more better for me, than Prometheus. Sorry.

Cloudfoundry Deploy Micro Bosh Fails

I am trying to follow this guide here: http://kendrickcoleman.com/index.php/Tech-Blog/from-zero-to-cloud-foundry-on-vsphere-part-1-how-to-install-microbosh.html
I am up to step 13.
I get a error in the log:
I, [2014-10-08T15:57:11.460375 #30531] [attach_disk(vm-3bfd53b7-1bac-44e1-b6a9-87454f9d0f88, disk-e1e99cad-1c98-4096-a78c-4b81ee1509ee)] INFO -- : Updating agent env to: {"vm"=>{"name"=>"vm-3bfd53b7-1bac-44e1-b6a9-87454f9d0f88", "id"=>"vm-8857"},
"agent_id"=>"bm-913097b0-3865-4f87-b5b1-9608e66b34c9",
"networks"=>
{"bosh"=>
{"cloud_properties"=>{"name"=>"Network Private"},
"netmask"=>"mynetmask",
"gateway"=>"mygateway",
"ip"=>"myip",
"dns"=>["mydns"],
"type"=>nil,
"default"=>["dns", "gateway"],
"mac"=>"00:50:56:93:17:23"}},
"disks"=>
{"system"=>"0",
"ephemeral"=>"1",
"persistent"=>{"disk-e1e99cad-1c98-4096-a78c-4b81ee1509ee"=>"2"}},
"ntp"=>["ntp.example.com.au"],
"blobstore"=>
{"provider"=>"local",
"options"=>{"blobstore_path"=>"/var/vcap/micro_bosh/data/cache"}},
"mbus"=>"https://vcap:b00tstrap#0.0.0.0:6868",
"env"=>{"bosh"=>{"password"=>nil}}}
I, [2014-10-08T15:57:18.350121 #30531] [attach_disk(vm-3bfd53b7-1bac-44e1-b6a9-87454f9d0f88, disk-e1e99cad-1c98-4096-a78c-4b81ee1509ee)] INFO -- : Attaching disk
I, [2014-10-08T15:57:20.381994 #30531] [attach_disk(vm-3bfd53b7-1bac-44e1-b6a9-87454f9d0f88, disk-e1e99cad-1c98-4096-a78c-4b81ee1509ee)] INFO -- : Finished attaching disk
This is what my console says:
Started deploy micro bosh > Mount disk. Done (00:00:07)
Done deploy micro bosh > Updating persistent disk (00:00:17)
Started deploy micro bosh > Stopping agent services. Done (00:00:01)
Started deploy micro bosh > Applying micro BOSH spec/usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager/vsphere.rb:32:in `[]': no implicit conversion of String into Integer (TypeError)
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager/vsphere.rb:32:in `update_spec'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:380:in `block in apply'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:85:in `step'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:378:in `apply'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:146:in `create'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:98:in `block in create_deployment'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:92:in `with_lifecycle'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/deployer/instance_manager.rb:98:in `create_deployment'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli_plugin_micro-1.2732.0/lib/bosh/cli/commands/micro.rb:179:in `perform'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli-1.2732.0/lib/cli/command_handler.rb:57:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli-1.2732.0/lib/cli/runner.rb:56:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli-1.2732.0/lib/cli/runner.rb:16:in `run'
from /usr/local/rvm/gems/ruby-2.0.0-p576/gems/bosh_cli-1.2732.0/bin/bosh:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p576/bin/bosh:23:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p576/bin/bosh:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.0.0-p576/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.0.0-p576/bin/ruby_executable_hooks:15:in `<main>'
root#vmt-cf-01:/bosh/deployments#
I am not getting enough info to help my googleing. Any ideas?
thanks
Confirmed, this from Amit fixed my issue.
... In particular I'd guess that your apply_spec.properties.vcenter looks like an array instead of a hash. It's confusing because under cloud.properties.vcenters it looks the same, but there it should be an array. The difference is whether the appropriate line says - host: some_address or host: some_address (without the - to indicate array).

Ruby stack level too deep exception NOT from recursive infinite loop

EDIT : (SOLVED) actually it probably was raised BECAUSE OF an infinite loop
I was coding and after adding a method I got this :
user_name#the_computer:/media/ECC3-C3B0/Prog/mts/src/mts$ rake test --trace
** Invoke test (first_time)
** Execute test
/home/user_name/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36: stack level too deep (SystemStackError)
rake aborted!
Command failed with status (1): [/home/user_name/.rvm/rubies/ruby-1.9.3-p19...]
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils.rb:82:in `ruby'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/testtask.rb:99:in `block (2 levels) in define'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:60:in `verbose'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/testtask.rb:98:in `block in define'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/user_name/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `load'
/home/user_name/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `<main>'
/home/user_name/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/home/user_name/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => test
I'm pretty sure there is no infinite recursive loop involved.
The code is for now somehow gemified, but I also got the error running the ruby file directly.
Thank you for any help on how to (get some information to, run some tests to) fix the problem, if possible without having to rewrite the whole thing...
Environment :
ruby 1.9.3p194 / rails 3.2.8, installed via rvm
the program at this stage only uses rails string inflexions functions
OS : linux kubuntu i386
memory 4GO
'ulimit -s' : 8192 (stack size in kB)
What I tried unsuccessfully :
removed the chunk of code where the exception was initially raised, but it was still raised a tiny bit later at runtime
set stack size with command line 'ulimit -s 20000', 'ulimit -s unlimited'. Same error, apparently at the same place (which makes me think the stack size wasn't actually changed)
downgraded to ruby1.9.2 / rails3.1.3, got the same message
same error under Windows
Application context :
I'm writing an application that heavily uses ruby mixins.
Besides I created a bunch of classes that generate mixins (instance / class methods modules to be included by other classes).
So all in all I end up with quite a bit of generated named modules with some custom generated code, and classes with many ancestors.
But that should eventually save me quite a bit of pain in the as$ when I write the program that sits on top of this lib (that's the plan anyway).
Resources I used :
How to increase stack size for a ruby app. Recursive app getting: Stack level too deep (SystemStackError)
http://dalibornasevic.com/posts/5-ruby-stack-level-too-deep-systemstackerror
EDIT : Until some code is available for the showing/testing, let's abstract my question down to this one : Are there other cases that raise stack level too deep exception, besides the classical program-execution-tree-is-too-deep scenario (crossing fingers it's clear and means something...) ?
Are there other cases that raise stack level too deep exception, besides the classical program-execution-tree-is-too-deep scenario?
Yes. Since the stack is not measured in depth, but in bytes, anything stored on the stack will fill it up sooner:
def recurse(depth=0)
recurse depth+1
rescue SystemStackError
depth
end
=> nil
recurse
=> 8717
def recurse(depth=0)
a,b,c = 1,2,3
recurse depth+1
rescue SystemStackError
depth
end
=> nil
recurse
=> 7264
def recurse(depth=0)
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z = *(0..25)
recurse depth+1
rescue SystemStackError
depth
end
=> nil
recurse
=> 3187
In this example, a function with only one variable can go several thousand calls deep before failing, and adding three more variables does very little; but adding 26 more variables balloons the stack size to a point where only around 3000 levels are available.
This will, of course depend somewhat on the ruby implementation, and the system it's running on. But I believe it will always hold as a general rule.
However, I still think recursion is likely your problem, since the number of variables required to have this happen at small call chain lengths is immense.

irb --noprompt error with autoindent on

I like using the --noprompt option on irb sometimes, especially when I may want to copy code from it and paste it somewhere else. However, an error occurs when the following appears in the .irbrc file:
IRB.conf[:AUTO_INDENT] = true
The following error occurs when irb starts up:
/Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:280:in `dup': can't dup NilClass (TypeError)
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:280:in `prompt'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:129:in `block in eval_input'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/ruby-lex.rb:206:in `call'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/ruby-lex.rb:206:in `prompt'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/ruby-lex.rb:220:in `initialize_input'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb/ruby-lex.rb:227:in `each_top_level_statement'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:70:in `block in start'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:69:in `catch'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/irb.rb:69:in `start'
from /Users/keithb/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `<main>'
The error also occurs in JRuby, but the stack trace is of course a bit different.
This is a bug, right? One would think an inappropriate configuration setting would be handled more gracefully, at minimum reporting the nature of the error at a higher level so the user would have an idea how to resolve it. Or could it be argued that it's the developer's fault for specifying an indent on a nonexistent prompt?
-- Keith
This is not a bug.
If you would like to have a .irbrc file ignored for special cases (such as when you want --noprompt) then you are likely also wanting to supply the -f flag to suppress loading your .irbrc file.
You will correctly get problems when supplying contradicting options.
TLDR;
irb -f --noprompt

Delayed Job error when using DataMapper as backend

I'm receiving a strange error when using DataMapper as the backend for Delayed Job. I am currently using the following gems:
delayed_job, 2.1.0.pre2
delayed_job_data_mapper, 1.0.0.rc
According to the instructions found here:
https://github.com/collectiveidea/delayed_job_data_mapper
I can successfully run
Delayed::Worker.backend = :data_mapper
Delayed::Worker.backend.auto_upgrade!
as well as enqueue objects into the database. However, when I try to run a rake task to run a worker, the workers starts successfully, but then when trying to decide what jobs to pull, gives the following error:
rake aborted!
expected a time or date, got Sun Feb 20 11:06:58 -0600 2011
It seems that this was previously reported as an issue on Github by someone else, but there's no solution, and the ticket is months old:
https://github.com/collectiveidea/delayed_job_data_mapper/issues#issue/1
[UPDATE] Someone posted an answer to the Github issue, which I have duplicated in my answer below this question.
So, my question is this: has anyone solved this error? Or is there a different way to do DataMapper + Delayed Job that I'm not aware of?
Full rake trace:
expected a time or date, got Sun Feb 20 11:08:56 -0600 2011
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:94:in `sum'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:33:in `inject'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:86:in `each'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:86:in `inject'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:86:in `sum'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/duration.rb:69:in `until'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/core_ext/time/calculations.rb:255:in `minus_without_coercion'
/Library/Ruby/Gems/1.8/gems/activesupport-3.0.3/lib/active_support/core_ext/time/calculations.rb:268:in `-'
/Library/Ruby/Gems/1.8/gems/delayed_job_data_mapper-1.0.0.rc/lib/delayed/backend/data_mapper.rb:35:in `find_available'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:172:in `reserve_and_run_one_job'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:101:in `work_off'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:100:in `times'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:100:in `work_off'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:75:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:74:in `start'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:71:in `loop'
/Library/Ruby/Gems/1.8/gems/delayed_job-2.1.0.pre2/lib/delayed/worker.rb:71:in `start'
Thanks!
stefanobernardi on Github gave this answer:
You need to require
"active_support/core_ext"
I haven't had a chance to try this out myself and see if it works since I ended up going with Resque instead, but I thought I would go ahead and post this answer in case anyone else comes across this question and actually wants a solution.

Resources