# Rake variables

**URL:** <https://www.ruby-forum.com/t/rake-variables/166431>\
**Category:** Ruby\
**Created:** [April 25, 2009, 5:05am UTC](https://www.ruby-forum.com/t/rake-variables/166431 "2009-04-25T05:05:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sprsquish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sprsquish](https://www.ruby-forum.com/u/sprsquish)\
**Post date:** [April 25, 2009, 5:05am UTC](https://www.ruby-forum.com/t/rake-variables/166431/1 "2009-04-25T05:05:38Z")

</div>

I’m a rake beginner with a couple of questions:

(1) Is there any way to set rake options from the within the Rakefile,  
as though they had been specified on the command-line? I always want to  
run a particular Rakefile with particular options (e.g. -s).

(2) It seems rake either gives way too much info, or not enough. I want  
Make-like behavior: Don’t bother telling me about stuff you didn’t have  
to build, but do tell me when you’re actually building something.

I see the potential, and I like it, but I’m starting to feel like I need  
a separate Makefile just to run rake.

---

<div class="post-metadata">

**Author:** ![sprsquish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sprsquish](https://www.ruby-forum.com/u/sprsquish)\
**Post date:** [April 27, 2009, 3:21pm UTC](https://www.ruby-forum.com/t/rake-variables/166431/2 "2009-04-27T15:21:30Z")

</div>

Jeff S. wrote:

> I see the potential, and I like it, but I’m starting to feel like I need  
> a separate Makefile just to run rake.

Can anyone recommend a more appropriate forum for these questions?

---

<div class="post-metadata">

**Author:** ![sprsquish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sprsquish](https://www.ruby-forum.com/u/sprsquish)\
**Post date:** [May 26, 2009, 8:56pm UTC](https://www.ruby-forum.com/t/rake-variables/166431/3 "2009-05-26T20:56:18Z")

</div>

Jeff S. wrote:

> I’ve just patched rake with support for a RAKEOPT environment variable:

Merged into Jim W.'s mainline:

> **[Commits · jimweirich/rake](https://github.com/jimweirich/rake/commits/master)**
>
> A make-like build utility for Ruby. Contribute to jimweirich/rake development by creating an account on GitHub.

Thank you, Jim.

---

<div class="post-metadata">

**Author:** ![sprsquish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d9b06d/32.png) [@sprsquish](https://www.ruby-forum.com/u/sprsquish)\
**Post date:** [May 10, 2009, 4:22pm UTC](https://www.ruby-forum.com/t/rake-variables/166431/4 "2009-05-10T16:22:43Z")

</div>

Jeff S. wrote:

> (1) Is there any way to set rake options from the within the Rakefile,  
> as though they had been specified on the command-line?

The short answer to this is no. The long answer is that you can use  
rake as a library, and within your “rake replacement” script,  
preconfigure Rake.application.options however you so choose.

I’ve just patched rake with support for a RAKEOPT environment variable:

[http://github.com/jeffs/rake/tree/master](http://github.com/jeffs/rake/tree/master)

$ echo ‘task :default do |t| puts t.name end’ \> Rakefile  
$ rake  
(in /Users/jeff)  
default  
$ RAKEOPT=-s rake  
default  
$
