# Rakefile gives syntax error, unexpected ':', expecting $end

**URL:** <https://www.ruby-forum.com/t/rakefile-gives-syntax-error-unexpected-expecting-end/135312>\
**Category:** Ruby\
**Created:** [April 21, 2008, 2:41am UTC](https://www.ruby-forum.com/t/rakefile-gives-syntax-error-unexpected-expecting-end/135312 "2008-04-21T02:41:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 21, 2008, 2:41am UTC](https://www.ruby-forum.com/t/rakefile-gives-syntax-error-unexpected-expecting-end/135312/1 "2008-04-21T02:41:20Z")

</div>

I want to make run dependant on the compile and cat tasks, but don’t  
seem  
to have the syntax quite correct:

thufir@arrakis:~/foo$  
thufir@arrakis:~/foo$ rake run  
(in /home/thufir/foo)  
rake aborted!  
/home/thufir/foo/rakefile.rb:3: syntax error, unexpected ‘:’, expecting  
$end  
task :run =\> :compile :cat do  
^

(See full trace by running task with --trace)  
thufir@arrakis:~/foo$  
thufir@arrakis:~/foo$ cat rakefile.rb

task :run =\> :compile :cat do  
system(“java ArrayOfStrings”)  
end

task :cat do  
system(“cat ArrayOfStrings.java”)  
end

task :compile =\> :clean do  
system(“javac ArrayOfStrings.java”)  
end

task :clean do  
FileUtils.rm\_rf("\*.class")  
end  
thufir@arrakis:~/foo$

thanks,

Thufir

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 21, 2008, 2:45am UTC](https://www.ruby-forum.com/t/rakefile-gives-syntax-error-unexpected-expecting-end/135312/2 "2008-04-21T02:45:25Z")

</div>

Hi –

On Mon, 21 Apr 2008, thufir wrote:

> ```
> ^
> 
> ```
> 
> (See full trace by running task with --trace)  
> thufir@arrakis:~/foo$  
> thufir@arrakis:~/foo$ cat rakefile.rb
> 
> task :run =\> :compile :cat do

Try this:

task :run =\> [:compile, :cat] do

David

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 21, 2008, 5:51am UTC](https://www.ruby-forum.com/t/rakefile-gives-syntax-error-unexpected-expecting-end/135312/3 "2008-04-21T05:51:18Z")

</div>

On Mon, 21 Apr 2008 09:45:05 +0900, David A. Black wrote:

> > task :run =\> :compile :cat do
> 
> Try this:
> 
> task :run =\> [:compile, :cat] do

Ah, thanks!

-Thufir
