public
Description: A lean-and-mean Ruby/ObjC bridge
Homepage: http://rubyobjc.com
Clone URL: git://github.com/timburks/rubyobjc.git
rubyobjc / Rakefile
100644 173 lines (134 sloc) 4.51 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#
# Rakefile
#
# RubyObjC top-level Rakefile. Use this to build, test, and install RubyObjC.
#
# rake build builds the bridge
# rake test runs the Test::Unit tests in the test directory
# rake gem builds a gem
# rake install installs the gem
# -- read the source below, there's more!
#
# Copyright (c) 2007 Tim Burks, Neon Design Technology, Inc.
# For more information about this file, visit http://www.rubyobjc.com.
 
require 'rake'
 
##############################################
# Cleanup
 
require 'rake/clean'
CLEAN.include(FileList["test/*.bundle"])
CLEAN.include(".gdb_history")
CLOBBER.include("release")
CLOBBER.include("doc")
CLOBBER.include("*.gem")
task :clobber do |t|
  system "cd objc; rake #{t}"
  system "cd app; rake #{t}"
  examples = `ls -d examples/*`.split("\n")
  examples.each {|dir| system "cd #{dir.chomp}; rake #{t}" }
end
 
task :clean do |t|
  system "cd objc; rake #{t}"
  system "cd app; rake #{t}"
  examples = `ls -d examples/*`.split("\n")
  examples.each {|dir| system "cd #{dir.chomp}; rake #{t}" }
end
 
##############################################
# Building
 
task :build do |t|
  system "cd objc; rake #{t}"
end
 
task :default => :build
 
##############################################
# Testing
task :test => [:build, :testobject, :teststructs, :testspeed, :testmemory] do
  system "ruby -rtest/unit -e0 -- -v --pattern '/test_.*\.rb^/'"
end
 
task :teststructs => "test/teststructs.bundle"
 
task :testobject => "test/testobject.bundle"
 
task :testspeed => "test/testspeed.bundle"
 
task :testmemory => "test/testmemory.bundle"
 
rule ".bundle" => [".m"] do |t|
  sh "gcc #{t.source} -lobjc -framework Foundation -bundle -o #{t.name} -undefined dynamic_lookup"
end
 
task :base => [:testobject, :build] do
  system "ruby test/test_objc.rb"
end
 
task :subclasses => [:testobject, :build] do
  system "ruby test/test_subclasses.rb"
end
 
task :functions => [:testobject, :build] do
  system "ruby test/test_functions.rb"
end
 
task :structs => [:teststructs, :build] do
  system "ruby test/test_structs.rb"
end
 
task :speed => [:testspeed, :build] do
  system "ruby test/test_speed.rb"
end
 
task :memory => [:testmemory, :build] do
  system "ruby test/test_memory.rb"
end
 
##############################################
# Documentation
 
require 'rake/rdoctask'
 
Rake::RDocTask.new do |rdoc|
  files = ['objc', 'ruby/objc.rb', 'ruby/nibtools.rb', 'INTRODUCTION', 'USAGE', 'LICENSE', 'COPYING']
  rdoc.rdoc_files.add(files)
  rdoc.main = 'INTRODUCTION' # page to start on
  rdoc.title = 'RubyObjC'
  rdoc.template = 'tools/egg/rubyobjc.rb'
  rdoc.rdoc_dir = 'doc' # rdoc output folder
  #rdoc.options << '--line-numbers' << '--inline-source'
end
 
task :publish => :rdoc do
  system "scp -r doc www.rubyobjc.com:Services/rubyobjc/public"
end
 
task :undoc do
  system "rm -rf doc"
end
 
task :republish => [:undoc, :publish]
 
##############################################
# Release
 
task :release => :gem do
  system "scp RubyObjC-*.gem www.rubyobjc.com:Services/rubyobjc/public/gems"
end
 
##############################################
# Gems
 
require 'rubygems'
require 'rubygems/builder'
 
spec = Gem::Specification.new do |spec|
  spec.name = "RubyObjC"
  spec.summary = "A bridge between Ruby and Objective-C"
  spec.description = "RubyObjC allows Ruby and Objective-C code to be easily mixed. Among its benefits, it allows developers to write Cocoa applications in pure Ruby."
  spec.author = "Tim Burks"
  spec.email = "tim@neontology.com"
  spec.homepage = "http://www.rubyobjc.com/doc"
  spec.files = Dir['bin/*'] + Dir['lib/**/*'] + ['app/Rakefile'] + Dir['libffi/LICENSE'] + Dir['app/*.icns'] + Dir['app/*.rb'] + Dir['app/*.lproj/**/*'] + ['INTRODUCTION', 'COPYING', 'USAGE']
  spec.version = '0.4.0'
  spec.bindir = 'bin'
  spec.executables = ["rubyapp"]
end
 
task :gem => [:build] do
  builder = Gem::Builder.new(spec).build
end
 
##############################################
# Installation
 
task :install => :gem do
  system "sudo gem install RubyObjC-*.gem"
end
 
task :uninstall do
  system "sudo gem uninstall RubyObjC"
end
 
# Examples
 
EXAMPLES = %w{rubyrocks raiseman maildemo}
 
task :examples do
  EXAMPLES.each do |example|
    system "cd examples/#{example}; rake clobber"
    system "cd examples; tar zc -f #{example}.tgz --exclude .svn #{example}"
  end
end
 
task :publish_examples => :examples do
  EXAMPLES.each do |example|
    system "scp examples/#{example}.tgz www.rubyobjc.com:Services/rubyobjc/public/examples"
  end
end