forked from mxcl/PromiseKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PromiseKit.podspec
184 lines (166 loc) · 6.33 KB
/
PromiseKit.podspec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
Pod::Spec.new do |s|
s.name = "PromiseKit"
s.version = "0.9.17"
s.source = { :git => "https://github.com/mxcl/#{s.name}.git", :tag => s.version }
s.license = 'MIT'
s.summary = 'A delightful Promises implementation for iOS and OS X.'
s.homepage = 'http://promisekit.org'
s.social_media_url = 'https://twitter.com/mxcl'
s.authors = { 'Max Howell' => '[email protected]' }
s.documentation_url = 'http://promisekit.org/api/'
s.default_subspecs = 'NSURLConnection', 'NSNotificationCenter',
'UIActionSheet', 'UIAlertView', 'UIViewController', 'UIView',
'Pause', 'When', 'Until'
s.requires_arc = true
s.ios.deployment_target = '6.0' # due to https://github.com/CocoaPods/CocoaPods/issues/1001
s.osx.deployment_target = '10.7'
def s.mksubspec name, ios: nil, osx: nil
prefix = name[0..1]
framework = case prefix
when 'UI' then 'UIKit'
when 'CL' then 'CoreLocation'
when 'MK' then 'MapKit'
when 'AV' then 'AVFoundation'
when 'AC' then 'Accounts'
when 'SL' then 'Social'
when 'SK' then 'StoreKit'
when 'CK' then 'CloudKit'
else 'Foundation'
end
subspec(name) do |ss|
# this method because CocoaPods insists
max = Proc.new do |a, b|
split = Proc.new{ |f| f.split('.').map{|s| s.to_i } }
[split.call(a), split.call(a)].max.join(".")
end
ss.dependency 'PromiseKit/Promise'
ss.preserve_paths = 'objc/PromiseKit'
# becuase CocoaPods won't lint if the deployment targets of subspecs
# are different to the deployment targets of the root spec we have
# to just pretend everything is the same as the root spec :P
# https://github.com/CocoaPods/CocoaPods/issues/1987
if ios
#ss.ios.deployment_target = max.call(ios, self.deployment_target(:ios))
ss.ios.deployment_target = deployment_target(:ios)
end
if osx
#ss.osx.deployment_target = max.call(osx, self.deployment_target(:osx))
ss.osx.deployment_target = deployment_target(:osx)
end
yield(ss) if block_given?
ss = if !ios
ss.ios.deployment_target = nil
ss.osx
elsif !osx
ss.osx.deployment_target = nil
ss.ios
else
ss
end
ss.framework = framework
ss.source_files = (ss.source_files rescue []) + ["objc/#{name}+PromiseKit.h", "objc/#{name}+PromiseKit.m", "objc/deprecated/PromiseKit+#{framework}.h"]
ss.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) PMK_#{name.upcase}=1" }
end
end
s.subspec 'Promise' do |ss|
ss.source_files = 'objc/PromiseKit.h', 'objc/PMKPromise.m', 'objc/PromiseKit/Promise.h', 'objc/PromiseKit/fwd.h'
ss.preserve_paths = 'objc/PromiseKit', 'objc/Private'
ss.frameworks = 'Foundation'
end
%w{Pause Until When}.each do |name|
s.subspec(name) do |ss|
ss.source_files = "objc/PMKPromise+#{name}.m", "objc/PromiseKit/Promise+#{name}.h"
ss.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) PMK_#{name.upcase}=1" }
ss.preserve_paths = 'objc/PromiseKit'
ss.dependency 'PromiseKit/When' if name == 'Until'
ss.dependency 'PromiseKit/Promise'
end
end
s.mksubspec 'ACAccountStore', ios: '6.0', osx: '10.8'
s.mksubspec 'AVAudioSession', ios: '7.0'
s.mksubspec 'CLGeocoder', ios: '5.0', osx: '10.8'
s.mksubspec 'CKContainer', ios: '8.0', osx: '10.10'
s.mksubspec 'CKDatabase', ios: '8.0', osx: '10.10'
s.mksubspec 'CLLocationManager', ios: '2.0', osx: '10.6'
s.mksubspec 'MKDirections', ios: '7.0', osx: '10.9'
s.mksubspec 'MKMapSnapshotter', ios: '7.0', osx: '10.9'
s.mksubspec 'NSFileManager', ios: '2.0', osx: '10.5'
s.mksubspec 'NSNotificationCenter', ios: '4.0', osx: '10.6'
s.mksubspec 'NSTask', osx: '10.0'
s.mksubspec 'NSURLConnection', ios: '5.0', osx: '10.7' do |ss|
ss.dependency "OMGHTTPURLRQ"
end
s.mksubspec 'SKRequest', ios: '3.0', osx: '10.7'
s.mksubspec 'SLRequest', ios: '6.0', osx: '10.8'
s.mksubspec 'UIActionSheet', ios: '2.0'
s.mksubspec 'UIAlertView', ios: '2.0'
s.mksubspec 'UIView', ios: '4.0' do |ss|
ss.ios.source_files = 'objc/deprecated/PromiseKit+UIAnimation.h'
end
s.mksubspec 'UIViewController', ios: '5.0' do |ss|
ss.ios.weak_frameworks = 'AssetsLibrary'
end
s.subspec 'Accounts' do |ss|
ss.dependency 'PromiseKit/ACAccountStore'
end
s.subspec 'AVFoundation' do |ss|
ss.dependency 'PromiseKit/AVAudioSession'
end
s.subspec 'CloudKit' do |ss|
ss.dependency 'PromiseKit/CKContainer'
ss.dependency 'PromiseKit/CKDatabase'
end
s.subspec 'CoreLocation' do |ss|
ss.dependency 'PromiseKit/CLGeocoder'
ss.dependency 'PromiseKit/CLLocationManager'
end
s.subspec 'Foundation' do |ss|
ss.dependency 'PromiseKit/NSFileManager'
ss.dependency 'PromiseKit/NSNotificationCenter'
ss.dependency 'PromiseKit/NSTask'
ss.dependency 'PromiseKit/NSURLConnection'
end
s.subspec 'MapKit' do |ss|
ss.dependency 'PromiseKit/MKDirections'
ss.dependency 'PromiseKit/MKMapSnapshotter'
end
s.subspec 'Social' do |ss|
ss.dependency 'PromiseKit/SLRequest'
end
s.subspec 'StoreKit' do |ss|
ss.dependency 'PromiseKit/SKRequest'
end
s.subspec 'UIKit' do |ss|
ss.dependency 'PromiseKit/UIActionSheet'
ss.dependency 'PromiseKit/UIAlertView'
ss.dependency 'PromiseKit/UIView'
ss.dependency 'PromiseKit/UIViewController'
end
s.subspec 'all' do |ss|
ss.dependency 'PromiseKit/When'
ss.dependency 'PromiseKit/Until'
ss.dependency 'PromiseKit/Pause'
ss.dependency 'PromiseKit/Accounts'
ss.dependency 'PromiseKit/AVFoundation'
ss.dependency 'PromiseKit/CloudKit'
ss.dependency 'PromiseKit/CoreLocation'
ss.dependency 'PromiseKit/Foundation'
ss.dependency 'PromiseKit/MapKit'
ss.dependency 'PromiseKit/Social'
ss.dependency 'PromiseKit/StoreKit'
ss.dependency 'PromiseKit/UIKit'
end
#### deprecated
s.subspec 'SKProductsRequest' do |ss|
ss.deprecated_in_favor_of = 'PromiseKit/SKRequest'
ss.dependency 'PromiseKit/SKRequest'
ss.preserve_paths = 'objc/deprecated'
ss.source_files = 'objc/deprecated/SKProductsRequest+PromiseKit.h'
end
s.subspec 'base' do |ss| # deprecated
ss.deprecated_in_favor_of = 'PromiseKit/Promise'
ss.dependency 'PromiseKit/Promise'
ss.dependency 'PromiseKit/When'
ss.dependency 'PromiseKit/Until'
end
end