cocoapods 0.35.0 → 0.36.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +185 -6
  3. data/README.md +1 -1
  4. data/lib/cocoapods.rb +4 -0
  5. data/lib/cocoapods/command.rb +2 -2
  6. data/lib/cocoapods/command/inter_process_communication.rb +1 -1
  7. data/lib/cocoapods/command/lib.rb +3 -0
  8. data/lib/cocoapods/command/list.rb +0 -35
  9. data/lib/cocoapods/command/search.rb +1 -2
  10. data/lib/cocoapods/command/spec.rb +6 -3
  11. data/lib/cocoapods/config.rb +1 -20
  12. data/lib/cocoapods/external_sources/abstract_external_source.rb +4 -0
  13. data/lib/cocoapods/gem_version.rb +1 -1
  14. data/lib/cocoapods/generator/embed_frameworks_script.rb +107 -0
  15. data/lib/cocoapods/generator/header.rb +13 -1
  16. data/lib/cocoapods/generator/info_plist_file.rb +84 -0
  17. data/lib/cocoapods/generator/module_map.rb +49 -0
  18. data/lib/cocoapods/generator/umbrella_header.rb +44 -0
  19. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +69 -23
  20. data/lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb +12 -0
  21. data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +1 -9
  22. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +79 -1
  23. data/lib/cocoapods/hooks_manager.rb +75 -13
  24. data/lib/cocoapods/installer.rb +59 -2
  25. data/lib/cocoapods/installer/analyzer.rb +115 -38
  26. data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +6 -1
  27. data/lib/cocoapods/installer/file_references_installer.rb +11 -5
  28. data/lib/cocoapods/installer/migrator.rb +9 -0
  29. data/lib/cocoapods/installer/target_installer.rb +89 -5
  30. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +49 -5
  31. data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +57 -9
  32. data/lib/cocoapods/installer/user_project_integrator.rb +3 -2
  33. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +67 -6
  34. data/lib/cocoapods/project.rb +18 -2
  35. data/lib/cocoapods/resolver.rb +2 -2
  36. data/lib/cocoapods/sandbox/file_accessor.rb +23 -3
  37. data/lib/cocoapods/sandbox/headers_store.rb +4 -0
  38. data/lib/cocoapods/sources_manager.rb +5 -1
  39. data/lib/cocoapods/target.rb +117 -1
  40. data/lib/cocoapods/target/aggregate_target.rb +46 -4
  41. data/lib/cocoapods/target/pod_target.rb +39 -1
  42. data/lib/cocoapods/user_interface.rb +16 -21
  43. data/lib/cocoapods/user_interface/error_report.rb +2 -2
  44. data/lib/cocoapods/validator.rb +68 -23
  45. metadata +23 -19
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![CocoaPods Logo](https://raw.github.com/CocoaPods/shared_resources/master/assets/cocoapods-banner-readme.png)
2
2
 
3
- ### CocoaPods: The Objective-C dependency manager
3
+ ### CocoaPods: The Cocoa dependency manager
4
4
 
5
5
  [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg?style=flat)](https://travis-ci.org/CocoaPods/CocoaPods)
6
6
  [![Gem Version](http://img.shields.io/gem/v/cocoapods.svg?style=flat)](http://badge.fury.io/rb/cocoapods)
@@ -56,9 +56,13 @@ module Pod
56
56
  autoload :BridgeSupport, 'cocoapods/generator/bridge_support'
57
57
  autoload :CopyResourcesScript, 'cocoapods/generator/copy_resources_script'
58
58
  autoload :DummySource, 'cocoapods/generator/dummy_source'
59
+ autoload :EmbedFrameworksScript, 'cocoapods/generator/embed_frameworks_script'
59
60
  autoload :Header, 'cocoapods/generator/header'
61
+ autoload :InfoPlistFile, 'cocoapods/generator/info_plist_file'
62
+ autoload :ModuleMap, 'cocoapods/generator/module_map'
60
63
  autoload :PrefixHeader, 'cocoapods/generator/prefix_header'
61
64
  autoload :TargetEnvironmentHeader, 'cocoapods/generator/target_environment_header'
65
+ autoload :UmbrellaHeader, 'cocoapods/generator/umbrella_header'
62
66
  autoload :XCConfig, 'cocoapods/generator/xcconfig'
63
67
  end
64
68
 
@@ -28,8 +28,8 @@ module Pod
28
28
  self.abstract_command = true
29
29
  self.command = 'pod'
30
30
  self.version = VERSION
31
- self.description = 'CocoaPods, the Objective-C library package manager.'
32
- self.plugin_prefix = 'cocoapods'
31
+ self.description = 'CocoaPods, the Cocoa library package manager.'
32
+ self.plugin_prefixes = %w(claide cocoapods)
33
33
 
34
34
  [Install, Update, Outdated, IPC::Podfile, IPC::Repl].each { |c| c.send(:include, ProjectDirectory) }
35
35
 
@@ -30,7 +30,7 @@ module Pod
30
30
  def run
31
31
  require 'json'
32
32
  spec = Specification.from_file(@path)
33
- output_pipe.puts(JSON.pretty_generate(spec))
33
+ output_pipe.puts(spec.to_pretty_json)
34
34
  end
35
35
  end
36
36
 
@@ -113,6 +113,7 @@ module Pod
113
113
  ['--subspec=NAME', 'Lint validates only the given subspec'],
114
114
  ['--no-subspecs', 'Lint skips validation of subspecs'],
115
115
  ['--no-clean', 'Lint leaves the build directory intact for inspection'],
116
+ ['--use-frameworks', 'Lint uses frameworks to install the spec'],
116
117
  ['--sources=https://github.com/artsy/Specs', 'The sources from which to pull dependant pods ' \
117
118
  '(defaults to https://github.com/CocoaPods/Specs.git). '\
118
119
  'Multiple sources must be comma-delimited.']].concat(super)
@@ -124,6 +125,7 @@ module Pod
124
125
  @clean = argv.flag?('clean', true)
125
126
  @subspecs = argv.flag?('subspecs', true)
126
127
  @only_subspec = argv.option('subspec')
128
+ @use_frameworks = argv.flag?('use-frameworks')
127
129
  @source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
128
130
  @podspecs_paths = argv.arguments!
129
131
  super
@@ -144,6 +146,7 @@ module Pod
144
146
  validator.allow_warnings = @allow_warnings
145
147
  validator.no_subspecs = !@subspecs || @only_subspec
146
148
  validator.only_subspec = @only_subspec
149
+ validator.use_frameworks = @use_frameworks
147
150
  validator.validate
148
151
 
149
152
  unless @clean
@@ -34,41 +34,6 @@ module Pod
34
34
  end
35
35
 
36
36
  #-----------------------------------------------------------------------#
37
-
38
- class New < List
39
- self.summary = 'Lists pods introduced in the master spec-repo since the last check'
40
-
41
- def run
42
- update_if_necessary!
43
-
44
- days = [1, 2, 3, 5, 8]
45
- dates, groups = {}, {}
46
- days.each { |d| dates[d] = Time.now - 60 * 60 * 24 * d }
47
- sets = SourcesManager.aggregate.all_sets
48
- statistics_provider = Config.instance.spec_statistics_provider
49
- creation_dates = statistics_provider.creation_dates(sets)
50
-
51
- sets.each do |set|
52
- set_date = creation_dates[set.name]
53
- days.each do |d|
54
- if set_date >= dates[d]
55
- groups[d] = [] unless groups[d]
56
- groups[d] << set
57
- break
58
- end
59
- end
60
- end
61
- days.reverse.each do |d|
62
- sets = groups[d]
63
- next unless sets
64
- UI.section("\nPods added in the last #{'day'.pluralize(d)}".yellow) do
65
- sorted = sets.sort_by { |s| creation_dates[s.name] }
66
- mode = @stats ? :stats : :name
67
- sorted.each { |set| UI.pod(set, mode, statistics_provider) }
68
- end
69
- end
70
- end
71
- end
72
37
  end
73
38
  end
74
39
  end
@@ -84,11 +84,10 @@ module Pod
84
84
  sets.reject! { |set| !set.specification.available_platforms.map(&:name).include?(:osx) }
85
85
  end
86
86
 
87
- statistics_provider = Config.instance.spec_statistics_provider
88
87
  sets.each do |set|
89
88
  begin
90
89
  if @stats
91
- UI.pod(set, :stats, statistics_provider)
90
+ UI.pod(set, :stats)
92
91
  else
93
92
  UI.pod(set, :normal)
94
93
  end
@@ -68,6 +68,7 @@ module Pod
68
68
  ['--subspec=NAME', 'Lint validates only the given subspec'],
69
69
  ['--no-subspecs', 'Lint skips validation of subspecs'],
70
70
  ['--no-clean', 'Lint leaves the build directory intact for inspection'],
71
+ ['--use-frameworks', 'Lint uses frameworks to install the spec'],
71
72
  ['--sources=https://github.com/artsy/Specs', 'The sources from which to pull dependant pods ' \
72
73
  '(defaults to https://github.com/CocoaPods/Specs.git). '\
73
74
  'Multiple sources must be comma-delimited.']].concat(super)
@@ -79,6 +80,7 @@ module Pod
79
80
  @clean = argv.flag?('clean', true)
80
81
  @subspecs = argv.flag?('subspecs', true)
81
82
  @only_subspec = argv.option('subspec')
83
+ @use_frameworks = argv.flag?('use-frameworks')
82
84
  @source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',')
