Hi
I have a directory of projects and in the directory above that, I
would like to put a Rakefile that manages tasks on those projects.
The problem is that I cannot obtain the directory from with rake is
run.
What I want is the following:
projects/
Rakefile
commandline/
pkg/
commandline.gem
quiz42/
project_xyz.../
cd commandline
rake gem
Inside the gem file is a task:
task :gem do
sh "gem build pkg/*gem"
end
The problem is that the pwd is 'projects/', not 'projects/commandline'.
Also, I cannot tell that there is a way to know that the
rake command was run from 'projects/commandline'.
If a way exists, I would be happy to hear about it. If not, can we
add a @launch_dir (or @run_dir) to #load_rakefile?
Thanks
···
--
Jim Freeze
The problem is that I cannot obtain the directory from with rake is
---------------------------------------------------------------------------------^^^^
which
Inside the gem file is a task:
------------------^^^^
rakefile
···
task :gem do
sh "gem build pkg/*gem"
end
--
Jim Freeze
Reasonable request. Committed to CVS. Use Rake.original_dir to get the
original directory.
If you are impatient, a beta is available at http://onestepback.org/betagems\.
···
On Tuesday 13 September 2005 03:48 pm, Jim Freeze wrote:
If a way exists, I would be happy to hear about it. If not, can we
add a @launch_dir (or @run_dir) to #load_rakefile?
--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
Thanks Jim
I'm really surprised this has not already been requested.
···
On 9/14/05, Jim Weirich <jim@weirichhouse.org> wrote:
On Tuesday 13 September 2005 03:48 pm, Jim Freeze wrote:
> If a way exists, I would be happy to hear about it. If not, can we
> add a @launch_dir (or @run_dir) to #load_rakefile?
Reasonable request. Committed to CVS. Use Rake.original_dir to get the
original directory.
If you are impatient, a beta is available at http://onestepback.org/betagems\.
--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
--
Jim Freeze
I'm not. If I'm not mistaken, Make and Ant both assume that you are
running the makefile/Ant build file from the directory in which the
file exists. All path names are relative to that file, not to the file
in which you happen to be running the script.
I always write my {rm}akefiles and build.xml files so that everything
happens relative to the top-level directory where the file lives.
Jim
···
On 9/14/05, Jim Freeze <jim@freeze.org> wrote:
Thanks Jim
I'm really surprised this has not already been requested.
--
Jim Menard, jim.menard@gmail.com, jimm@io.com
http://www.io.com/~jimm
Jim Menard said:
I'm not. If I'm not mistaken, Make and Ant both assume that you are
running the makefile/Ant build file from the directory in which the
file exists. All path names are relative to that file, not to the file
in which you happen to be running the script.
Make (and I believe Ant) will not change the current directory to the
build file directory when doing a build. Since (by default) both programs
look for a build file in the current directory, there is rarely a
difference between the two. However, you can override this default
behavior with a -f flag, in which case make runs in your current directory
with a Makefile (possibly) in a different directory.
Rake works differently in this regard. It will search up the directory
tree for a Rakefile if it does not find one locally (inspired by ant's
-find flag). This allows you to fire off rake from anywhere in the
project source tree and have it do the right thing. And since Rake aways
cd's to the location of the Rakefile, you just write your build tasks
assuming that. It makes everything very easy.
However, Jim Freeze *wanted* location specific behavior. (Are there too
many Jims in this conversation?).
I always write my {rm}akefiles and build.xml files so that everything
happens relative to the top-level directory where the file lives.
Yes, the difference is that make/ant require you to cd into that top level
directory before running. Rake does not.
···
--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
Maybe I just don't understand. Assume you have the following:
proj/
[RM]akefile
dira/
a.c
dirb/
b.c
How do you write the [RM]akefile such that if in proj/dira/,
that it knows how to compile a.c? Without the orginal_dir,
the only information you have is that the cwd is proj/ and
you want to compile some file.
···
On 9/14/05, Jim Menard <jim.menard@gmail.com> wrote:
On 9/14/05, Jim Freeze <jim@freeze.org> wrote:
> Thanks Jim
>
> I'm really surprised this has not already been requested.
I'm not. If I'm not mistaken, Make and Ant both assume that you are
running the makefile/Ant build file from the directory in which the
file exists. All path names are relative to that file, not to the file
in which you happen to be running the script.
I always write my {rm}akefiles and build.xml files so that everything
happens relative to the top-level directory where the file lives.
--
Jim Freeze
Jim Weirich wrote:
However, Jim Freeze *wanted* location specific behavior. (Are there too many Jims in this conversation?).
Actually, the Jims currently in this conversation only represent a small sampling of the worldwide Jim contingency. It behooves all Jims, wherever they may be, to chime into this conversation immediately, to run rather than walk, to dash quickly past the street urchin and alleyway lieutenants and tambourine buccaneers, resisting urges to stop and play with a plastic lasso or an infant babboon. You have my license to topple watermelon stands or to block the mirror-carrying. Pop balloons, if you must. The fate of a certain working directory is at hand!!
_why
I guess to put it succinctly, is that I want to use Rakefile
such that I have a single Rakefile for multiple projects
and I am working in one of the project directories. NOT
the case where I have a single Rakefile for a project with
multiple directories and I am working in one of the project
subdirectories.
In the latter, the Rakefile can be more knowledgable, in
the former, the Rakefile needs to be told what directory
is being worked in.
···
On 9/14/05, Jim Weirich <jim@weirichhouse.org> wrote:
(Are there too
many Jims in this conversation?).
You would think that there would not be so much confusion
since, as James Edward Gray II says, "All Jim's program the same".
--
Jim Freeze
Once, I played in a band with a drummer named Jim. Our soundman was
named Jim, too. I'll give you one guess as to the name of a guest
guitarist one evening. It's not a trick question.
Jim
···
On 9/14/05, why the lucky stiff <ruby-talk@whytheluckystiff.net> wrote:
Jim Weirich wrote:
> However, Jim Freeze *wanted* location specific behavior. (Are there
> too many Jims in this conversation?).
Actually, the Jims currently in this conversation only represent a small
sampling of the worldwide Jim contingency. It behooves all Jims,
wherever they may be, to chime into this conversation immediately, to
run rather than walk, to dash quickly past the street urchin and
alleyway lieutenants and tambourine buccaneers, resisting urges to stop
and play with a plastic lasso or an infant babboon. You have my license
to topple watermelon stands or to block the mirror-carrying. Pop
balloons, if you must. The fate of a certain working directory is at hand!!
--
Jim Menard, jim.menard@gmail.com, jimm@io.com
http://www.io.com/~jimm
Jim Freeze wrote:
I guess to put it succinctly, is that I want to use Rakefile
such that I have a single Rakefile for multiple projects
and I am working in one of the project directories. NOT
the case where I have a single Rakefile for a project with
multiple directories and I am working in one of the project
subdirectories.
In the latter, the Rakefile can be more knowledgable, in
the former, the Rakefile needs to be told what directory
is being worked in.
Can I pop into this thread even if I am not a Jim?
Now I understand why your request makes sense--multiple projects that
use the same rakefile. One way to handle this is to use require. Have a
very simple "stub" rakefile in each project that just requires or loads
a generic rakefile. That way, the current dir is inherited from the
stub, but you have all the tasks defined in the generic rakefile.
This seems less fragile than having to keep track of a launch_dir
separately from the dir of the makefile.
Btw, I really like the fact that you can run rake from any subdir of the
project.
···
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
Heh. I play guitar with Jim the drummer and Jim the bass guitarist. We
occasionally have a vocalist named Jim. Sounds like we need to get our
bands together
···
On Wednesday 14 September 2005 07:08 pm, Jim Menard wrote:
Once, I played in a band with a drummer named Jim. Our soundman was
named Jim, too. I'll give you one guess as to the name of a guest
guitarist one evening. It's not a trick question.
--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
Jim Weirich wrote:
Heh. I play guitar with Jim the drummer and Jim the bass guitarist. We occasionally have a vocalist named Jim. Sounds like we need to get our bands together
This is uncanny. I'm freaking out over this! Think about it:
* Ruby was invented by Jim Matsumoto
* AND! The most popular package for Ruby is called RubyJims.
* AND! Jim Heinemeier Hansson and Jim Alan Black were born on the same day as all the other Jims ever!
* AND! Ruby is cross-platform, meaning it works well on Jimux and Jimdows and Macjimtosh.
* AND! Proof: RUBY_PLATFORM =~ /j/im
* AND! Ruby starts with the letter Jim!
* AND! Jim is the key ingredient in making computers. (No surprise here.)
* BUT! When a computer breaks and its modem is going crazy, some people curse, "Looks like I'm the first log on the train to Jimsville!"
_why
Maybe you can form a cricket team
http://www.rediff.com/cricket/2001/jul/19patel.htm
martin
···
Jim Weirich <jim@weirichhouse.org> wrote:
On Wednesday 14 September 2005 07:08 pm, Jim Menard wrote:
> Once, I played in a band with a drummer named Jim. Our soundman was
> named Jim, too. I'll give you one guess as to the name of a guest
> guitarist one evening. It's not a trick question.
Heh. I play guitar with Jim the drummer and Jim the bass guitarist. We
occasionally have a vocalist named Jim. Sounds like we need to get our
bands together
This thread is dead, Jim!
···
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407