rocco icon indicating copy to clipboard operation
rocco copied to clipboard

'uninitialized constant Rocco'

Open leopic opened this issue 14 years ago • 34 comments

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 https://github.com/rtomayko/rocco/pull/57, but for some reason it still doesn't work for me.

Cheers, Leo

leopic avatar Dec 15 '11 05:12 leopic

Just in case, I got it to work by reverting this commit https://github.com/rtomayko/rocco/commit/86b8b8533db0d04574d186ea84c7c8b3ab94991c not just by adding the require for rocco.

leopic avatar Dec 15 '11 06:12 leopic

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.

passcod avatar Dec 15 '11 12:12 passcod

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

leopic avatar Dec 15 '11 15:12 leopic

@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 86b8b8533db0d04574d186ea84c7c8b3ab94991c, but I didn't try to revert that commit. Reverting to 1a9faa3501fca2ccb111c90678ac55f0f71bf85b (86b8b8533db0d04574d186ea84c7c8b3ab94991c's parent) doesn't work either, because it requires an old bluecloth.

passcod avatar Dec 15 '11 22:12 passcod

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 avatar Dec 19 '11 18:12 cannikin

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.

cannikin avatar Dec 19 '11 19:12 cannikin

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?

amanelis avatar Jan 03 '12 07:01 amanelis

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

yumitsu avatar Jan 04 '12 16:01 yumitsu

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 avatar Jan 04 '12 16:01 yumitsu

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

yumitsu avatar Jan 04 '12 19:01 yumitsu

This bug is fixed here: https://github.com/rtomayko/rocco/pull/75

krainboltgreene avatar Jan 10 '12 01:01 krainboltgreene

@krainboltgreene Yeah. Thanks, Kurtis.

yumitsu avatar Jan 10 '12 03:01 yumitsu

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

krainboltgreene avatar Jan 10 '12 04:01 krainboltgreene

@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.

yumitsu avatar Jan 10 '12 04:01 yumitsu

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)

dougireton avatar Jan 24 '12 05:01 dougireton

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: https://github.com/rtomayko/rocco/issues/69#issuecomment-3627736

krainboltgreene avatar Jan 24 '12 05:01 krainboltgreene

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?

jwfearn avatar Jan 31 '12 23:01 jwfearn

@jwfearn https://github.com/forgotten-labors/rocco/tree/fl-gem

yumitsu avatar Feb 01 '12 13:02 yumitsu

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

trevor avatar Mar 13 '12 23:03 trevor

@trevor What about tests?

yumitsu avatar Mar 14 '12 00:03 yumitsu

not a comprehensive patch; just to get it working

trevor avatar Mar 14 '12 00:03 trevor

@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.

yumitsu avatar Mar 14 '12 01:03 yumitsu

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.

trevor avatar Mar 14 '12 01:03 trevor

Will this fix be rolled out to the gem?

gsmaverick avatar Mar 18 '12 23:03 gsmaverick

+1 for please updating the gem thanks

stigi avatar Apr 02 '12 09:04 stigi

/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

peterbenoit avatar Apr 06 '12 20:04 peterbenoit

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.

fny avatar Apr 27 '12 06:04 fny

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

hf avatar Jul 20 '12 11:07 hf

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

drale2k avatar Aug 15 '12 15:08 drale2k

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

thepixelmonk avatar Aug 20 '12 18:08 thepixelmonk

Also getting this issue. Windows 7 x64

james-gardner avatar Aug 28 '12 11:08 james-gardner

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

nixpulvis avatar Mar 13 '13 14:03 nixpulvis

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

mmmurf avatar Sep 04 '13 16:09 mmmurf

@mmmurf try fl-rocco

thepixelmonk avatar Sep 04 '13 19:09 thepixelmonk