83
85
  @podspecs_paths = argv.arguments!
84
86
  super
@@ -94,6 +96,7 @@ module Pod
94
96
  validator.allow_warnings = @allow_warnings
95
97
  validator.no_subspecs = !@subspecs || @only_subspec
96
98
  validator.only_subspec = @only_subspec
99
+ validator.use_frameworks = @use_frameworks
97
100
  validator.validate
98
101
  invalid_count += 1 unless validator.validated?
99
102
 
@@ -432,7 +435,7 @@ module Pod
432
435
 
433
436
  #--------------------------------------#
434
437
 
435
- # Templates and github information retrieval for spec create
438
+ # Templates and GitHub information retrieval for spec create
436
439
  #
437
440
  # @todo It would be nice to have a template class that accepts options
438
441
  # and uses the default ones if not provided.
@@ -580,8 +583,8 @@ Pod::Spec.new do |s|
580
583
  # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
581
584
  #
582
585
  # CocoaPods is smart about how it includes source code. For source files
583
- # giving a folder will include any h, m, mm, c & cpp files. For header
584
- # files it will include any header in the folder.
586
+ # giving a folder will include any swift, h, m, mm, c & cpp files.
587
+ # For header files it will include any header in the folder.
585
588
  # Not including the public_header_files will make all headers public.
