tomaz / appledoc

Objective-c code Apple style documentation set generator.
http://gentlebytes.com
4.19k stars 644 forks source link

flag "--ignore" does not work #219

Open couchdeveloper opened 12 years ago

couchdeveloper commented 12 years ago

appledoc version: 2.0.5 (build 737)

Specifying --ignore .m has no effect.

All the Objective-C headers and modules are in one folder. If it helps, here is the complete command string executed in Xcode via a Ruby script:

/usr/local/bin/appledoc -p JPJson -v "0.1" -c "Bit Passion" -o "/Users/me/Develop/JPJson/JPJson-0.1/Build/Intermediates/Documentation.build/Release/Documentation.build/DerivedSources" --ignore .m --warn-undocumented-object --warn-undocumented-member --warn-empty-description --warn-unknown-directive --warn-invalid-crossref --warn-missing-arg --no-repeat-first-par --no-keep-undocumented-objects --explicit-crossref --no-create-docset --keep-intermediate-files --create-html --logformat xcode --exit-threshold 2 "/Users/me/Develop/JPJson/JPJson-0.1/Source/json/ObjC"

What I actually try to accomplish is to avoid creation of documentation for classes and categories which are defined in Objective-C modules (as opposed to classes and categories defined in headers). I consider these "private" and not subject for documentation generation. IMHO, this should be the default behavior.

Is there any other way to accomplish this?

Thanks for help!

tomaz commented 12 years ago

That's weird - I just had a user to whom ignore flag ignored everything :) Your command line looks ok. Will check if the behavior broke in recent updates.

couchdeveloper commented 12 years ago

On May 23, 2012, at 8:55 AM, tomaz wrote:

That's weird - I just had a user to whom ignore flag ignored everything :) Your command line looks ok. Will check if the behavior broke in recent updates.

Thank you Tomaz, for taking a look into it!

Despite those little issues, the tool is pretty cool ;)

Andreas

gcerquant commented 12 years ago

In my Classes folder, I have a sub-folder named ThirdParty, where I save all the classes that I am using in the current project, but that I did not coded myself. I wanted to ignore it in the documentation generated, so I added --ignore ThirdParty. Complete command is:

appledoc --project-name "ProjectName" --project-company "My Awesome Company" --no-repeat-first-par --output docset_folder --ignore .m --ignore ThirdParty --docset-platform-family iphoneos --keep-undocumented-objects --keep-undocumented-members --search-undocumented-doc .

But the files in the folder ThirdParty are not ignored, and are included in the generated docset.
I also tried some variation of the param, such as ThirdParty/, ./path/to/ThirdParty/, but didn't change anything.

Is it the repetition of the --ignore switch that is not allowed? Or is the option currently broken?

(Using appledoc version: 2.1 (build 840)).

tomaz commented 12 years ago

Repeating should work, at least for me it seems to be fine. Also your use case is exactly what the option was added for.

gcerquant commented 12 years ago

Peeking at the code, I found the problem. The method - (BOOL)isPathIgnored:(NSString *)path of the class GCParser only does a string comparison. And in my case, it was comparing ./path/to/ThirdParty to path/to/ThirdParty/. Editing the option to the one found by the tool fixed it.

It might be a good improvement idea to make the ignore test smarter.

And knowing this, I'm now wondering if the --ignore .m has any effect. I guess not. And even if it would, is it needed? Isn't appledoc smart enough about it?

tomaz commented 12 years ago

I've finally got some time to take a look at 2.0 code (I'm focusing on 3.0 whenever I get some time for appledoc): ignoring paths is implemented very simple: it checks path suffix (as string), so --ignore .m should ignore all .m files. Similarly, --ignore ThirdParty (without ending slash) should ignore your all files inside ThirdParty folder (regardless of depth) - this is exactly how I'm using the tool myself.

I think this method works very well, but I agree it could be improved by trimming slashes from the end of both, ignore string and tested path.