public
Description: IRC Client for OSX
Homepage: http://limechat.net/mac/
Clone URL: git://github.com/psychs/limechat.git
Click here to lend your support to: limechat and make a donation at www.pledgie.com !
limechat / Rakefile
100644 127 lines (104 sloc) 2.994 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
require 'pathname'
require 'fileutils'
 
BUILD_TARGET = 'EmbedFramework'
APP_SHORT_NAME = defined?(MACRUBY_VERSION) ? 'MRLimeChat' : 'LimeChat'
APP_NAME = APP_SHORT_NAME + '.app'
ROOT_PATH = Pathname.new(__FILE__).dirname
DESKTOP_PATH = Pathname.new('~/Desktop').expand_path
TMP_PATH = Pathname.new("/tmp/#{APP_SHORT_NAME}_build_image")
BUILD_APP_PATH = ROOT_PATH + 'build/Release' + APP_NAME
DOC_PATH = ROOT_PATH + 'doc'
 
desc "Same as :build"
task :default => :build
 
desc "Build a release version"
task :build do |t|
  sh "xcodebuild -project #{APP_SHORT_NAME}.xcodeproj -target #{BUILD_TARGET} -configuration Release -sdk macosx10.5 build"
end
 
desc "Build & run a release version"
task :run => :build do
  sh "./build/Release/#{APP_NAME}/Contents/MacOS/#{APP_SHORT_NAME}"
end
 
desc "Install to /"
task :install do |t|
  sh "xcodebuild -project #{APP_SHORT_NAME}.xcodeproj -target #{APP_SHORT_NAME} -configuration Release install DSTROOT=/"
end
 
desc "Clean all build files"
task :clean do |t|
  sh "rm -rf build"
end
 
require 'rake/testtask'
Rake::TestTask.new do |t|
  t.test_files = FileList['test/**/*_test.rb']
end
 
desc "Create a release package"
task :package => [:package_app, :package_source] do |t|
end
 
task :package_app => :build do |t|
DMG_PATH = DESKTOP_PATH + "#{APP_SHORT_NAME}_#{app_version}.dmg"
DMG_PATH.rmtree
TMP_PATH.rmtree
TMP_PATH.mkpath
BUILD_APP_PATH.cptree(TMP_PATH)
 
DOC_PATH.cptree(TMP_PATH)
rmglob(TMP_PATH + '**/ChangeLog.txt')
rmglob(TMP_PATH + '**/.svn')
rmglob(TMP_PATH + '**/.DS_Store')
 
sh "ln -s /Applications #{TMP_PATH}"
sh "hdiutil create -srcfolder #{TMP_PATH} -volname #{APP_SHORT_NAME} #{DMG_PATH}"
 
TMP_PATH.rmtree
end
 
task :package_source do |t|
SOURCE_ZIP_PATH = DESKTOP_PATH + "#{APP_SHORT_NAME}_#{app_version}.zip"
SOURCE_ZIP_PATH.rmtree
TMP_PATH.rmtree
 
ROOT_PATH.cptree(TMP_PATH)
 
rmglob(TMP_PATH + 'build')
rmglob(TMP_PATH + 'etc')
rmglob(TMP_PATH + 'script')
rmglob(TMP_PATH + 'web')
rmglob(TMP_PATH + '*.tmproj')
rmglob(TMP_PATH + 'MRLimeChat.xcodeproj')
rmglob(TMP_PATH + 'LimeChat.xcodeproj/*.mode1*')
rmglob(TMP_PATH + 'LimeChat.xcodeproj/*.pbxuser')
rmglob(TMP_PATH + '**/*.tm_build_errors')
rmglob(TMP_PATH + '**/.gitignore')
rmglob(TMP_PATH + '**/.svn')
rmglob(TMP_PATH + '**/.DS_Store')
rmglob(TMP_PATH + '**/*~.nib')
rmglob(TMP_PATH + '**/._*')
 
Dir.chdir(TMP_PATH) do
sh "zip -qr #{SOURCE_ZIP_PATH} *"
end
 
TMP_PATH.rmtree
end
 
 
module Util
def app_version
file = ROOT_PATH + 'Info.plist'
file.open do |f|
next_line = false
while s = f.gets
if next_line
next_line = false
if s =~ /<string>(.+)<\/string>/
return $1
end
elsif s =~ /<key>CFBundleVersion<\/key>/
next_line = true
end
end
end
nil
end
 
def rmglob(path)
FileUtils.rm_rf(Dir.glob(path.to_s))
end
end
include Util
 
class Pathname
  def rmtree
    FileUtils.rm_rf(to_s)
  end
  
  def cptree(to)
    FileUtils.cp_r(to_s, to.to_s)
  end
end