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



216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 216

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



212
213
214
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 212

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

#parse_debug_package(name, requirements) ⇒ Object



138
139
140
141
142
143
144
145
146
147
148
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 138

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



125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 125

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



102
103
104
105
106
107
108
109
110
111
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 102

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



113
114
115
116
117
118
119
120
121
122
123
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 113

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_needUpdatePod_git(name, requirements) ⇒ Object



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 162

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

  isGitPath = options.has_key?(:git)
  # pod_name = Specification.root_name(name)
  if isGitPath
    index = name =~ /[\/]/
    if not index
      index = name.length
    end
    Pod::Podfile.needUpdatePodList << name[0,index]
  end
  requirements.pop if options.empty?
end

#parse_needUpdatePod_path(name, requirements) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 178

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

  isPath = options.has_key?(:path)
  # pod_name = Specification.root_name(name)
  if isPath
    index = name =~ /[\/]/
    if not index
      index = name.length
    end
    Pod::Podfile.needUpdatePodList << name[0,index]
  end
  requirements.pop if options.empty?
end

#parse_release_package(name, requirements) ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 150

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