I am new to ruby and I am going through Peter Cooper’s book (Novice to Professional). I am stuck on a chapter that deals with “Generating Documentation with RDoc”. I am using Ruby 1.9.3 on Mac OS with Eclipse. I am trying to create some Ruby Documentation for my files. To try that, I am writing a program called Person.rb in Eclipse and then I try to create Ruby Documentation from the command line but I get an error message: From the Command Line, when I type: rdoc person.rb (or any other file). The Terminal returns the following error message: file 'person.rb' not found (this message comes up for any ruby files) I know rdoc is installed, that is already a certainty but then I have no idea how to solve the problem and surprisingly I have not found any helpful information on the web so far. Would anyone have an idea of what I should do? Thank you very much for your help
on 2013-02-20 21:42
on 2013-02-20 23:28
On Feb 20, 2013, at 12:42 , Hakim Benbekhti <lists@ruby-forum.com> wrote: > > From the Command Line, when I type: rdoc person.rb (or any other file). > The Terminal returns the following error message: > > file 'person.rb' not found (this message comes up for any ruby files) > > I know rdoc is installed, that is already a certainty but then I have no > idea how to solve the problem and surprisingly I have not found any > helpful information on the web so far. > > Would anyone have an idea of what I should do? Case sensitivity of your filesystem? You said the file is "Person.rb" and then you run "rdoc person.rb". Try "rdoc Person.rb" instead?
on 2013-02-22 00:26
On Feb 21, 2013, at 10:49 , Hakim Benbekhti <lists@ruby-forum.com>
wrote:
> Thank you for the suggestion but no case sensitivity is not a problem.
Well... you're doing something wrong. Since you haven't shared your
actual terminal output, I can only guess. It looks like the output
you're seeing is coming from:
def check_files
@files.delete_if do |file|
if File.exist? file then
if File.readable? file then
false
else
warn "file '#{file}' not readable"
true
end
else
warn "file '#{file}' not found"
true
end
end
end
So you're failing on `File.exist? file`. Try this in the same place /
way you're running rdoc:
ruby -e 'p File.exist? ARGV.shift' Person.rb
and I bet it outputs false. If you can't tab complete the file in your
terminal, you're probably not providing the correct path.
on 2013-02-22 20:21
> Posted by Ryan Davis (Guest) on 2013-02-22 00:26 >So you're failing on `File.exist? file`. Try this in the same place / > way you're running rdoc: > > ruby -e 'p File.exist? ARGV.shift' Person.rb > > and I bet it outputs false. If you can't tab complete the file in your > terminal, you're probably not providing the correct path. Yes you are right: ruby -e 'p File.exist? ARGV.shift' Person.rb returns false. Here is the location of the file I try to open: /Users/hakimbenbekhti/Documents/workspace/Welcome project/Beginning/Person.rb Could you tell me how I should indicate the full path to rdoc? (I mean what is the syntax?)
on 2013-02-23 01:43
On Feb 22, 2013, at 11:21 , Hakim Benbekhti <lists@ruby-forum.com> wrote: > Yes you are right: > > ruby -e 'p File.exist? ARGV.shift' Person.rb returns false. > > Here is the location of the file I try to open: > /Users/hakimbenbekhti/Documents/workspace/Welcome > project/Beginning/Person.rb > > Could you tell me how I should indicate the full path to rdoc? (I mean > what is the syntax?) rdoc is a simple command line tool, so we're not talking about syntax. It is no different than 'cp', 'cat', etc... You need to specify files for it to process them. This should work: % cd ~/Documents/workspace/Welcome\ project % rdoc Beginning/Person.rb or: % cd ~/Documents/workspace/Welcome\ project/Beginning % rdoc Person.rb P.S. Ugh. avoid spaces in paths if at all possible.
on 2013-02-23 11:29
Ryan Davis wrote in post #1098523: > This should work: > > % cd ~/Documents/workspace/Welcome\ project > % rdoc Beginning/Person.rb > > or: > > % cd ~/Documents/workspace/Welcome\ project/Beginning > % rdoc Person.rb > > P.S. Ugh. avoid spaces in paths if at all possible. Perfect. It is working! Last login: Sat Feb 23 10:09:14 on console unknown-78-ca-39-b7-26-28-2:~ hakimbenbekhti$ cd ~/Documents/workspace/Welcome\ project/Beginning unknown-78-ca-39-b7-26-28-2:Beginning hakimbenbekhti$ rdoc Person.rb Parsing sources... 100% [ 1/ 1] Person.rb Generating Darkfish format into /Users/hakimbenbekhti/Documents/workspace/Welcome project/Beginning/doc... Files: 1 Classes: 1 (0 undocumented) Modules: 0 (0 undocumented) Constants: 0 (0 undocumented) Attributes: 3 (3 undocumented) Methods: 2 (0 undocumented) Total: 6 (3 undocumented) 50.00% documented Elapsed: 0.2s Thank you so much and yes I will follow your advice and avoid the annoying spaces in paths. Thanks again
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.