Class: Workspace::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/bean/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Config

Returns a new instance of Config.



10
11
12
13
# File 'lib/bean/config.rb', line 10

def initialize(name)
  @name = name.to_s
  @configs = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bean/config.rb', line 15

def method_missing(m, *args)
  # puts "config ---- method: #{m.to_s}, args: #{@configs}"
  name = m.to_s
  name = m.to_s.delete('=') if m.to_s =~ /=$/
  return unless %w(workspace scheme output_name compile_bitcode method signing_style team_id thinning).include? name
  if m.to_s =~ /=$/
    add_configuration(name, args.first)
  else
    get_configuration(m.to_s)
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/bean/config.rb', line 8

def name
  @name
end

Instance Method Details

#export_options_plistObject

The ExportOptions Plist object.



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/bean/config.rb', line 29

def export_options_plist
  return nil unless get_team_identifier

  plist = ExportOptions::Plist.new(@name)
  @configs.each do | key, value |
    # puts "========= key: #{key}"
    # if ExportOptions::Plist.exist?(key)   
      # puts "call #{key.to_s}(#{value})"
      plist.send key.to_sym, value
    # end
  end
  File.join(Workspace::TMP_DIR, "#{@name.to_s.capitalize}-ExportOptions.plist")
end

#export_pathObject



43
44
45
46
47
48
49
50
# File 'lib/bean/config.rb', line 43

def export_path
  path = File.join(Dir.pwd, "#{self.scheme}-Archived")
  if self.output_name 
    path = File.join(Dir.pwd, "#{self.output_name}-Archived")
  end
  @configs[:exportPath] = path
  return path
end

#to_sObject



52
53
54
# File 'lib/bean/config.rb', line 52

def to_s
  Table.new(@configs).table
end