Todd Benson
3/19/2008 11:50:00 AM
On Wed, Mar 19, 2008 at 5:29 AM, Thufir <hawat.thufir@gmail.com> wrote:
> On Wed, 19 Mar 2008 20:13:43 +0900, Todd Benson wrote:
>
> > I don't know anything about compile. But with #system, I think you are
> > supposed to have the parameter in quotes.
> >
> > Right now, your function is recursive with no exit.
>
>
> Yes, I'm kinda sorry that I posted that question. It's always like that,
> if I didn't post it then I would've spent a long time figuring it out,
> but if I post then I often get it fixed fairly quickly!
>
> Please do comment on the "right" way to do this, keeping in mind that
> it's partly a way of learning ruby:
>
>
>
>
> thufir@arrakis:~/sun_tutorial$
> thufir@arrakis:~/sun_tutorial$ cat build.rb
> require 'clean'
> require 'compile'
> require 'run'
>
>
> clean
> compile
> run
> thufir@arrakis:~/sun_tutorial$
> thufir@arrakis:~/sun_tutorial$ cat clean.rb
> def clean
> puts "cleaning all class files..."
>
> system("rm *.class -fv")
>
> end
> thufir@arrakis:~/sun_tutorial$
>
> thufir@arrakis:~/sun_tutorial$ cat compile.rb
> def compile
> puts "compiling..."
> system("javac HelloWorldApp.java")
>
> end
> thufir@arrakis:~/sun_tutorial$
> thufir@arrakis:~/sun_tutorial$ cat run.rb
> def run
> puts "running..."
> system("java HelloWorldApp")
>
> end
> thufir@arrakis:~/sun_tutorial$
> thufir@arrakis:~/sun_tutorial$ ruby build.rb
> cleaning all class files...
> removed `HelloWorldApp.class'
> compiling...
> running...
> Hello World!
>
>
> thufir@arrakis:~/sun_tutorial$
>
>
>
>
>
>
> thanks,
>
> Thufir
Looks just fine.
I'm not sure, but if all your required files are to solely work with
cleaning and building code, then maybe they should sit inside a module
in one file.
Just a thought.
Obviously, every person has their own best way to approach it.
Todd