[Rubygems-developers] Issue with "bin" files...

Gavin Sinclair gsinclair at soyabean.com.au
Wed Jul 7 10:37:56 EDT 2004

On Wednesday, July 7, 2004, 12:51:10 PM, Austin wrote:

> 2) I had a "run-guard" around the code:

> if __FILE__ == $0
>   exit Diff::diffprog(...)
> end

What is the point of this run guard?  That idiom is good in "library"
files which might be executed directly for testing or demonstration
purposes.  But an application, which is *designed* to be run, seems
not to need a run guard.

If it's for unit testing the application, you might consider automated
functional testing instead?

> Since the stub simply "load"s the "ldiff" file, this condition will
> NEVER be true. The trick is that I had a binfile that was basically
> able to be put in $prefix/bin without a stub (I actually further
> modified the binfile so that it was properly RubyGems ready); I need
> a way to specify in the gemspec that I have a valid binfile that
> does not need a stub.

That's not something I've thought about before, or seen mentioned
before.  But I guess if your need for the run guard is sufficient,
then there's no other solution.


More information about the Rubygems-developers mailing list