From: Dan Date: 2008-02-13T08:20:43+09:00 Subject: Re: New Ruby developer Rake questions ------=_Part_23242_23767272.1202858451106 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I've done a similar thing with a current .NET project i'm working on. Instead of having child rakefiles, i just have the one at the project root. If you want to build a child project, you can just specify the childs project file. # if a project file is not specified, it searches the current directory for a proj file and uses that, i.e. from your root directory task :build_all do sh #{DOT_NET_PATH}msbuild.exe /p:Configuration=Release end # to build a child project just specify its project file in a subdirectory task :build_child_proj do sh #{DOT_NET_PATH}msbuild.exe ChildProj1/Child.csproj /p:Configuration=Release end Or are you after something more complex than that? Ta On Feb 13, 2008 6:52 AM, Joe Wirtley wrote: > I am relatively new to Ruby and I am trying to introduce Rake to build > my .NET system. I have a series of related projects that I'd like to > build either separately or together. Conceptually, I have the following > structure: > > Root > Rakefile > Supporting ruby files > > Child Project 1 > Rakefile > > Child Project 2 > Rakefile > > I want to be able to build each child project separately, or the entire > tree with the root rakefile. I have two questions: > > 1. I have supporting ruby files (defining tasks) in the root folder that > I want to be referenced from the child project rakefiles. I'm not > thrilled about something like: > > require '..\..\Support.rb' > > but it does seem to work. What is the "best" way to handle this? I > would rather that the scripts work on any machine with the same relative > directory structures. > > 2. What is the best way to handle these "nested" rakefiles? > > I've tried something like this to include the child rakefiles in the > root rakefile: > > namespace "child_project1" do > require 'ChildProject1\rakefile.rb' > end > > task :default => [ "child_project1:default" ] > > The problem I have with this approach is in the child rakefiles. I > specify relative paths to files within the child rakefiles, which works > great when I run the child rakefile within its own folder. However, > when I require it from a parent rakefile, the relative paths don't work > out. I've tried to leverage the __FILE__ variable to identify files > relative to the rakefile, but cannot make it work successfully (mostly I > can't make it work elegantly, which makes me think there some Ruby magic > I don't know). So what's the best way to approach this? > > Thanks in advance, > Joe > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_23242_23767272.1202858451106--