586
589
  #
587
590
 
@@ -225,31 +225,12 @@ module Pod
225
225
  @default_test_podfile_path ||= templates_dir + 'Podfile.test'
226
226
  end
227
227
 
228
- # @return [Pathname] The file to use a cache of the statistics provider.
229
- #
230
- def statistics_cache_file
231
- cache_root + 'statistics.yml'
232
- end
233
-
234
228
  # @return [Pathname] The file to use to cache the search data.
235
229
  #
236
230
  def search_index_file
237
231
  cache_root + 'search_index.yaml'
238
232
  end
239
233
 
240
- public
241
-
242
- #-------------------------------------------------------------------------#
243
-
244
- # @!group Dependency Injection
245
-
246
- # @return [Specification::Set::Statistics] The statistic provider to use
247
- # for specifications.
248
- #
249
- def spec_statistics_provider
250
- Specification::Set::Statistics.new(statistics_cache_file)
251
- end
252
-
253
234
  private
254
235
 
255
236
  #-------------------------------------------------------------------------#
@@ -283,7 +264,7 @@ module Pod
283
264
  'CocoaPods.podfile.yaml',
284
265
  'CocoaPods.podfile',
285
266
  'Podfile',
286
- ]
267
+ ].freeze
287
268
 
288
269
  public
289
270
 
@@ -138,6 +138,10 @@ module Pod
138
138
  # @return [void]
139
139
  #
140
140
  def store_podspec(sandbox, spec, json = false)
