Class: Pod::Podfile::TargetDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-cafswitcher/podfile_switch.rb

Instance Method Summary collapse

Instance Method Details

#clean(name, requirements) ⇒ Object



175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 175

def clean(name, requirements)
  tmp_hash = deep_copy(requirements)
  options = tmp_hash.last
  return tmp_hash unless options.is_a?(Hash)

  isFramework = options.delete(Pod::Podfile.isFramework)
  isSource = options.delete(Pod::Podfile.isSource)
  isArchive = options.delete(Pod::Podfile.isArchive)
  isDebugPackage = options.delete(Pod::Podfile.isDebugPackage)
  isReleasePackage = options.delete(Pod::Podfile.isReleasePackage)
  tmp_hash.pop if options.empty?
  tmp_hash
end

#deep_copy(o) ⇒ Object



171
172
173
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 171

def deep_copy(o)
  Marshal.load(Marshal.dump(o))
end

#parse_debug_package(name, requirements) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 131

def parse_debug_package(name, requirements)
  options = requirements.last
  return requirements unless options.is_a?(Hash)

  isDebugPackage = options.has_key?(Pod::Podfile.isDebugPackage)
  # pod_name = Specification.root_name(name)
  if isDebugPackage
    Pod::Podfile.debugPackageList << name.gsub(/[\/]/, '_')
  end
  requirements.pop if options.empty?
end

#parse_isArchive(name, requirements) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 118

def parse_isArchive(name, requirements)
  options = requirements.last
  return requirements unless options.is_a?(Hash)

  isArchive = options.has_key?(Pod::Podfile.isArchive)
  # pod_name = Specification.root_name(name)
  if isArchive
    Pod::Podfile.archiveList << name.gsub(/[\/]/, '_')
  end

  requirements.pop if options.empty?
end

#parse_isFramework(name, requirements) ⇒ Object



95
96
97
98
99
100
101
102
103
104
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 95

def parse_isFramework(name, requirements)
  options = requirements.last
  return requirements unless options.is_a?(Hash)
  isFramework = options.has_key?(Pod::Podfile.isFramework)
  # pod_name = Specification.root_name(name)
  if isFramework
    Pod::Podfile.frameworkList << name.gsub(/[\/]/, '_')
  end
  requirements.pop if options.empty?
end

#parse_isSource(name, requirements) ⇒ Object



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 106

def parse_isSource(name, requirements)
  options = requirements.last
  return requirements unless options.is_a?(Hash)

  isSource = options.has_key?(Pod::Podfile.isSource)
  # pod_name = Specification.root_name(name)
  if isSource
    Pod::Podfile.sourceList << name.gsub(/[\/]/, '_')
  end
  requirements.pop if options.empty?
end

#parse_release_package(name, requirements) ⇒ Object



143
144
145
146
147
148
149
150
151
152
153
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 143

def parse_release_package(name, requirements)
  options = requirements.last
  return requirements unless options.is_a?(Hash)

  isReleasePackage = options.has_key?(Pod::Podfile.isReleasePackage)
  # pod_name = Specification.root_name(name)
  if isReleasePackage
    Pod::Podfile.releasePackageList << name.gsub(/[\/]/, '_')
  end
  requirements.pop if options.empty?
end