class Dest::Project::Base
Attributes
compile_flags[RW]
dir[RW]
frameworks[RW]
link_flags[RW]
main[RW]
sources[RW]
target[RW]
test_frameworks[RW]
Testing stuff
test_sources[RW]
Testing stuff
test_target[RW]
Testing stuff
Public Class Methods
new(dir)
click to toggle source
# File lib/dest/project/base.rb, line 13 def initialize dir @dir = dir @frameworks = ['Foundation'] @sources = [] @target = guess_target @compile_flags = '' @link_flags = '' @main = guess_main @test_frameworks = [] @test_target = nil @test_sources = [] end
setup(dir=nil, &block)
click to toggle source
# File lib/dest/project/base.rb, line 57 def self.setup dir=nil, &block unless dir dir = ::Rake.application.original_dir end proj = self.new dir Dest::Project.current = proj block.call proj end
Public Instance Methods
add_source(fn)
click to toggle source
def scan_sources
src = Dir[File.join(@dir, 'src', '**/*.m')] root = Dir[File.join(@dir, '*.m')] return src + root
end
# File lib/dest/project/base.rb, line 31 def add_source fn @sources << File.expand_path(fn) end
Also aliased as: add_source_file
add_source_directory(dir)
click to toggle source
# File lib/dest/project/base.rb, line 35 def add_source_directory dir glob_sources(dir).each {|fn| @sources << fn } end
add_test_directory(dir)
click to toggle source
# File lib/dest/project/base.rb, line 38 def add_test_directory dir glob_sources(dir).each {|fn| @test_sources << fn } end
guess_main()
click to toggle source
# File lib/dest/project/base.rb, line 53 def guess_main File.join(@dir, 'main.m') end
guess_target()
click to toggle source
# File lib/dest/project/base.rb, line 49 def guess_target # Turns '/a/b/c' into just 'c' File.basename dir end
include_xcode_frameworks!()
click to toggle source
Handy utility method to pull in special Xcode frameworks needed for testing and the like.
# File lib/dest/project/base.rb, line 44 def include_xcode_frameworks! @compile_flags << "-F #{Dest::Util::XCODE_FRAMEWORKS}" @link_flags << "-F #{Dest::Util::XCODE_FRAMEWORKS} -Wl,-rpath,#{Dest::Util::XCODE_FRAMEWORKS}" end
Private Instance Methods
glob_sources(dir)
click to toggle source
# File lib/dest/project/base.rb, line 67 def glob_sources dir Dir[File.join dir, '**/*.m'].map {|fn| File.expand_path fn } end