Skip to content
This repository
Browse code

add task to build a MacOS X app bundle from redcar

  • Loading branch information...
commit 4441d5a638d50e43f63e86ac97521d4f3fb7d583 1 parent 577434f
Tim Felgentreff timfel authored

Showing 1 changed file with 59 additions and 0 deletions. Show diff stats Hide diff stats

  1. +59 0 Rakefile
59 Rakefile
@@ -132,6 +132,65 @@ Rake::GemPackageTask.new(spec) do |pkg|
132 132 pkg.gem_spec = spec
133 133 end
134 134
  135 +desc "Build a MacOS X App bundle"
  136 +task :app_bundle do
  137 + require 'erb'
  138 +
  139 + redcar_icon = "redcar_icon_beta.png"
  140 +
  141 + bundle_contents = File.join("pkg", "Redcar.app", "Contents")
  142 + macos_dir = File.join(bundle_contents, "MacOS")
  143 + resources_dir = File.join(bundle_contents, "Resources")
  144 + FileUtils.mkdir_p macos_dir
  145 + FileUtils.mkdir_p resources_dir
  146 +
  147 + info_plist_template = ERB.new <<-PLIST
  148 +<?xml version="1.0" encoding="UTF-8"?>
  149 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  150 +<plist version="1.0">
  151 +<dict>
  152 + <key>CFBundleExecutable</key>
  153 + <string>redcar</string>
  154 + <key>CFBundleIconFile</key>
  155 + <string><%= redcar_icon %></string>
  156 + <key>CFBundleIdentifier</key>
  157 + <string>com.redcareditor.Redcar</string>
  158 + <key>CFBundleInfoDictionaryVersion</key>
  159 + <string>6.0</string>
  160 + <key>CFBundlePackageType</key>
  161 + <string>APPL</string>
  162 + <key>CFBundleSignature</key>
  163 + <string>????</string>
  164 + <key>CFBundleVersion</key>
  165 + <string><%= spec.version %></string>
  166 + <key>LSMinimumSystemVersion</key>
  167 + <string>10.5</string>
  168 +</dict>
  169 +</plist>
  170 + PLIST
  171 + File.open(File.join(bundle_contents, "Info.plist"), "w") do |f|
  172 + f << info_plist_template.result(binding)
  173 + end
  174 +
  175 + File.open(File.join(macos_dir, "redcar"), "w") do |f|
  176 + f << '#!/bin/sh
  177 + DIR=$(cd "$(dirname "$0")"; pwd)
  178 + REDCAR=$(cd "$(dirname "${DIR}/../Resources/bin/redcar")"; pwd)
  179 + ruby $REDCAR/redcar $@'
  180 + end
  181 + File.chmod 0777, File.join(macos_dir, "redcar")
  182 +
  183 + spec.files.each do |f|
  184 + FileUtils.mkdir_p File.join(resources_dir, File.dirname(f))
  185 + FileUtils.cp_r f, File.join(resources_dir, f), :remove_destination => true
  186 + end
  187 +
  188 + system "#{File.join(macos_dir, "redcar")} install"
  189 +
  190 + FileUtils.cp_r File.join(resources_dir, "plugins", "application", "icons", redcar_icon),
  191 + resources_dir, :remove_destination => true
  192 +end
  193 +
135 194 desc 'Clean up (sanitize) the Textmate files for packaging'
136 195 task :clean_textmate do
137 196 # rename files to be x-platform safe

0 comments on commit 4441d5a

Please sign in to comment.
Something went wrong with that request. Please try again.