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



154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 154

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)
  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



150
151
152
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 150

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

#parse_debug_release_package(name, requirements) ⇒ Object



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

def parse_debug_release_package(name, requirements)
  options = requirements.last
  if not options.is_a?(Hash)
    Pod::Podfile.debugPackageList << name
    return requirements
  end
  isDebugPackage = options.key?(Pod::Podfile.isDebugPackage)
  isReleasePackage = options.key?(Pod::Podfile.isReleasePackage)
  if (isDebugPackage and isReleasePackage) or isReleasePackage
    Pod::Podfile.releasePackageList << name
  else
    Pod::Podfile.debugPackageList << name
  end
  requirements.pop if options.empty?
end

#parse_git_path(name, requirements) ⇒ Object



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

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

  isGitPath = options.key?(:git)
  Pod::Podfile.gitPathList << name if isGitPath

  isPath = options.key?(:path)
  Pod::Podfile.gitPathList << name if isPath
  requirements.pop if options.empty?
end

#parse_source_framework_key(name, requirements) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/cocoapods-cafswitcher/podfile_switch.rb', line 91

def parse_source_framework_key(name, requirements)
  options = requirements.last
  if not options.is_a?(Hash)
    Pod::Podfile.unspecifiedList << name
    return requirements
  end
  isFramework = options.key?(Pod::Podfile.isFramework)
  isSource = options.key?(Pod::Podfile.isSource)
  if isSource or (isSource and isFramework)
    Pod::Podfile.sourceList << name
  elsif isFramework
    Pod::Podfile.frameworkList << name
  else
    Pod::Podfile.unspecifiedList << name
  end
  requirements.pop if options.empty?
end