141
+ if spec.is_a? Pathname
142
+ spec = Specification.from_file(spec).to_pretty_json
143
+ json = true
144
+ end
141
145
  sandbox.store_podspec(name, spec, true, json)
142
146
  end
143
147
  end
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the cocoapods command line tool.
3
3
  #
4
- VERSION = '0.35.0' unless defined? Pod::VERSION
4
+ VERSION = '0.36.0.beta.1' unless defined? Pod::VERSION
5
5
  end
@@ -0,0 +1,107 @@
1
+ module Pod
2
+ module Generator
3
+ class EmbedFrameworksScript
4
+ # @return [TargetDefinition] The target definition, whose label will be
5
+ # used to locate the target-specific build products.
6
+ #
7
+ attr_reader :target_definition
8
+
9
+ # @return [Hash{String, Array{String}] Multiple lists of frameworks per
10
+ # configuration.
11
+ #
12
+ attr_reader :frameworks_by_config
13
+
14
+ # @param [TargetDefinition] target_definition
15
+ # @see #target_definition
16
+ #
17
+ # @param [Hash{String, Array{String}] frameworks_by_config
18
+ # @see #frameworks_by_config
19
+ #
20
+ def initialize(target_definition, frameworks_by_config)
21
+ @target_definition = target_definition
22
+ @frameworks_by_config = frameworks_by_config
23
+ end
24
+
25
+ # Saves the resource script to the given pathname.
26
+ #
27
+ # @param [Pathname] pathname
28
+ # The path where the embed frameworks script should be saved.
29
+ #
30
+ # @return [void]
31
+ #
32
+ def save_as(pathname)
33
+ pathname.open('w') do |file|
34
+ file.puts(script)
35
+ end
36
+ File.chmod(0755, pathname.to_s)
37
+ end
38
+
39
+ private
40
+
41
+ # @!group Private Helpers
42
+
43
+ # @return [String] The contents of the embed frameworks script.
44
+ #
45
+ def script
46
+ script = <<-eos.strip_heredoc
47
+ #!/bin/sh
48
+ set -e
49
+
50
+ echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
51
+ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
52
+
53
+ SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
54
+
55
+ install_framework()
56
+ {
57
+ local source="${BUILT_PRODUCTS_DIR}/#{target_definition.label}/$1"
58
+ local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
59
+
60
+ if [ -L ${source} ]; then
61
+ echo "Symlinked..."
62
+ source=$(readlink "${source}")
63
+ fi
64
+
65
+ # use filter instead of exclude so missing patterns dont' throw errors
66
+ echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers/\" --filter \"- PrivateHeaders/\" ${source} ${destination}"
67
+ rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers/" --filter "- PrivateHeaders/" "${source}" "${destination}"
68
+ # Resign the code if required by the build settings to avoid unstable apps
69
+ if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then
70
+ code_sign "${destination}/$1"
71
+ fi
72
+
73
+ # Embed linked Swift runtime libraries
74
+ local basename
75
+ basename=$(echo $1 | sed -E s/\\\\..+// && exit ${PIPESTATUS[0]})
76
+ local swift_runtime_libs
77
+ swift_runtime_libs=$(xcrun otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/$1/${basename}" | grep @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u && exit ${PIPESTATUS[0]})
78
+ for lib in $swift_runtime_libs; do
79
+ echo "rsync -av \\"${SWIFT_STDLIB_PATH}/${lib}\\" \\"${destination}\\""
80
+ rsync -av "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
81
+ done
82
+ }
83
+
84
+ # Signs a framework with the provided identity
85
+ code_sign() {
86
+ # Use the current code_sign_identitiy
87
+ echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
88
+ echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements $1"
89
+ /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1"
90
+ }
91
+
92
+ eos
93
+ script += "\n" unless frameworks_by_config.values.all?(&:empty?)
94
+ frameworks_by_config.each do |config, frameworks|
95
+ unless frameworks.empty?
96
+ script += %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
97
+ frameworks.each do |framework|
98
+ script += " install_framework '#{framework}'\n"
99
+ end
100
+ script += "fi\n"
101
+ end
102
+ end
103
+ script
104
+ end
105
+ end
106
+ end
107
+ end
@@ -13,7 +13,11 @@ module Pod
13
13
 
14
14
  # @return [Array<String>] The list of the headers to import.
15
15
  #
16
- attr_reader :imports
16
+ attr_accessor :imports
17
+
18
+ # @return [Array<String>] The list of the modules to import.
19
+ #
20
+ attr_accessor :module_imports
17
21
 
18
22
  # @param [Symbol] platform
19
23
  # @see platform
@@ -21,6 +25,7 @@ module Pod
21
25
  def initialize(platform)
22
26
  @platform = platform
23
27
  @imports = []
28
+ @module_imports = []
24
29
  end
25
30
 
26
31
  # Generates the contents of the header according to the platform.
@@ -41,6 +46,13 @@ module Pod
41
46
  result << %|#import "#{import}"\n|
42
47
  end
43
48
 
49
+ unless module_imports.empty?
50
+ module_imports.each do |import|
51
+ result << %|\n@import #{import}|
52
+ end
53
+ result << "\n"
54
+ end
55
+
44
56
  result
45
57
  end
46
58
 
@@ -0,0 +1,84 @@
1
+ module Pod
2
+ module Generator
3
+ # Generates Info.plist files. A Info.plist file is generated for each
4
+ # Pod and for each Pod target definition, that requires to be built as
5
+ # framework. It states public attributes.
6
+ #
7
+ class InfoPlistFile
8
+ # @return [Target] the target represented by this Info.plist.
9
+ #
10
+ attr_reader :target
11
+
12
+ # @param [Target] target @see target
13
+ #
14
+ def initialize(target)
15
+ @target = target
16
+ end
17
+
18
+ # Generates and saves the Info.plist to the given path.
19
+ #
20
+ # @param [Pathname] path
21
+ # the path where the prefix header should be stored.
22
+ #
23
+ # @return [void]
24
+ #
25
+ def save_as(path)
26
+ contents = generate
27
+ path.open('w') do |f|
28
+ f.write(contents)
29
+ end
30
+ end
31
+
32
+ # The version associated with the current target
33
+ #
34
+ # @note Will return 1.0.0 for the AggregateTarget
35
+ #
36
+ # @return [String]
37
+ #
38
+ def target_version
39
+ if target && target.respond_to?(:root_spec)
40
+ target.root_spec.version.to_s
41
+ else
42
+ '1.0.0'
43
+ end
44
+ end
45
+
46
+ # Generates the contents of the Info.plist
47
+ #
48
+ # @return [String]
49
+ #
50
+ def generate
51
+ FILE_CONTENTS.sub('${CURRENT_PROJECT_VERSION_STRING}', target_version)
52
+ end
53
+
54
+ FILE_CONTENTS = <<-EOS
55
+ <?xml version="1.0" encoding="UTF-8"?>
56
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
57
+ <plist version="1.0">
58
+ <dict>
59
+ <key>CFBundleDevelopmentRegion</key>
60
+ <string>en</string>
61
+ <key>CFBundleExecutable</key>
62
+ <string>${EXECUTABLE_NAME}</string>
63
+ <key>CFBundleIdentifier</key>
64
+ <string>org.cocoapods.${PRODUCT_NAME:rfc1034identifier}</string>
65
+ <key>CFBundleInfoDictionaryVersion</key>
66
+ <string>6.0</string>
67
+ <key>CFBundleName</key>
68
+ <string>${PRODUCT_NAME}</string>
69
+ <key>CFBundlePackageType</key>
70
+ <string>FMWK</string>
71
+ <key>CFBundleShortVersionString</key>
72
+ <string>${CURRENT_PROJECT_VERSION_STRING}</string>
73
+ <key>CFBundleSignature</key>
74
+ <string>????</string>
75
+ <key>CFBundleVersion</key>
76
+ <string>${CURRENT_PROJECT_VERSION}</string>
77
+ <key>NSPrincipalClass</key>
78
+ <string></string>
79
+ </dict>
80
+ </plist>
81
+ EOS
82
+ end
83
+ end
84
+ end