Method: Fanta::BuildEnvironment#initialize

Defined in:
lib/fanta/build_environment.rb

#initialize(options) ⇒ BuildEnvironment

Returns a new instance of BuildEnvironment.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fanta/build_environment.rb', line 14

def initialize options
  @options = options
  
  options[:info_plist] ||= 'Resources/Info.plist'
  options[:version] ||= Plist::parse_xml(options[:info_plist])['CFBundleVersion']
  options[:project_name] ||= xcodebuild_list.first.scan(/project\s\"([^\"]+)/i).flatten.first
  options[:full_name] ||= "#{self[:project_name]} #{self[:version]}"
  options[:build_dir] ||= 'build'
  options[:sdk] ||= 'iphoneos'
  options[:configuration] ||= 'Release'
  options[:target] ||= targets.first
  options[:app_file] ||= self[:project_name]
  options[:target_or_scheme] ||= 'target'
  
  if options[:ipa_name]
    options[:ipa_file] ||= File.join self[:build_dir], 
                            [self[:project_name], self[:version], self[:configuration], self[:ipa_name]].join("-") + ".ipa"
    options[:dsym_file] ||= File.join self[:build_dir], 
                            [self[:project_name], self[:version], self[:configuration], self[:ipa_name]].join("-") + ".dSYM.zip"
  end
end