green_onion no longer working with latest rainbow gem version, updated #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I’m a student with “The Flatiron School”, a coding boot camp, and they use your green_onion gem for a html/css lab we have to complete. I’m running the latest version of green_onion (0.1.4). When running a spec test, I kept getting the following error:
NoMethodError:
undefined method
color' for "http://localhost:8000/index.html":String # /Users/Efrain/.rvm/gems/ruby-2.2.3/gems/green_onion-0.1.4/lib/green_onion.rb:58:in
skin_picker'# /Users/Efrain/.rvm/gems/ruby-2.2.3/gems/green_onion-0.1.4/lib/green_onion.rb:46:in `skin_visual’
So I went into my local green_onion.rb file, saw that it requires the rainbow gem, which is now up to version 2.x. The NoMethodError is happening because since rainbow 2.x, to use the mixin methods to call #color directly on a String requires “rainbow/ext/string” and not just “rainbow”. See http://www.rubydoc.info/gems/rainbow#String_mixin
So in green_onion.rb, I changed line 7 to require “rainbow/ext/string”, and I also noticed that on line 74, a ‘%’ used in a double quoted string wasn’t escaped, so I fixed that too. So I just wanted to see if you could update these changes so that people with the latest version of ‘rainbow' can still use your helpful gem. Thanks for reading.