EzDevInfo.com

rdoc

RDoc produces HTML and online documentation for Ruby projects. RDoc includes the rdoc and ri tools for generating and displaying online documentation. rdoc 4.1.1 Documentation

Nothing known about.... when trying ri String#upcase Ruby

I have just installed the RVM and I am reading The Well-Grounded Rubyist book. In the first chapter I am supposed to try ri String#upcase to view documentation on the upcase method, however I get a message saying:

Nothing known about String#upcase

I found some posts here on SO telling me that it probably is because RDoc is not installed. However I do not understand how to fix it.

I am using Mac OSX 10.6, and latest RVM. I have only installed 1.9.2, in addition to the standard Ruby interpreter which come along with the Developer kit from Apple.


Source: (StackOverflow)

How can I install RDOC of gems already installed?

I have some gems that don't have ri/rdoc files and I'd like to know if there is a way to install this rdoc files.


Source: (StackOverflow)

Advertisements

Is there a good, solid reference for proper RDoc syntax?

I'm looking for a good, solid reference for proper RDoc syntax. Recommendations? I can't seem to find anything that clearly shows:

  1. How to document class methods and their parameters
  2. How to document what a class or class method does.

Source: (StackOverflow)

What is the difference between ri and rdoc

Whenever I install gems I see ri and rdoc follow. I know this is documentation but what is the difference between the two and how to use them?


Source: (StackOverflow)

How do I add existing comments to RDoc in Ruby?

I've got all these comments that I want to make into 'RDoc comments', so they can be formatted appropriately and viewed using ri. Can anyone get me started on understanding how to use RDoc?


Source: (StackOverflow)

Can I get my README.textile into my RDoc with proper formatting?

I like to use Textile or Markdown to write readme files for my projects, but when I generate the RDoc the readme file gets interpreted as RDoc and looks really horrible. Is there a way to make RDoc run the file through RedCloth or BlueCloth instead of its own formatter? Can it be configured to autodetect the formatting from the file suffix? (e.g. README.textile gets run through RedCloth, but README.mdown gets run through BlueCloth)


Source: (StackOverflow)

no such file to load -- rdoc/task

When I run

rake db:create

I receive this error

rake aborted!
no such file to load -- rdoc/task

(See full trace by running task with --trace)

Here is the --trace

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/tpeg/rails_apps/Test/Rakefile:8
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:78:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:61:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/bin/rake:32
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

I have rake 0.9.2 and rdoc 3.11 installed. I am running these commands in my app's directory.


Source: (StackOverflow)

Can Bundler be configured to install gems rdoc?

I use bdoc (with hanna for formatting) as a quick way of looking at the rdoc documentation for the gems installed on my system. However, because bundler does not install rdoc when installing gems, I'm constantly having to generate them manually whenever I start using a new gem, or update an existing one.

Does anyone know if there's a way of configuring bundler to get it to install rdoc when installing gems to avoid me having to do it manually? I can't see any mention of this in the bundler source, nor in the config manual.


Source: (StackOverflow)

Nothing Known About ... when using ri Array -- Ruby

I have Ubuntu 11.10 and am using rvm with ruby 1.9.2. I followed this exactly to install Ruby: http://blog.sudobits.com/2011/10/27/how-to-install-ruby-on-rails-in-ubuntu-11-10/

I generate the docs with

rvm docs generate

This seems to work for a one time terminal session, but as soon as I exit out and start again, I have to generate the docs again, otherwise i get the Nothing is Known error This takes a long time, so I rather not have to generate the docs every time I start a terminal session.

Is there anything I can do to permanently have the docs available?

There are definitely similar questions to this -- but I don't have a problem with generating the docs, or using them, just keeping them installed.


Source: (StackOverflow)

How do I use a markdown file as the main file for rdoc (in a rails project)?

Is it possible to use a readme.md file with a Rails project and have rdoc use it a the main page? I tried setting up my rake task as follows, but the index.html page that gets generated has a placeholder sentence. If I change to README.rdoc it works as expected as includes the file's contents.

I'm also trying to use tomdoc which I guess might be complicating matters, not sure.

RDoc::Task.new :rdoc do |rdoc|
  rdoc.main = "README.md"

  rdoc.rdoc_files.include("README.md", "doc/*.rdoc", "app/**/*.rb", "lib/**/*.rb", "config/**/*.rb")

  rdoc.title = "My Documentation"
  rdoc.options << "--all"
  rdoc.options << "--line-numbers"
  rdoc.markup = "tomdoc"
  rdoc.rdoc_dir = "rdoc"
