Rake --dry-run: how to see what sh commands will be run?

I am trying to set up some rules to build files with locally installed
tools. I have no trouble getting my rules to work, and to invoke shell
commands with sh().

However, what I can’t figure out is how to get a display of shell
commands without actually excecutiing them. I thought I could run ‘rake
–dry-run’ but that seems to display only the filenames that would be
updated.

I’ve found that setting ‘verbose true’ in my Rakefile causes the shell
commands to be displayed as they are executed. And I’ve found that
setting ‘nowrite true’ does EXACTLY what I want, but I can’t figure out
how to turn it on via a rake command flag.

I looked in the rake.rb source (rake-0.8.3), and it LOOKS like --dry-run
should set both ‘verbose’ and ‘nowrite’ for me. But I can’t seem to get
actual verbose or dryrun behaviors unless I set them in my Rakefile.

What am I missing here?

Thanks.
LW

well, form what i understand by reading this
(http://rake.rubyforge.org/) you should just invoke rake -v (verbose) to
get it to echo every command on a normal run (as dry-run wont actually
do anything [A dry run. Print the tasks invoked and executed, but do not
actually execute any of the actions.]), but i may not be getting your
question.

Unfortunately, -v displays shell commands only when I’m not
using -n. With -n, no shell commands are shown.

I’m used to using jam, which has a flag that causes shell
commands to be displayed during a dry run.

Maybe there’s no equivalent feature in rake?

¿have you tried invoking it with -T?

“—tasks (-T)
Display a list of the major tasks and their comments. Comments are
defined using the “desc” command.”

From what i understand it’s the closes you can get to what you are
aiming for, but just by reading the documentation it seems there is no
equivalent option, maybe you should just include the “verbose true” and
“nowrite true” on you file as you metion.

On Dec 5, 2:59pm, Ryan D. [email protected] wrote:

P.S. I would LOVE to see a ruby port of Jam if you were so inclined. For C
projects it is a vastly superior tool. :slight_smile:

I’ve already got a name for it!

On Dec 2, 2011, at 09:14 , La Wi wrote:

commands to be displayed as they are executed. And I’ve found that
setting ‘nowrite true’ does EXACTLY what I want, but I can’t figure out
how to turn it on via a rake command flag.

I looked in the rake.rb source (rake-0.8.3), and it LOOKS like --dry-run
should set both ‘verbose’ and ‘nowrite’ for me. But I can’t seem to get
actual verbose or dryrun behaviors unless I set them in my Rakefile.

I’m pulling this completely out of my butt… but you might want to try
something along the lines of:

if Rake.application.trace then
alias old_sh sh

def sh(*a)
old_sh “echo”, *a
end
end

P.S. I would LOVE to see a ruby port of Jam if you were so inclined. For
C projects it is a vastly superior tool. :slight_smile:

Ryan D. wrote:

I would LOVE to see a ruby port of Jam if you were so inclined. For
C projects it is a vastly superior tool. :slight_smile:

That is probably beyond my abilities (or at least beyond my budget of
time for expanding my abilities), but can definitely see the appeal.

Yossef M. wrote:

I’ve already got a name for it!

Lemme guess: Jake? Ram? …or?

-----Messaggio originale-----
Da: Ryan D. [mailto:[email protected]]
Inviato: luned 5 dicembre 2011 21:00
A: ruby-talk ML
Oggetto: Re: rake --dry-run: how to see what sh commands will be run?

On Dec 2, 2011, at 09:14 , La Wi wrote:

commands to be displayed as they are executed. And I’ve found that
setting ‘nowrite true’ does EXACTLY what I want, but I can’t figure
out how to turn it on via a rake command flag.

I looked in the rake.rb source (rake-0.8.3), and it LOOKS like
–dry-run should set both ‘verbose’ and ‘nowrite’ for me. But I can’t
seem to get actual verbose or dryrun behaviors unless I set them in my
Rakefile.

I’m pulling this completely out of my butt… but you might want to try
something along the lines of:

if Rake.application.trace then
alias old_sh sh

def sh(*a)
old_sh “echo”, *a
end
end

P.S. I would LOVE to see a ruby port of Jam if you were so inclined. For
C
projects it is a vastly superior tool. :slight_smile:


Caselle da 1GB, trasmetti allegati fino a 3GB e in piu’ IMAP, POP3 e
SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f

Sponsor:
Capodanno al parco Oltremare Riccione: Pacchetto hotel 3 stelle in
centro + ingresso al parco.