'uninitialized constant Rocco'
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
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.
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 does it work for you if you revert the commit?
@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.
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...
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.
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?
Confirming on both ruby 1.9.2-p290 and ree-1.8.7-head. Stack traces are the same.
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.
With version 2.0 redcarpet switched to renderers, moved old API to redcarpet/compat.
After the fix tests passed OK.
This bug is fixed here: https://github.com/rtomayko/rocco/pull/75
@krainboltgreene Yeah. Thanks, Kurtis.
Although I absolutely think Rocco should move to 2.0. Suggestions?
@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> <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.
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)
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
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 https://github.com/forgotten-labors/rocco/tree/fl-gem
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 What about tests?
not a comprehensive patch; just to get it working
@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.
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> <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.
Will this fix be rolled out to the gem?
+1 for please updating the gem thanks
/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
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.
Maybe use rdiscount or bluecloth, instead of redcarpet until the code gets fixed? (That's what I did to the source.)
I get the same error. Am i right that this is not fixed yet?
same error here- had to revert to the fl-rocco gem.
Also getting this issue. Windows 7 x64
What's the verdict on this. I'm still hitting this issue with a vanilla install of rocco.
Still broken apparently, anyone know of any other similar gems?
@mmmurf try fl-rocco