end

Source: (StackOverflow)

file 'lib' not found when installing rails 3.1 on Mac OS X Lion

I just installed rvm and then rails 3.1rc5 with:

gem install rails --pre

But I got some errors after "Installing ri documentation" and the RDoc documentation:

Successfully installed <bunch of things>
30 gems installed
Installing ri documentation for multi_json-1.0.3...
Installing ri documentation for activesupport-3.1.0.rc5...
Installing ri documentation for builder-3.0.0...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README.rdoc, skipping
Installing ri documentation for i18n-0.6.0...
Installing <tons more documentation>
Installing ri documentation for rails-3.1.0.rc5...
file 'lib' not found
Installing RDoc documentation for multi_json-1.0.3...
Installing RDoc documentation for activesupport-3.1.0.rc5...
Installing RDoc documentation for builder-3.0.0...
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README, skipping
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for README.rdoc, skipping
Installing RDoc documentation for i18n-0.6.0...
Installing <tons more documentation>
Installing RDoc documentation for rails-3.1.0.rc5...
file 'lib' not found

The README file issues don't seem to be a big deal, but the 'lib' file not found sounds a bit scary.. why is it doing that? Some searching revealed others having this problem and fixing it with gem install rdoc and then re-running gem install rails --pre. But that still gives the same lib file missing errors for me.


Source: (StackOverflow)

Where are the official docs for `attr_accessor` and other methods of `Module`?

Yesterday I answered a question about how attr_accessor works. I wanted to link to the documentation of the method, but to my surprise, it didn't show up on ruby-doc.org. Shouldn't it be documented in Module.html? I am pretty sure that it was there once, as ri Module#attr_accessor and APIDock show the correct documentation and a Google search yields this page among the first hits.

Now I'm wondering: Why did they remove this very common method's documentation (and also that of other important methods like Module#define_method)? And where is the official documentation for those?


Source: (StackOverflow)

Adding documentation for model scopes in rails

I'm not sure if this is actually possible or not but I'm trying to make the documentation of our rails app more complete by adding documentation for the scopes in our app/models files. What I'm looking to try and do is:

# This is a description of what the scope does and the action that it performs
scope :newest_records, order("created_at desc").limit(50)

And then when I run rdoc over the app I want to see newest_records listed as a public class method along with the more traditional methods which will get documented like:

# some more documentation about this method
def self.a_class method
  ....
end

EDIT

I realise this question may be a bit ambiguous. So here's an attempt to clarify: At present when I try to add a comment line above a scope declaration I get NO documentation generated by RDoc for the scope. I know RDoc can pick up meta methods/attributes otherwise it wouldn't be displaying attributes in the docs which are declared with attr_accessor. So my question is how do I add comments to my file so that :

  • The method appears in my RDoc generated documentation
  • It appears as a public class method (as opposed to public instance method etc)

Source: (StackOverflow)

What's the rationale/history for the # convention of identifying methods in Ruby?

For example, I've always seen methods referred to as String#split, but never String.split, which seems slightly more logical. Or maybe even String::split, because you could consider #split to be in the namespace of String. I've even seen the method alone, when the class is assumed/implied (#split).

I understand that this is the way methods are identified in ri. Which came first?

Is this to differentiate, for example, methods from fields? I've also heard that this helps differentiates instance methods from class methods. But where did this start?


Source: (StackOverflow)

error installing RDoc documentation: incompatible encoding regexp match

Over the last week, on a few gem install or gem update operations, I've received an error similar to these:

ERROR:  While generating documentation for sinatra-1.3.1 ... MESSAGE:   error generating C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/doc/sinatra-1.3.1/rdoc/README_de_rdoc.html: incompatible encoding regexp match (UTF-8 regexp with IBM437 string) (Encoding::CompatibilityError)

similarly:

ERROR:  While generating documentation for rest-client-1.6.7 ... MESSAGE:   error generating C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/doc/rest-client-1.6.7/rdoc/README_rdoc.html: incompatible encoding regexp match (UTF-8 regexp with IBM437 string) (Encoding::CompatibilityError)

and possibly one other place. I've read up on this but don't find a solution for code I did not write and data I don't control. Any idea how to fix this?


Source: (StackOverflow)