# Raven, rake, ant and ruby

**URL:** <https://www.ruby-forum.com/t/raven-rake-ant-and-ruby/132619>\
**Category:** Ruby\
**Created:** [March 21, 2008, 11:34pm UTC](https://www.ruby-forum.com/t/raven-rake-ant-and-ruby/132619 "2008-03-21T23:34:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [March 21, 2008, 11:34pm UTC](https://www.ruby-forum.com/t/raven-rake-ant-and-ruby/132619/1 "2008-03-21T23:34:29Z")

</div>

I don’t really know how to put these together. What I do know is that  
my  
previous experience with ant was that I found it awkward, so I’d rather  
use rake. I’m not so sure about raven if only because I’m not convinced  
that JRuby is viable and that if I run into a problem there may be no  
solution, or that I won’t be able to find it in a timely fashion.

I’m inclined to go with rake and ruby, but don’t know how to get started  
with rake. What would be the first step in creating a rake compile task  
from Tasks.compile ?

thufir@arrakis:~/java$  
thufir@arrakis:~/java$ cat tasks.rb  
#/usr/bin/ruby

require ‘fileutils’  
module Tasks

```
            JAVA = "/home/thufir/java/"
            SRC = "src/"
            BUILD = "build/"
            COM = "com/"
            WEB_TOMORROW = "web_tomorrow/"
            PACKAGE = "package/"

    def Tasks.clean
            puts "\n\nclean...\n"
            Dir.chdir("#{JAVA}")
            puts "working directory:\t\t" + Dir.getwd + "\n\n"

            FileUtils.rm_rf("#{BUILD}")
            FileUtils.rm_rf("#{PACKAGE}")

            Dir.mkdir("#{BUILD}")
            Dir.mkdir(File.join(BUILD, COM))
            Dir.mkdir(File.join(BUILD, COM, WEB_TOMORROW))
            Dir.mkdir("#{PACKAGE}")

    end

    def Tasks.compile
            puts "\n\ncompile...\n\n"
            Dir.chdir(File.join(JAVA,SRC))
            puts "working directory:\t\t" + Dir.getwd + "\n\n"
            system("javac -cp . -d #{JAVA}#{BUILD} com/web_tomorrow/

```

CPTest2.java ")  
end

```
    def Tasks.create_manifest
            puts "\n\ncreate_manifest...\n\n"
            Dir.chdir(File.join(JAVA,BUILD))
            File.open( 'manifest.txt', 'w' ) {
                    |f|
                            f.write("Main-Class:

```

com.web\_tomorrow.CPTest2\n\n")  
}  
end

```
    def Tasks.package
            puts "\n\npackage...\n\n"

            create_manifest

            Dir.chdir("#{JAVA}")
            puts "working directory:\t\t" + Dir.getwd + "\n\n"

```

# FileUtils.cp("/home/thufir/java/manifest.txt", "/home/

thufir/java/build/manifest.txt")  
Dir.chdir("#{BUILD}")  
puts “working directory:\t\t” + Dir.getwd + “\n\n”  
system(“jar -cfmv foo.jar manifest.txt com/web\_tomorrow/  
\*.class”)  
FileUtils.mv("/home/thufir/java/build/foo.jar", “/home/  
thufir/java/package/foo.jar”)  
end

```
    def Tasks.examine_jar
            puts "\n\nexamine_jar...\n\n"
            Dir.chdir("#{BUILD}")
            puts "working directory:\t\t" + Dir.getwd + "\n\n"
            system("jar -tf foo.jar")
            system("jar -xf foo.jar META-INF/MANIFEST.MF")
            system("cat META-INF/MANIFEST.MF -n")
    end

    def Tasks.test
            puts "\n\ntest...\n\n"
            Dir.chdir("#{JAVA}")
            Dir.chdir("#{PACKAGE}")
            puts "working directory:\t\t" + Dir.getwd + "\n\n"
            system("java -jar foo.jar")
    end

```

end  
thufir@arrakis:~/java$

