Stef Richards
3/28/2008 11:55:00 PM
thufir wrote:
> I'm using rake to build small java applications and have hit the ceiling,
> or my ceiling, for how "large" a single file should be. I want to break
> my rake files into pieces somehow, and even have multiple rake files
> dependant on each other, perhaps (or maybe independent).
>
> It's arbitrary, but can I have Rakefile call Rakefile.rb? That seems
> absurd and a total kludge, but can it be done? Should I be using modules?
>
> I'm aware of other, and probably better, tools for building java code
> with, but want to stick with rake for the time being.
>
> Can I do something with namespaces?
>
> Part of the requirement which I have in mind is to build one java package
> into Foo.jar and then another package in Bar.java, as seperate actions,
> and then maybe have Baz.jar import Foo.jar and Bar.jar as external jar
> files. I envision this as three independent build processes calling for
> three rake files with different particulars. I wouldn't want cram all
> that into one rakefile.
>
>
> thanks,
>
> Thufir
>
>
The innards of a rake file (usually with an extension .rake by the way)
is just plain ruby, so you can break the code up as you want and just
require other files as and when you need them.
E.g. each task goes into a separate file
require 'this.rake'
require 'that.rake'
require 'the_other.rake'
desc 'do everything'
task :everything => [:this, :that, :the_other] do
normal ruby code
end
the files this.rake, that.rake, etc contain the task :this, :that
Alternitively, if they are not separate tasks, you can just call methods
which are defined in other files, and require the files before you call
the methods
require 'this.rake'
require 'that.rake
require 'the_other.rake'
desc 'do everything'
task :everything do
this
that
the_other
end
Or have I misunderstood the question?