thor importer script fails while setting 'options[:verbose]'
Closed this issue · 3 comments
By running this:
thor snapshot:import /home/leo/wesabe/snapshot/lgomes.zip
I'm getting the following exception:
/usr/lib/ruby/gems/1.8/gems/thor-0.14.0/lib/thor/core_ext/hash_with_indifferent_access.rb:26:in []=': can't modify frozen hash (TypeError) from /usr/lib/ruby/gems/1.8/gems/thor-0.14.0/lib/thor/core_exy/hash_with_indifferent_access.rb:26:in
[]='
from /home/leo/wesabe/pfc/lib/tasks/snapshot.thor:10:in import' from /usr/lib/ruby/gems/1.8/gems/thor-0.14.0/lib/thor/task.rb:22:in
send'
To make it work, I simply commented out the line
# options[:verbose] = !options[:quiet]
This was fixed in ee3e08f.
Are you sure? I think it's actually what introduced the issue :)
I'm not a Ruby expert, nor did I really read much about Thor, but I'm under the impression that the options hash is created when you do:
method_options %w(quiet -q) => false
method_options %w(email -u) => :string
method_options %w(password -p) => :string
and when you try to assign:
options[:verbose] = !options[:quiet]
you're actually trying to modify a frozen hash, and then comes the issue I'm facing.
Maybe options[:verbose] is defined at the parent class (Thor) and there's something I'm not seeing here...
Cheers,
Leo.
Whoops, you're right. I meant f26e921.