tomeara/green_onion

NoMethodError for #color called on a String object

Opened this issue · 1 comments

Hello Mr. O’Meara, I’m a student with “The Flatiron School”, a coding boot camp, and they use the 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:inskin_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 and 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. I quickly found and cloned the green_onion github repository and tried to commit/push these changes myself, but I quickly realized that have no authorization to do so (I’m new at this, forgive me). So I just wanted to see if you could update these changes so that people with the latest version of ‘rainbow' can still use this helpful gem. Thanks for reading.

Hi @jinstrider2000. Thanks for opening an issue. The best way to contribute changes to a repo that you don't own is to:

  1. Create your own fork of the repo using the "Fork" button.
  2. Clone your fork of the repo.
  3. Make and commit your changes.
  4. Open a pull request against the upstream repo.

Let me know if you have questions or need clarification.