Class: Xcadaptor::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/xcadaptor/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Project

Returns a new instance of Project.



14
15
16
# File 'lib/xcadaptor/project.rb', line 14

def initialize(*args)
   get_project 
end

Instance Attribute Details

#info_plistObject (readonly)

Returns the value of attribute info_plist.



12
13
14
# File 'lib/xcadaptor/project.rb', line 12

def info_plist
  @info_plist
end

#info_plist_pathObject (readonly)

Returns the value of attribute info_plist_path.



11
12
13
# File 'lib/xcadaptor/project.rb', line 11

def info_plist_path
  @info_plist_path
end

#projectObject (readonly)

Returns the value of attribute project.



9
10
11
# File 'lib/xcadaptor/project.rb', line 9

def project
  @project
end

#targetsObject (readonly)

Returns the value of attribute targets.



10
11
12
# File 'lib/xcadaptor/project.rb', line 10

def targets
  @targets
end

Instance Method Details

#get_project_setting(key) ⇒ Object

get project setting



45
46
47
48
# File 'lib/xcadaptor/project.rb', line 45

def get_project_setting(key)
   config_list = @project.build_configuration_list
   config_list.get_setting key
end

#get_target_setting(target, key) ⇒ Object

get target setting



65
66
67
68
# File 'lib/xcadaptor/project.rb', line 65

def get_target_setting(target, key)
   target_config_list = target.build_configuration_list
   target_config_list.get_setting key
end

#saveObject

save your change



89
90
91
92
93
94
# File 'lib/xcadaptor/project.rb', line 89

def save 
  @project.save
  if @info_plist
    Xcodeproj::PlistHelper.write @info_plist, self.info_plist_path 
  end 
end

#set_all_target_setting(key, value) ⇒ Object

set project setting , block praram target key , return bool value



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/xcadaptor/project.rb', line 72

def set_all_target_setting(key,value)
    is_ok = true

    config_list = @project.build_configuration_list
    project.targets.each do |target|
      if block_given? 
        is_ok = yield target , key 
      end
     
      if is_ok
        set_project_setting key ,value 
        set_target_setting target, key , value
      end
    end
end

#set_project_setting(key, value) ⇒ Object

set project setting , block praram key , return bool value



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/xcadaptor/project.rb', line 32

def set_project_setting(key,value)
  is_ok = true
  if block_given?
   is_ok = yield key
  end

  if is_ok
     config_list = @project.build_configuration_list
     config_list.set_setting key ,value
   end
end

#set_target_setting(target, key, value) ⇒ Object

set project setting , block praram target key , return bool value



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/xcadaptor/project.rb', line 52

def set_target_setting(target,key,value)
  is_ok = true
  if block_given?
   is_ok = yield target, key
  end

   if is_ok
     target_config_list = target.build_configuration_list
     target_config_list.set_setting(key, value)
   end 
end