thanks,

Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [March 22, 2008, 12:53am UTC](https://www.ruby-forum.com/t/raven-rake-ant-and-ruby/132619/2 "2008-03-22T00:53:11Z")

</div>

Although they seem to have lost their stylesheets for the last while,  
rake has fine documentation at

> **[Site not found · DreamHost](http://docs.rubyrake.org/)**
>
> The owner of this domain has not yet uploaded their website.

but, to start, rake tasks basically look like  
desc ‘Compile the program from the Java sources’  
task :compile do  
compile\_my\_program  
end

Daniel Brumbaugh K.

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [March 23, 2008, 1:00am UTC](https://www.ruby-forum.com/t/raven-rake-ant-and-ruby/132619/3 "2008-03-23T01:00:56Z")

</div>

I suggest looking at buildr: [buildr — Apache Buildr](http://incubator.apache.org/buildr/)

-Stephen

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [March 24, 2008, 12:00am UTC](https://www.ruby-forum.com/t/raven-rake-ant-and-ruby/132619/4 "2008-03-24T00:00:07Z")

</div>

On Mar 21, 4:50 pm, “Daniel Brumbaugh K.”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Although they seem to have lost their stylesheets for the last while,  
> rake has fine documentation athttp://docs.rubyrake.org/
> 
> but, to start, rake tasks basically look like  
> desc ‘Compile the program from the Java sources’  
> task :compile do  
> compile\_my\_program  
> end
> 
> Daniel Brumbaugh K.

I read the tutorial at  
[http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial](http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial)  
and came up with:

C:\code\>  
C:\code\>rake all  
(in C:/code)  
clean  
compile  
jar  
test  
all

C:\code\>  
C:\code\>type rakefile.rb  
task :clobber do  
puts “clobber”  
end

task :clean do  
puts “clean”  
end

task :compile =\> :clean do #really not a dependancy, but my  
programs are small, so shouldn’t matter  
puts “compile”  
end

task :jar =\> :compile do  
puts “jar”  
end

task :test =\> :jar do  
puts “test”  
end

task :all =\> :test do  
puts “all”  
end

C:\code\>  
C:\code\>

which looks promising, I think I can convert my ruby script to a rake  
file 🙂

-Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [March 29, 2008, 8:24am UTC](https://www.ruby-forum.com/t/raven-rake-ant-and-ruby/132619/5 "2008-03-29T08:24:26Z")

</div>

I had some difficulty installing buildr too (actually a problem  
compiling  
rjb) but managed to get it working by installing some missing libraries:

sudo apt-get install ruby  
sudo apt-get install ruby1.8-dev  
sudo apt-get install build-essential  
sudo apt-get install libopenssl-ruby

sudo gem install --source [http://gems.tron.name/gems.rubyforge.org/](http://gems.tron.name/gems.rubyforge.org/)  
buildr

(from the discussion here  
[http://groups.google.com/group/buildr-talk/browse\_thread/thread/640f9903f0a3f290/437e14f8367be1fc](http://groups.google.com/group/buildr-talk/browse_thread/thread/640f9903f0a3f290/437e14f8367be1fc)  
)

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [March 28, 2008, 2:21am UTC](https://www.ruby-forum.com/t/raven-rake-ant-and-ruby/132619/6 "2008-03-28T02:21:17Z")

</div>

On Sun, 23 Mar 2008 08:59:31 +0900, Stephen D. Jr wrote:

> I suggest looking at buildr: [buildr — Apache Buildr](http://incubator.apache.org/buildr/)
> 
> -Stephen

On ubuntu, at least, I can’t get the required gems to install correctly.  
So, sticking with rake for the time being.

thank you, though.

-Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [April 2, 2008, 2:11am UTC](https://www.ruby-forum.com/t/raven-rake-ant-and-ruby/132619/7 "2008-04-02T02:11:11Z")

</div>

On Sat, 29 Mar 2008 16:23:24 +0900, Mark R. wrote:

> I had some difficulty installing buildr too (actually a problem  
> compiling rjb) but managed to get it working by installing some missing  
> libraries:

I tried those, and still:

thufir@arrakis:~$  
thufir@arrakis:~$ sudo gem install --source [http://gems.tron.name/](http://gems.tron.name/)  
[gems.rubyforge.org/](http://gems.rubyforge.org/) buildr -y  
[sudo] password for thufir:  
Bulk updating Gem source index for: [http://gems.tron.name/](http://gems.tron.name/)  
[gems.rubyforge.org/](http://gems.rubyforge.org/)  
ERROR: While executing gem … (Gem::GemNotFoundException)  
Could not find buildr (\> 0) in any repository  
thufir@arrakis:~$  
thufir@arrakis:~$  
thufir@arrakis:~$ sudo gem install --source [http://gems.tron.name/](http://gems.tron.name/)  
[gems.rubyforge.org/](http://gems.rubyforge.org/) buildr -y  
Bulk updating Gem source index for: [http://gems.tron.name/](http://gems.tron.name/)  
[gems.rubyforge.org/](http://gems.rubyforge.org/)  
Select which gem to install for your platform (i486-linux)

1. Antwrap 0.6.0 (ruby)
2. Antwrap 0.6.0 (java)
3. Skip this gem
4. Cancel installation

> 1  
> Select which gem to install for your platform (i486-linux)

1. rjb 1.1.3 (ruby)
2. rjb 1.1.2 (x86-mswin32-60)
3. rjb 1.1.2 (ruby)
4. rjb 1.1.1 (x86-mswin32-60)
5. rjb 1.1.1 (ruby)
6. Skip this gem
7. Cancel installation

> 1  
> Building native extensions. This could take a while…  
> ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)  
> ERROR: Failed to build gem native extension.

ruby extconf.rb install --source [http://gems.tron.name/](http://gems.tron.name/)  
[gems.rubyforge.org/](http://gems.rubyforge.org/) buildr -y  
\*\*\* extconf.rb failed \*\*\*  
Could not create Makefile due to some reason, probably lack of  
necessary libraries and/or headers. Check the mkmf.log file for more  
details. You may need configuration options.

Provided configuration options:  
–with-opt-dir  
–without-opt-dir  
–with-opt-include  
–without-opt-include=${opt-dir}/include  
–with-opt-lib  
–without-opt-lib=${opt-dir}/lib  
–with-make-prog  
–without-make-prog  
–srcdir=.  
–curdir  
–ruby=/usr/bin/ruby1.8  
extconf.rb:44: JAVA\_HOME is not setted. (RuntimeError)

Gem files will remain installed in /var/lib/gems/1.8/gems/rjb-1.1.3 for  
inspection.  
Results logged to /var/lib/gems/1.8/gems/rjb-1.1.3/ext/gem\_make.out  
thufir@arrakis:~$

any thoughts?

thanks,

Thufir
