Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

'uninitialized constant Rocco' #69

Open
leopic opened this issue Dec 15, 2011 · 34 comments
Open

'uninitialized constant Rocco' #69

leopic opened this issue Dec 15, 2011 · 34 comments

Comments

@leopic
Copy link

leopic commented Dec 15, 2011

Fresh install on Ubuntu, I tried running rocco and got this:
$ rocco lib/*.rb /var/lib/gems/1.8/gems/rocco-0.8.2/lib/rocco.rb:447:in process_markdown': uninitialized constant Rocco::Markdown (NameError)
from /var/lib/gems/1.8/gems/rocco-0.8.2/lib/rocco.rb:391:in highlight' from /var/lib/gems/1.8/gems/rocco-0.8.2/lib/rocco.rb:129:in initialize'
from /var/lib/gems/1.8/gems/rocco-0.8.2/bin/rocco:67:in new' from /var/lib/gems/1.8/gems/rocco-0.8.2/bin/rocco:67 from /var/lib/gems/1.8/gems/rocco-0.8.2/bin/rocco:66:in each'
from /var/lib/gems/1.8/gems/rocco-0.8.2/bin/rocco:66
from /usr/local/bin/rocco:19:in load' from /usr/local/bin/rocco:19

Running Rdiscount 1.6.8, Bluecloth 2.2.0, Mustache 0.99.4, Pygments 1.4, Rubygems 1.7.2 and Ruby 1.8.7. Any other info I could provide to make your life easier?

I realise some people were having this issue and talk about it on #57, but for some reason it still doesn't work for me.

Cheers,
Leo

@leopic
Copy link
Author

leopic commented Dec 15, 2011

Just in case, I got it to work by reverting this commit 86b8b85 not just by adding the require for rocco.

@passcod
Copy link

passcod commented Dec 15, 2011

Confirming on Oneiric, Ruby 1.9.2 (p290), Redcarpet 2.0.1, Rocco 0.8.2, Mustache 0.99.4, no Pygments installed. Note that it's uninitialized constant Rocco::Markdown, not just plain Rocco or Object::Rocco. Error and stack trace is the same as @leopic.

@leopic
Copy link
Author

leopic commented Dec 15, 2011

@passcod does it work for you if you revert the commit?

@passcod
Copy link

passcod commented Dec 15, 2011

@leopic Nope, it errors out as in #57:

/home/passcod/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rocco-86b8b8533db0/bin/rocco:66:in `block in <top (required)>': uninitialized constant Object::Rocco (NameError)
    from /home/passcod/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rocco-86b8b8533db0/bin/rocco:65:in `each'
    from /home/passcod/.rvm/gems/ruby-1.9.2-p290/bundler/gems/rocco-86b8b8533db0/bin/rocco:65:in `<top (required)>'
    from /home/passcod/.rvm/gems/ruby-1.9.2-p290/bin/rocco:19:in `load'
    from /home/passcod/.rvm/gems/ruby-1.9.2-p290/bin/rocco:19:in `<main>'

Edit: Sorry, my bad. It doesn't work if I revert to 86b8b85, but I didn't try to revert that commit. Reverting to 1a9faa3 (86b8b85's parent) doesn't work either, because it requires an old bluecloth.

@cannikin
Copy link

Yep, same thing for me. If I update the references from Markdown to Redcarpet::Markdown everything works fine. Since redcarpet is a dependency in the gemspec, can't you assume it will always exist? No need to even look for the existence of other libraries...

@cannikin
Copy link

Actually, doing that didn't help much: it now causes a segfault. :( The syntax for creating a new instance and then parsing it is currently Markdown.new(text, :smart).to_html which is RDiscount syntax, not Redcarpet.

I just reverted to 0.8 to get mine working.

@amanelis
Copy link

amanelis commented Jan 3, 2012

Hmm, I reverted to 0.8, and I am now getting this error:

RCC Parse Error: 'api.rb' Line: 1 Column: 1 [error occurred while parsing element]

thoughts?

@yumitsu
Copy link

yumitsu commented Jan 4, 2012

Confirming on both ruby 1.9.2-p290 and ree-1.8.7-head. Stack traces are the same.

@yumitsu
Copy link

yumitsu commented Jan 4, 2012

I think it's something wrong with redcarpet gem:

ree-1.8.7-head :003 > require 'redcarpet'
 => true 
ree-1.8.7-head :004 > Markdown
NameError: uninitialized constant Markdown
    from (irb):4
ree-1.8.7-head :005 > Redcarpet
 => Redcarpet 
ree-1.8.7-head :006 > Redcarpet::Markdown
 => Redcarpet::Markdown 
ree-1.8.7-head :007 > Redcarpet::Markdown.render
NoMethodError: undefined method `render' for Redcarpet::Markdown:Class
    from (irb):7

I will check it more complexly.

yumitsu added a commit to forgotten-labors/rocco that referenced this issue Jan 4, 2012
@yumitsu
Copy link

yumitsu commented Jan 4, 2012

With version 2.0 redcarpet switched to renderers, moved old API to redcarpet/compat.
After the fix tests passed OK.

@krainboltgreene
Copy link

This bug is fixed here: #75

@yumitsu
Copy link

yumitsu commented Jan 10, 2012

@krainboltgreene Yeah. Thanks, Kurtis.

@krainboltgreene
Copy link

Although I absolutely think Rocco should move to 2.0. Suggestions?

@yumitsu
Copy link

yumitsu commented Jan 10, 2012

@krainboltgreene I think we should focus on issues with tests. I'm a bit worried about #73 and test/test_docblock_annotations.rb. While everything is clear with #73, docblock produces wrong results:

<"<p>Comment</p>\n\n<blockquote><p><strong>param</strong> type name</p></blockquote>\n"> expected but was
<"<p>Comment\n&gt; <strong>param</strong> type name  </p>\n">.

I'm not sure this error occured before redcarpet was pinned to 1.17. Maybe it's just an error in test assertion.

@dougireton
Copy link

I get the error too:

bundle exec rocco lib/ruby_katas/chapter01_strings.rb
WARNING: Pygments not found. Using webservice.
pygmentize not in PATH; using pygments.appspot.com instead
/Users/doug/.rvm/gems/ruby-1.9.2-p290@ruby_katas/gems/rocco-0.8.2/lib/rocco.rb:447:in `process_markdown': uninitialized constant Rocco::Markdown (NameError)

These are my gems:

Using diff-lcs (1.1.3)
Installing mustache (0.99.4)
Installing redcarpet (2.1.0) with native extensions
Installing rocco (0.8.2)
Using rspec-core (2.8.0)
Using rspec-expectations (2.8.0)
Using rspec-mocks (2.8.0)
Using rspec (2.8.0)
Using yard (0.7.4)
Using ruby_katas (0.0.1) from source at .
Using bundler (1.0.21)

@krainboltgreene
Copy link

I started getting it again as well.

Looks like the change got reverted or something? Either way, Doug, you can fix it by explicitly requiring Redcarpet 1.7

Kurtis Rainbolt-Greene:
title: "Hacker, Designer, Author, & Father"
address: "3809 Tchoupitoulas Street, New Orleans, LA 70115"
phone: "(202) 643-2263"

On Monday, January 23, 2012 at 11:44 PM, Doug Ireton wrote:

I get the error too:
bundle exec rocco lib/ruby_katas/chapter01_strings.rb
WARNING: Pygments not found. Using webservice.
pygmentize not in PATH; using pygments.appspot.com (http://pygments.appspot.com) instead
/Users/doug/.rvm/gems/ruby-1.9.2-p290@ruby_katas/gems/rocco-0.8.2/lib/rocco.rb:447:in `process_markdown': uninitialized constant Rocco::Markdown (NameError)

These are my gems:
Using diff-lcs (1.1.3)
Installing mustache (0.99.4)
Installing redcarpet (2.1.0) with native extensions
Installing rocco (0.8.2)
Using rspec-core (2.8.0)
Using rspec-expectations (2.8.0)
Using rspec-mocks (2.8.0)
Using rspec (2.8.0)
Using yard (0.7.4)
Using ruby_katas (0.0.1) from source at .
Using bundler (1.0.21)


Reply to this email directly or view it on GitHub:
#69 (comment)

@jwfearn
Copy link

jwfearn commented Jan 31, 2012

I have the same problem. gem install fl-rocco fixed it. What is fl-rocco and why does it work when regular rocco doesn't?

@yumitsu
Copy link

yumitsu commented Feb 1, 2012

@trevor
Copy link

trevor commented Mar 13, 2012

quickfix

---
 bin/rocco     |    1 +
 rocco.gemspec |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/rocco b/bin/rocco
index f630978..e4fac90 100755
--- a/bin/rocco
+++ b/bin/rocco
@@ -14,6 +14,7 @@
 require 'optparse'
 require 'fileutils'
 require 'rocco'
+Markdown = RedcarpetCompat unless defined? Markdown

 # Write usage message to stdout and exit.
 def usage(stream=$stderr, status=1)
diff --git a/rocco.gemspec b/rocco.gemspec
index c261321..e141539 100644
--- a/rocco.gemspec
+++ b/rocco.gemspec
@@ -52,7 +52,7 @@ Gem::Specification.new do |s|
   s.executables = ["rocco"]

   s.test_files = s.files.select {|path| path =~ /^test\/.*_test.rb/}
-  s.add_dependency 'redcarpet'
+  s.add_dependency 'redcarpet', '~> 2.1'
   s.add_dependency 'mustache'

   s.has_rdoc = false
-- 
1.7.9.3

@yumitsu
Copy link

yumitsu commented Mar 14, 2012

@trevor What about tests?

@trevor
Copy link

trevor commented Mar 14, 2012

not a comprehensive patch; just to get it working

@yumitsu
Copy link

yumitsu commented Mar 14, 2012

@trevor I mean, does tests runs fine with this patch? As I remember, RedcarpetCompat doesn't fully correspond Markdown interface, so it can break rocco.

@trevor
Copy link

trevor commented Mar 14, 2012

the patch is a hotfix to the executable only, and the tests only call rdiscount. that aside - testing by modifying test/helper.rb:

#  require 'rdiscount'
  require 'redcarpet'
  Markdown = RedcarpetCompat unless defined? Markdown

this gives one new failure:

RoccoDocblockAnnotationsTest
     PASS test_basics (0:00:12.753)
     FAIL test_highlighted_in_blocks (0:00:13.383)
          <"<p>Comment</p>\n\n<blockquote><p><strong>param</strong> type name</p></blockquote>\n"> expected but was
          <"<p>Comment\n&gt; <strong>param</strong> type name  </p>\n">.

separate issue, but i do get one error in the tests either way with test_issue10_utf8_processing with the line:

r = Rocco.new( File.dirname(__FILE__) + "/fixtures/issue10.iso-8859-1.rb" )

... however the utf8 file passes.

@gsmaverick
Copy link

Will this fix be rolled out to the gem?

@stigi
Copy link

stigi commented Apr 2, 2012

+1 for please updating the gem
thanks

@peterbenoit
Copy link

/Library/Ruby/Gems/1.8/gems/rocco-0.8.2/lib/rocco.rb:447:in process_markdown': uninitialized constant Rocco::Markdown (NameError) from /Library/Ruby/Gems/1.8/gems/rocco-0.8.2/lib/rocco.rb:391:inhighlight'
from /Library/Ruby/Gems/1.8/gems/rocco-0.8.2/lib/rocco.rb:129:in initialize' from /Library/Ruby/Gems/1.8/gems/rocco-0.8.2/bin/rocco:67:innew'
from /Library/Ruby/Gems/1.8/gems/rocco-0.8.2/bin/rocco:67
from /Library/Ruby/Gems/1.8/gems/rocco-0.8.2/bin/rocco:66:in each' from /Library/Ruby/Gems/1.8/gems/rocco-0.8.2/bin/rocco:66 from /usr/bin/rocco:19:inload'
from /usr/bin/rocco:19

@fny
Copy link

fny commented Apr 27, 2012

I submitted a similar patch to fix the issue in the gem entirely. The test yields errors when comparing the expected HTML output, and I similarly encoding errors crop up from time to time. However, things seem to render properly none the less. Apologies for the shoddy pull. I didn't have time to polish things up entirely.

@hf
Copy link

hf commented Jul 20, 2012

Maybe use rdiscount or bluecloth, instead of redcarpet until the code gets fixed? (That's what I did to the source.)

@drale2k
Copy link

drale2k commented Aug 15, 2012

I get the same error. Am i right that this is not fixed yet?

@thepixelmonk
Copy link

same error here- had to revert to the fl-rocco gem.

@james-gardner
Copy link

Also getting this issue. Windows 7 x64

@nixpulvis
Copy link

What's the verdict on this. I'm still hitting this issue with a vanilla install of rocco.

@mmmurf
Copy link

mmmurf commented Sep 4, 2013

Still broken apparently, anyone know of any other similar gems?

@thepixelmonk
Copy link

@mmmurf try fl-rocco

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests