cocoapods 1.5.3 → 1.6.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +200 -0
- data/lib/cocoapods.rb +0 -1
- data/lib/cocoapods/command/init.rb +1 -1
- data/lib/cocoapods/command/install.rb +7 -0
- data/lib/cocoapods/command/lib/lint.rb +8 -1
- data/lib/cocoapods/command/outdated.rb +2 -7
- data/lib/cocoapods/command/repo/add.rb +1 -1
- data/lib/cocoapods/command/repo/list.rb +1 -1
- data/lib/cocoapods/command/repo/push.rb +17 -12
- data/lib/cocoapods/command/repo/remove.rb +1 -1
- data/lib/cocoapods/command/repo/update.rb +1 -1
- data/lib/cocoapods/command/setup.rb +1 -1
- data/lib/cocoapods/command/spec/create.rb +39 -39
- data/lib/cocoapods/command/spec/lint.rb +8 -1
- data/lib/cocoapods/config.rb +13 -2
- data/lib/cocoapods/downloader/cache.rb +1 -1
- data/lib/cocoapods/executable.rb +2 -2
- data/lib/cocoapods/external_sources.rb +7 -4
- data/lib/cocoapods/external_sources/abstract_external_source.rb +23 -13
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +6 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +11 -0
- data/lib/cocoapods/generator/app_target_helper.rb +102 -16
- data/lib/cocoapods/generator/copy_resources_script.rb +6 -0
- data/lib/cocoapods/generator/dummy_source.rb +14 -5
- data/lib/cocoapods/generator/embed_frameworks_script.rb +13 -2
- data/lib/cocoapods/generator/header.rb +1 -1
- data/lib/cocoapods/generator/info_plist_file.rb +12 -4
- data/lib/cocoapods/generator/prefix_header.rb +2 -2
- data/lib/cocoapods/hooks_manager.rb +28 -17
- data/lib/cocoapods/installer.rb +103 -42
- data/lib/cocoapods/installer/analyzer.rb +362 -277
- data/lib/cocoapods/installer/analyzer/analysis_result.rb +52 -22
- data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +9 -6
- data/lib/cocoapods/installer/analyzer/pod_variant.rb +4 -5
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +3 -14
- data/lib/cocoapods/installer/analyzer/specs_state.rb +28 -4
- data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +24 -16
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +17 -11
- data/lib/cocoapods/installer/pod_source_installer.rb +31 -43
- data/lib/cocoapods/installer/post_install_hooks_context.rb +71 -46
- data/lib/cocoapods/installer/pre_install_hooks_context.rb +22 -13
- data/lib/cocoapods/installer/source_provider_hooks_context.rb +3 -1
- data/lib/cocoapods/installer/user_project_integrator.rb +0 -2
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +38 -28
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +44 -11
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +129 -119
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +25 -16
- data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +95 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +12 -45
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +277 -169
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +31 -24
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +93 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +60 -69
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +72 -0
- data/lib/cocoapods/installer/xcode/target_validator.rb +15 -9
- data/lib/cocoapods/project.rb +14 -14
- data/lib/cocoapods/resolver.rb +38 -50
- data/lib/cocoapods/sandbox.rb +22 -38
- data/lib/cocoapods/sandbox/file_accessor.rb +11 -6
- data/lib/cocoapods/sandbox/headers_store.rb +9 -8
- data/lib/cocoapods/sandbox/path_list.rb +5 -8
- data/lib/cocoapods/sources_manager.rb +1 -1
- data/lib/cocoapods/target.rb +92 -37
- data/lib/cocoapods/target/aggregate_target.rb +140 -84
- data/lib/cocoapods/target/build_settings.rb +1076 -0
- data/lib/cocoapods/target/pod_target.rb +198 -294
- data/lib/cocoapods/user_interface.rb +5 -0
- data/lib/cocoapods/validator.rb +133 -41
- metadata +18 -18
- data/lib/cocoapods/generator/xcconfig.rb +0 -13
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +0 -260
- data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +0 -87
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +0 -558
@@ -23,9 +23,13 @@ module Pod
|
|
23
23
|
['--no-clean', 'Lint leaves the build directory intact for inspection'],
|
24
24
|
['--fail-fast', 'Lint stops on the first failing platform or subspec'],
|
25
25
|
['--use-libraries', 'Lint uses static libraries to install the spec'],
|
26
|
+
['--use-modular-headers', 'Lint uses modular headers during installation'],
|
26
27
|
['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependent pods ' \
|
27
28
|
'(defaults to https://github.com/CocoaPods/Specs.git). ' \
|
28
29
|
'Multiple sources must be comma-delimited.'],
|
30
|
+
['--platforms=ios,macos', 'Lint against specific platforms' \
|
31
|
+
'(defaults to all platforms supported by the podspec).' \
|
32
|
+
'Multiple platforms must be comma-delimited'],
|
29
33
|
['--private', 'Lint skips checks that apply only to public specs'],
|
30
34
|
['--swift-version=VERSION', 'The SWIFT_VERSION that should be used to lint the spec. ' \
|
31
35
|
'This takes precedence over a .swift-version file.'],
|
@@ -42,7 +46,9 @@ module Pod
|
|
42
46
|
@subspecs = argv.flag?('subspecs', true)
|
43
47
|
@only_subspec = argv.option('subspec')
|
44
48
|
@use_frameworks = !argv.flag?('use-libraries')
|
49
|
+
@use_modular_headers = argv.flag?('use-modular-headers')
|
45
50
|
@source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
|
51
|
+
@platforms = argv.option('platforms', '').split(',')
|
46
52
|
@private = argv.flag?('private', false)
|
47
53
|
@swift_version = argv.option('swift-version', nil)
|
48
54
|
@skip_import_validation = argv.flag?('skip-import-validation', false)
|
@@ -55,7 +61,7 @@ module Pod
|
|
55
61
|
UI.puts
|
56
62
|
failure_reasons = []
|
57
63
|
podspecs_to_lint.each do |podspec|
|
58
|
-
validator = Validator.new(podspec, @source_urls)
|
64
|
+
validator = Validator.new(podspec, @source_urls, @platforms)
|
59
65
|
validator.quick = @quick
|
60
66
|
validator.no_clean = !@clean
|
61
67
|
validator.fail_fast = @fail_fast
|
@@ -63,6 +69,7 @@ module Pod
|
|
63
69
|
validator.no_subspecs = !@subspecs || @only_subspec
|
64
70
|
validator.only_subspec = @only_subspec
|
65
71
|
validator.use_frameworks = @use_frameworks
|
72
|
+
validator.use_modular_headers = @use_modular_headers
|
66
73
|
validator.ignore_public_only_results = @private
|
67
74
|
validator.swift_version = @swift_version
|
68
75
|
validator.skip_import_validation = @skip_import_validation
|
data/lib/cocoapods/config.rb
CHANGED
@@ -100,11 +100,19 @@ module Pod
|
|
100
100
|
def initialize(use_user_settings = true)
|
101
101
|
configure_with(DEFAULTS)
|
102
102
|
|
103
|
+
unless ENV['CP_HOME_DIR'].nil?
|
104
|
+
@cache_root = home_dir + 'cache'
|
105
|
+
end
|
106
|
+
|
103
107
|
if use_user_settings && user_settings_file.exist?
|
104
108
|
require 'yaml'
|
105
109
|
user_settings = YAML.load_file(user_settings_file)
|
106
110
|
configure_with(user_settings)
|
107
111
|
end
|
112
|
+
|
113
|
+
unless ENV['CP_CACHE_DIR'].nil?
|
114
|
+
@cache_root = Pathname.new(ENV['CP_CACHE_DIR']).expand_path
|
115
|
+
end
|
108
116
|
end
|
109
117
|
|
110
118
|
def verbose
|
@@ -127,7 +135,7 @@ module Pod
|
|
127
135
|
# @return [Pathname] the directory where the CocoaPods sources are stored.
|
128
136
|
#
|
129
137
|
def repos_dir
|
130
|
-
@repos_dir ||= Pathname.new(ENV['CP_REPOS_DIR'] || '
|
138
|
+
@repos_dir ||= Pathname.new(ENV['CP_REPOS_DIR'] || (home_dir + 'repos')).expand_path
|
131
139
|
end
|
132
140
|
|
133
141
|
attr_writer :repos_dir
|
@@ -140,7 +148,7 @@ module Pod
|
|
140
148
|
# @return [Pathname] the directory where the CocoaPods templates are stored.
|
141
149
|
#
|
142
150
|
def templates_dir
|
143
|
-
@templates_dir ||= Pathname.new(ENV['CP_TEMPLATES_DIR'] || '
|
151
|
+
@templates_dir ||= Pathname.new(ENV['CP_TEMPLATES_DIR'] || (home_dir + 'templates')).expand_path
|
144
152
|
end
|
145
153
|
|
146
154
|
# @return [Pathname] the root of the CocoaPods installation where the
|
@@ -268,6 +276,9 @@ module Pod
|
|
268
276
|
def configure_with(values_by_key)
|
269
277
|
return unless values_by_key
|
270
278
|
values_by_key.each do |key, value|
|
279
|
+
if key == :cache_root
|
280
|
+
value = Pathname.new(value).expand_path
|
281
|
+
end
|
271
282
|
instance_variable_set("@#{key}", value)
|
272
283
|
end
|
273
284
|
end
|
@@ -180,7 +180,7 @@ module Pod
|
|
180
180
|
tmpdir = Pathname(Dir.mktmpdir)
|
181
181
|
blk.call(tmpdir)
|
182
182
|
ensure
|
183
|
-
FileUtils.remove_entry(tmpdir) if tmpdir && tmpdir.exist?
|
183
|
+
FileUtils.remove_entry(tmpdir, :force => true) if tmpdir && tmpdir.exist?
|
184
184
|
end
|
185
185
|
|
186
186
|
# Copies the `source` directory to `destination`, cleaning the directory
|
data/lib/cocoapods/executable.rb
CHANGED
@@ -191,11 +191,11 @@ module Pod
|
|
191
191
|
class Indenter < ::Array
|
192
192
|
# @return [Fixnum] The indentation level of the UI.
|
193
193
|
#
|
194
|
-
|
194
|
+
attr_reader :indent
|
195
195
|
|
196
196
|
# @return [IO] the {IO} to which the output should be printed.
|
197
197
|
#
|
198
|
-
|
198
|
+
attr_reader :io
|
199
199
|
|
200
200
|
# Init a new Indenter
|
201
201
|
#
|
@@ -16,18 +16,21 @@ module Pod
|
|
16
16
|
# @param [String] podfile_path
|
17
17
|
# @see AbstractExternalSource#podfile_path
|
18
18
|
#
|
19
|
+
# @param [Boolean] can_cache
|
20
|
+
# @see AbstractExternalSource#can_cache
|
21
|
+
#
|
19
22
|
# @return [AbstractExternalSource] an initialized instance of the concrete
|
20
23
|
# external source class associated with the option specified in the
|
21
24
|
# hash.
|
22
25
|
#
|
23
|
-
def self.from_dependency(dependency, podfile_path)
|
24
|
-
from_params(dependency.external_source, dependency, podfile_path)
|
26
|
+
def self.from_dependency(dependency, podfile_path, can_cache)
|
27
|
+
from_params(dependency.external_source, dependency, podfile_path, can_cache)
|
25
28
|
end
|
26
29
|
|
27
|
-
def self.from_params(params, dependency, podfile_path)
|
30
|
+
def self.from_params(params, dependency, podfile_path, can_cache)
|
28
31
|
name = dependency.root_name
|
29
32
|
if klass = concrete_class_from_params(params)
|
30
|
-
klass.new(name, params, podfile_path)
|
33
|
+
klass.new(name, params, podfile_path, can_cache)
|
31
34
|
else
|
32
35
|
msg = "Unknown external source parameters for `#{name}`: `#{params}`"
|
33
36
|
raise Informative, msg
|
@@ -19,20 +19,21 @@ module Pod
|
|
19
19
|
|
20
20
|
# @return [Boolean] Whether the source is allowed to touch the cache.
|
21
21
|
#
|
22
|
-
|
22
|
+
attr_reader :can_cache
|
23
23
|
alias_method :can_cache?, :can_cache
|
24
24
|
|
25
25
|
# Initialize a new instance
|
26
26
|
#
|
27
|
-
# @param [String] name @see name
|
28
|
-
# @param [Hash] params @see params
|
29
|
-
# @param [String] podfile_path @see podfile_path
|
27
|
+
# @param [String] name @see #name
|
28
|
+
# @param [Hash] params @see #params
|
29
|
+
# @param [String] podfile_path @see #podfile_path
|
30
|
+
# @param [Boolean] can_cache @see #can_cache
|
30
31
|
#
|
31
|
-
def initialize(name, params, podfile_path)
|
32
|
+
def initialize(name, params, podfile_path, can_cache = true)
|
32
33
|
@name = name
|
33
34
|
@params = params
|
34
35
|
@podfile_path = podfile_path
|
35
|
-
@can_cache =
|
36
|
+
@can_cache = can_cache
|
36
37
|
end
|
37
38
|
|
38
39
|
# @return [Bool] whether an external source source is equal to another
|
@@ -115,13 +116,17 @@ module Pod
|
|
115
116
|
download_result = Downloader.download(download_request, target, :can_cache => can_cache)
|
116
117
|
rescue Pod::DSLError => e
|
117
118
|
raise Informative, "Failed to load '#{name}' podspec: #{e.message}"
|
118
|
-
rescue =>
|
119
|
-
raise Informative, "Failed to download '#{name}'."
|
119
|
+
rescue => e
|
120
|
+
raise Informative, "Failed to download '#{name}': #{e.message}"
|
120
121
|
end
|
121
|
-
spec = download_result.spec
|
122
122
|
|
123
|
+
spec = download_result.spec
|
123
124
|
raise Informative, "Unable to find a specification for '#{name}'." unless spec
|
124
125
|
|
126
|
+
# since the podspec might be cleaned, we want the checksum to refer
|
127
|
+
# to the json in the sandbox
|
128
|
+
spec.defined_in_file = nil
|
129
|
+
|
125
130
|
store_podspec(sandbox, spec)
|
126
131
|
sandbox.store_pre_downloaded_pod(name)
|
127
132
|
sandbox.store_checkout_source(name, download_result.checkout_options)
|
@@ -160,7 +165,7 @@ module Pod
|
|
160
165
|
when String
|
161
166
|
path = "#{name}.podspec"
|
162
167
|
path << '.json' if json
|
163
|
-
Specification.from_string(spec, path)
|
168
|
+
Specification.from_string(spec, path).tap { |s| s.defined_in_file = nil }
|
164
169
|
when Specification
|
165
170
|
spec.dup
|
166
171
|
else
|
@@ -169,12 +174,15 @@ module Pod
|
|
169
174
|
rescue Pod::DSLError => e
|
170
175
|
raise Informative, "Failed to load '#{name}' podspec: #{e.message}"
|
171
176
|
end
|
172
|
-
|
177
|
+
|
173
178
|
validate_podspec(spec)
|
174
|
-
sandbox.store_podspec(name, spec
|
179
|
+
sandbox.store_podspec(name, spec, true, true)
|
175
180
|
end
|
176
181
|
|
177
182
|
def validate_podspec(podspec)
|
183
|
+
defined_in_file = podspec.defined_in_file
|
184
|
+
podspec.defined_in_file = nil
|
185
|
+
|
178
186
|
validator = validator_for_podspec(podspec)
|
179
187
|
validator.quick = true
|
180
188
|
validator.allow_warnings = true
|
@@ -185,10 +193,12 @@ module Pod
|
|
185
193
|
unless validator.validated?
|
186
194
|
raise Informative, "The `#{name}` pod failed to validate due to #{validator.failure_reason}:\n#{validator.results_message}"
|
187
195
|
end
|
196
|
+
ensure
|
197
|
+
podspec.defined_in_file = defined_in_file
|
188
198
|
end
|
189
199
|
|
190
200
|
def validator_for_podspec(podspec)
|
191
|
-
Validator.new(podspec, [])
|
201
|
+
Validator.new(podspec, [], [])
|
192
202
|
end
|
193
203
|
end
|
194
204
|
end
|
@@ -11,6 +11,12 @@ module Pod
|
|
11
11
|
file.close
|
12
12
|
end
|
13
13
|
|
14
|
+
# @return [String] The contents of the acknowledgements in Markdown format.
|
15
|
+
#
|
16
|
+
def generate
|
17
|
+
licenses
|
18
|
+
end
|
19
|
+
|
14
20
|
def title_from_string(string, level)
|
15
21
|
unless string.empty?
|
16
22
|
'#' * level << " #{string}"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
|
1
3
|
module Pod
|
2
4
|
module Generator
|
3
5
|
class Plist < Acknowledgements
|
@@ -9,6 +11,15 @@ module Pod
|
|
9
11
|
Xcodeproj::Plist.write_to_path(plist, path)
|
10
12
|
end
|
11
13
|
|
14
|
+
# @return [String] The contents of the plist
|
15
|
+
#
|
16
|
+
def generate
|
17
|
+
plist = Nanaimo::Plist.new(plist, :xml)
|
18
|
+
contents = StringIO.new
|
19
|
+
Nanaimo::Writer::XMLWriter.new(plist, :pretty => true, :output => contents, :strict => false).write
|
20
|
+
contents.string
|
21
|
+
end
|
22
|
+
|
12
23
|
def plist
|
13
24
|
{
|
14
25
|
:Title => plist_title,
|
@@ -38,26 +38,46 @@ module Pod
|
|
38
38
|
# @param [Symbol] platform
|
39
39
|
# the platform of the target. Can be `:ios` or `:osx`, etc.
|
40
40
|
#
|
41
|
-
# @param [Boolean] use_frameworks
|
42
|
-
# whether to use frameworks or not when generating the contents of the import file.
|
43
|
-
#
|
44
41
|
# @param [String] name
|
45
42
|
# The name to use for the target, defaults to 'App'.
|
46
43
|
#
|
47
44
|
# @return [Array<PBXBuildFile>] the created build file references.
|
48
45
|
#
|
49
|
-
def self.add_app_project_import(project, target, pod_target, platform,
|
50
|
-
source_file = AppTargetHelper.create_app_import_source_file(project, pod_target, platform,
|
51
|
-
|
46
|
+
def self.add_app_project_import(project, target, pod_target, platform, name = 'App')
|
47
|
+
source_file = AppTargetHelper.create_app_import_source_file(project, pod_target, platform, name)
|
48
|
+
group = project[name] || project.new_group(name, name)
|
49
|
+
source_file_ref = group.new_file(source_file)
|
52
50
|
target.add_file_references([source_file_ref])
|
53
51
|
end
|
54
52
|
|
55
|
-
# Creates and links
|
53
|
+
# Creates and links an empty Swift file for the given target.
|
56
54
|
#
|
57
55
|
# @param [Project] project
|
58
56
|
# the Xcodeproj to generate the target into.
|
59
57
|
#
|
60
58
|
# @param [PBXNativeTarget] target
|
59
|
+
# the native target to link the generated import file into.
|
60
|
+
#
|
61
|
+
# @param [String] name
|
62
|
+
# The name to use for the target, defaults to 'App'.
|
63
|
+
#
|
64
|
+
# @return [Array<PBXBuildFile>] the created build file references.
|
65
|
+
#
|
66
|
+
def self.add_empty_swift_file(project, target, name = 'App')
|
67
|
+
swift_file = project.path.dirname.+("#{name}/dummy.swift")
|
68
|
+
swift_file.parent.mkpath
|
69
|
+
File.write(swift_file, '')
|
70
|
+
group = project[name] || project.new_group(name, name)
|
71
|
+
swift_file_ref = group.new_file(swift_file)
|
72
|
+
target.add_file_references([swift_file_ref])
|
73
|
+
end
|
74
|
+
|
75
|
+
# Creates and links a default app host 'main.m' file.
|
76
|
+
#
|
77
|
+
# @param [Project] project
|
78
|
+
# the Xcodeproj to generate the main file into.
|
79
|
+
#
|
80
|
+
# @param [PBXNativeTarget] target
|
61
81
|
# the native target to link the generated main file into.
|
62
82
|
#
|
63
83
|
# @param [Symbol] platform
|
@@ -70,10 +90,34 @@ module Pod
|
|
70
90
|
#
|
71
91
|
def self.add_app_host_main_file(project, target, platform, name = 'App')
|
72
92
|
source_file = AppTargetHelper.create_app_host_main_file(project, platform, name)
|
73
|
-
|
93
|
+
group = project[name] || project.new_group(name, name)
|
94
|
+
source_file_ref = group.new_file(source_file)
|
74
95
|
target.add_file_references([source_file_ref])
|
75
96
|
end
|
76
97
|
|
98
|
+
# Creates a default launchscreen storyboard.
|
99
|
+
#
|
100
|
+
# @param [Project] project
|
101
|
+
# the Xcodeproj to generate the launchscreen storyboard into.
|
102
|
+
#
|
103
|
+
# @param [PBXNativeTarget] target
|
104
|
+
# the native target to link the generated launchscreen storyboard into.
|
105
|
+
#
|
106
|
+
# @param [Symbol] platform
|
107
|
+
# the platform of the target. Can be `:ios` or `:osx`, etc.
|
108
|
+
#
|
109
|
+
# @param [String] name
|
110
|
+
# The name to use for the target, defaults to 'App'.
|
111
|
+
#
|
112
|
+
# @return [PBXFileReference] the created file reference of the launchscreen storyboard.
|
113
|
+
#
|
114
|
+
def self.add_launchscreen_storyboard(project, target, name = 'App')
|
115
|
+
launch_storyboard_file = AppTargetHelper.create_launchscreen_storyboard_file(project, name)
|
116
|
+
group = project[name] || project.new_group(name, name)
|
117
|
+
launch_storyboard_ref = group.new_file(launch_storyboard_file)
|
118
|
+
target.resources_build_phase.add_file_reference(launch_storyboard_ref)
|
119
|
+
end
|
120
|
+
|
77
121
|
# Adds the xctest framework search paths into the given target.
|
78
122
|
#
|
79
123
|
# @param [PBXNativeTarget] target
|
@@ -116,26 +160,23 @@ module Pod
|
|
116
160
|
# @param [Symbol] platform
|
117
161
|
# the platform of the target. Can be `:ios` or `:osx`, etc.
|
118
162
|
#
|
119
|
-
# @param [Boolean] use_frameworks
|
120
|
-
# whether to use frameworks or not when generating the contents of the import file.
|
121
|
-
#
|
122
163
|
# @param [String] name
|
123
164
|
# The name of the folder to use and save the generated main file.
|
124
165
|
#
|
125
166
|
# @return [Pathname] the new source file that was generated.
|
126
167
|
#
|
127
|
-
def self.create_app_import_source_file(project, pod_target, platform,
|
168
|
+
def self.create_app_import_source_file(project, pod_target, platform, name = 'App')
|
128
169
|
language = pod_target.uses_swift? ? :swift : :objc
|
129
170
|
|
130
171
|
if language == :swift
|
131
172
|
source_file = project.path.dirname.+("#{name}/main.swift")
|
132
173
|
source_file.parent.mkpath
|
133
|
-
import_statement =
|
174
|
+
import_statement = pod_target.should_build? && pod_target.defines_module? ? "import #{pod_target.product_module_name}\n" : ''
|
134
175
|
source_file.open('w') { |f| f << import_statement }
|
135
176
|
else
|
136
177
|
source_file = project.path.dirname.+("#{name}/main.m")
|
137
178
|
source_file.parent.mkpath
|
138
|
-
import_statement = if
|
179
|
+
import_statement = if pod_target.should_build? && pod_target.defines_module?
|
139
180
|
"@import #{pod_target.product_module_name};\n"
|
140
181
|
else
|
141
182
|
header_name = "#{pod_target.product_module_name}/#{pod_target.product_module_name}.h"
|
@@ -155,6 +196,23 @@ module Pod
|
|
155
196
|
source_file
|
156
197
|
end
|
157
198
|
|
199
|
+
# Creates a default launchscreen storyboard file.
|
200
|
+
#
|
201
|
+
# @param [Project] project
|
202
|
+
# the Xcodeproj to generate the launchscreen storyboard into.
|
203
|
+
#
|
204
|
+
# @param [String] name
|
205
|
+
# The name of the folder to use and save the generated launchscreen storyboard file.
|
206
|
+
#
|
207
|
+
# @return [Pathname] the new launchscreen storyboard file that was generated.
|
208
|
+
#
|
209
|
+
def self.create_launchscreen_storyboard_file(project, name = 'App')
|
210
|
+
launch_storyboard_file = project.path.dirname.+("#{name}/LaunchScreen.storyboard")
|
211
|
+
launch_storyboard_file.parent.mkpath
|
212
|
+
File.write(launch_storyboard_file, LAUNCHSCREEN_STORYBOARD_CONTENTS)
|
213
|
+
launch_storyboard_file
|
214
|
+
end
|
215
|
+
|
158
216
|
# Creates a default app host 'main.m' file.
|
159
217
|
#
|
160
218
|
# @param [Project] project
|
@@ -176,7 +234,7 @@ module Pod
|
|
176
234
|
when :ios, :tvos
|
177
235
|
f << IOS_APP_HOST_MAIN_CONTENTS
|
178
236
|
when :osx
|
179
|
-
f <<
|
237
|
+
f << MACOS_APP_HOST_MAIN_CONTENTS
|
180
238
|
end
|
181
239
|
end
|
182
240
|
source_file
|
@@ -215,13 +273,41 @@ int main(int argc, char *argv[])
|
|
215
273
|
}
|
216
274
|
EOS
|
217
275
|
|
218
|
-
|
276
|
+
MACOS_APP_HOST_MAIN_CONTENTS = <<EOS.freeze
|
219
277
|
#import <Cocoa/Cocoa.h>
|
220
278
|
|
221
279
|
int main(int argc, const char * argv[]) {
|
222
280
|
return NSApplicationMain(argc, argv);
|
223
281
|
}
|
224
282
|
EOS
|
283
|
+
|
284
|
+
LAUNCHSCREEN_STORYBOARD_CONTENTS = <<-XML.strip_heredoc.freeze
|
285
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
286
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
287
|
+
<dependencies>
|
288
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
289
|
+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
290
|
+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
291
|
+
</dependencies>
|
292
|
+
<scenes>
|
293
|
+
<!--View Controller-->
|
294
|
+
<scene sceneID="EHf-IW-A2E">
|
295
|
+
<objects>
|
296
|
+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
297
|
+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
298
|
+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
299
|
+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
300
|
+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
301
|
+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
302
|
+
</view>
|
303
|
+
</viewController>
|
304
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
305
|
+
</objects>
|
306
|
+
<point key="canvasLocation" x="53" y="375"/>
|
307
|
+
</scene>
|
308
|
+
</scenes>
|
309
|
+
</document>
|
310
|
+
XML
|
225
311
|
end
|
226
312
|
end
|
227
313
|
end
|