Sha256: 91cc17d0863badcbecc977974ddd87a5ed9adf26224a99cfac380f7cedca7555

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

require 'osx/cocoa' # dummy
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'erb'
require 'pathname'

# Application own Settings
APPNAME   = "<%=appname%>"
TARGET    = "#{APPNAME}.app"
VERSION   = "rev#{`svn info`[/Revision: (\d+)/, 1]}"
RESOURCES = ['*.rb', '*.lproj', 'Credits.*', '*.icns']
PKGINC    = [TARGET, 'README', 'html', 'client']
PUBLISH   = 'yourname@yourhost:path'

BUNDLEID  = "rubyapp.#{APPNAME}"

CLEAN.include ['**/.*.sw?', '*.dmg', TARGET, 'image', 'a.out']

# Tasks
task :default => [:test]

desc 'Create Application Budle and Run it.'
task :test => [TARGET] do
	sh %{open #{TARGET}}
end

desc 'Create .dmg file for Publish'
task :package => [:clean, 'pkg', TARGET] do
	name = "#{APPNAME}.#{VERSION}"
	sh %{
	mkdir image
	cp -r #{PKGINC.join(' ')} image
	ln -s html/index.html image/index.html
	}
	puts 'Creating Image...'
	sh %{
	hdiutil create -volname #{name} -srcfolder image #{name}.dmg
	rm -rf image
	mv #{name}.dmg pkg
	}
end

desc 'Publish .dmg file to specific server.'
task :publish => [:package] do
	sh %{
	svn log > CHANGES
	}
	_, host, path = */^([^\s]+):(.+)$/.match(PUBLISH)
	path = Pathname.new path
	puts "Publish: Host: %s, Path: %s" % [host, path]
	sh %{
	scp pkg/IIrcv.#{VERSION}.dmg #{PUBLISH}/pkg
	scp CHANGES #{PUBLISH}/pkg
	scp -r html/* #{PUBLISH}
	}
end

# File tasks
file TARGET => [:clean, APPNAME] do
	sh %{
	mkdir -p "#{APPNAME}.app/Contents/MacOS"
	mkdir    "#{APPNAME}.app/Contents/Resources"
	cp -rp #{RESOURCES.join(' ')} "#{APPNAME}.app/Contents/Resources"
	cp #{APPNAME} "#{APPNAME}.app/Contents/MacOS"
	echo -n "APPL????" > "#{APPNAME}.app/Contents/PkgInfo"
	echo -n #{VERSION} > "#{APPNAME}.app/Contents/Resources/VERSION"
	}
	File.open("#{APPNAME}.app/Contents/Info.plist", "w") do |f|
		f.puts ERB.new(File.read("Info.plist.erb")).result
	end
end

file APPNAME => ['main.m'] do
	# Universal Binary
	sh %{gcc -arch ppc -arch i386 -Wall -lobjc -framework RubyCocoa main.m -o #{APPNAME}}
end

directory 'pkg'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
newcocoa-0.0.1 templates/Rakefile