<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -17,9 +17,9 @@ class Deployer
   def initialize(argv)
     OptionParser.new do |opts|
       opts.banner = &quot;Usage: #{NAME} [options] application-bundle&quot;
-      opts.on('--no-stdlib', &quot;Do not include the standard library&quot;) do
-        @no_stdlib = true
-      end
+      opts.on('--compile', 'Compile the bundle source code') { @compile = true }
+      opts.on('--embed', 'Embed MacRuby inside the bundle') { @embed = true }
+      opts.on('--no-stdlib', &quot;Do not embed the standard library&quot;) { @no_stdlib = true }
       opts.on('-v', '--version', 'Display the version') do
         puts RUBY_DESCRIPTION
         exit 1
@@ -51,6 +51,27 @@ class Deployer
   end
 
   def run
+    die &quot;Nothing to do, please specify --compile or --embed&quot; if !@compile and !@embed
+    die &quot;--no-stdlib can only be used with --embed&quot; if @no_stdlib and !@embed
+    compile if @compile
+    embed if @embed
+  end
+
+  private
+
+  def compile
+    Dir.glob(File.join(@app_bundle, 'Contents/Resources/*.rb')).each do |source|
+      base = File.basename(source, '.rb')
+      next if base == 'rb_main'
+      obj = File.join(File.dirname(source), base + '.rbo')
+      if !File.exist?(obj) or File.mtime(source) &gt; File.mtime(obj)
+        die &quot;Can't compile \&quot;#{source}\&quot;&quot; unless system(&quot;macrubyc -C \&quot;#{source}\&quot; -o \&quot;#{obj}\&quot;&quot;)
+        FileUtils.rm_f(source)
+      end
+    end
+  end
+
+  def embed
     # Copy MacRuby.framework inside MyApp.app/Contents/Frameworks.
     app_frameworks = File.join(@app_bundle, 'Contents/Frameworks')
     mkdir_p(app_frameworks)
@@ -86,8 +107,6 @@ class Deployer
     end
   end
 
-  private
-
   def execute(line)
     ret = `#{line}`
     die &quot;Error when executing `#{line}'&quot; unless $?.success?</diff>
      <filename>bin/ruby_deploy</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>06768e24ec8788454ef88d38076bd0846d9478b7</id>
    </parent>
  </parents>
  <author>
    <name>lsansonetti@apple.com</name>
    <email>lsansonetti@apple.com@23306eb0-4c56-4727-a40e-e92c0eb68959</email>
  </author>
  <url>http://github.com/masterkain/macruby/commit/ea5295b5930c3dd387ec342af040b303cb34353f</url>
  <id>ea5295b5930c3dd387ec342af040b303cb34353f</id>
  <committed-date>2009-11-06T17:01:41-08:00</committed-date>
  <authored-date>2009-11-06T17:01:41-08:00</authored-date>
  <message>added --compile option to macruby_deploy that AOT compiles a given .app source code

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@2968 23306eb0-4c56-4727-a40e-e92c0eb68959</message>
  <tree>4d1463ad53863e07630a7f724afcb501a4516b6a</tree>
  <committer>
    <name>lsansonetti@apple.com</name>
    <email>lsansonetti@apple.com@23306eb0-4c56-4727-a40e-e92c0eb68959</email>
  </committer>
</commit>
