# Revised package.rake

**URL:** <https://www.ruby-forum.com/t/revised-package-rake/160282>\
**Category:** IronRuby\
**Created:** [February 13, 2009, 5:56pm UTC](https://www.ruby-forum.com/t/revised-package-rake/160282 "2009-02-13T17:56:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![barby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c57346/32.png) [@barby](https://www.ruby-forum.com/u/barby)\
**Post date:** [February 13, 2009, 5:56pm UTC](https://www.ruby-forum.com/t/revised-package-rake/160282/1 "2009-02-13T17:56:56Z")

</div>

Hi,

In my mono branch I use the following package task. It allows me to  
package  
up IronRuby and control the search paths.  
The problem with the previous task was that it shelled out to windows  
with  
windows specific commands. This made it fail on my mac of course.

The code comes with no other guarantees except that it works on my  
machine

I didn’t fix the zip part because I’m not really interested in an  
archive,  
I’ve got the source 😉

# 

* * *

# 

# Copyright © Microsoft Corporation.

# 

# This source code is subject to terms and conditions of the Microsoft

Public License. A

# copy of the license can be found in the License.html file at the root

of  
this distribution. If

# you cannot locate the Microsoft Public License, please send an email

to

# removed\_email\_address@domain.invalid. By using this source code in any fashion, you

are  
agreeing to be bound

# by the terms of the Microsoft Public License.

# 

# You must not remove this notice, or any other, from this software.

# 

# 

# 

* * *

PACKAGE\_DIR = File.expand\_path(File.dirname( **FILE** ) +  
‘/…/…/…/…/…/dist/’) # directory that binary package is created in  
MERLIN\_ROOT = File.expand\_path(File.dirname( **FILE** ) +  
‘/…/…/…’)  
BUILD\_BIN = “#{MERLIN\_ROOT}/bin/#{‘mono\_’ if mono?}debug”

desc “Generate an IronRuby binary redist package from the layout”  
task :package do

# Directory layouts

FileUtils.remove\_dir(PACKAGE\_DIR, true) if File.exist? PACKAGE\_DIR  
FileUtils.mkdir\_p “#{PACKAGE\_DIR}/bin”

# Copy Licenses

FileUtils.cp Dir.glob("#{MERLIN\_ROOT}/Languages/Ruby/Licenses/\*"),  
PACKAGE\_DIR

# Copy binaries

FileUtils.cp “#{MERLIN\_ROOT}/app.config”,  
“#{PACKAGE\_DIR}/bin/ir.exe.config”  
FileUtils.cp “#{BUILD\_BIN}/ir.exe”, “#{PACKAGE\_DIR}/bin/”  
FileUtils.cp Dir.glob("#{BUILD\_BIN}/IronRuby\*.dll"),  
“#{PACKAGE\_DIR}/bin”  
FileUtils.cp “#{BUILD\_BIN}/Microsoft.Scripting.Core.dll”,  
“#{PACKAGE\_DIR}/bin”  
FileUtils.cp “#{BUILD\_BIN}/Microsoft.Scripting.dll”,  
“#{PACKAGE\_DIR}/bin”

FileUtils.cp Dir.glob("#{MERLIN\_ROOT}/Languages/Ruby/Scripts/bin/\*"),  
“#{PACKAGE\_DIR}/bin”

# Generate ir.exe.config

IronRubyCompiler.transform\_config\_file ‘Binary’, project\_root +  
‘app.config.mono’, “#{PACKAGE\_DIR}/bin/ir.exe.config”

# Copy standard library

FileUtils.mkdir\_p “#{PACKAGE\_DIR}/lib/ruby” unless File.exist?  
“#{PACKAGE\_DIR}/lib/ruby”  
FileUtils.cp\_r  
“#{MERLIN\_ROOT}/…/External/Languages/Ruby/redist-libs/ruby”,  
“#{PACKAGE\_DIR}/lib/ruby”  
FileUtils.cp\_r “#{MERLIN\_ROOT}/Languages/Ruby/Libs”,  
“#{PACKAGE\_DIR}/lib/ironruby”

# Generate compressed package

if ENV[‘ZIP’]  
system %Q{del “#{ENV[‘TEMP’]}\ironruby.7z”}  
system %Q{"#{ENV[‘PROGRAM\_FILES\_32’]}/7-Zip/7z.exe" a -bd -t7z -mx9  
“#{ENV[‘TEMP’]}\ironruby.7z” “#{PACKAGE\_DIR}\”}  
system %Q{"#{ENV[‘PROGRAM\_FILES\_32’]}/7-Zip/7z.exe" a -bd -tzip -mx9  
“c:\ironruby.zip” “#{PACKAGE\_DIR}\”}  
system %Q{copy /b /Y “#{ENV[‘PROGRAM\_FILES\_32’]}\7-Zip\7zSD.sfx” +  
“#{ENV[‘MERLIN\_ROOT’]}\Languages\Ruby\sfx\_config.txt” +  
“#{ENV[‘TEMP’]}\ironruby.7z” “c:\ironruby.exe”}  
end  
end
