cocoapods-square-stable 0.19.3

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 (58) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +1296 -0
  3. data/LICENSE +20 -0
  4. data/README.md +94 -0
  5. data/bin/pod +16 -0
  6. data/bin/sandbox-pod +120 -0
  7. data/lib/cocoapods.rb +77 -0
  8. data/lib/cocoapods/command.rb +116 -0
  9. data/lib/cocoapods/command/help.rb +23 -0
  10. data/lib/cocoapods/command/inter_process_communication.rb +178 -0
  11. data/lib/cocoapods/command/list.rb +77 -0
  12. data/lib/cocoapods/command/outdated.rb +56 -0
  13. data/lib/cocoapods/command/podfile_info.rb +91 -0
  14. data/lib/cocoapods/command/project.rb +88 -0
  15. data/lib/cocoapods/command/push.rb +172 -0
  16. data/lib/cocoapods/command/repo.rb +145 -0
  17. data/lib/cocoapods/command/search.rb +61 -0
  18. data/lib/cocoapods/command/setup.rb +134 -0
  19. data/lib/cocoapods/command/spec.rb +590 -0
  20. data/lib/cocoapods/config.rb +231 -0
  21. data/lib/cocoapods/downloader.rb +59 -0
  22. data/lib/cocoapods/executable.rb +118 -0
  23. data/lib/cocoapods/external_sources.rb +363 -0
  24. data/lib/cocoapods/file_list.rb +36 -0
  25. data/lib/cocoapods/gem_version.rb +7 -0
  26. data/lib/cocoapods/generator/acknowledgements.rb +107 -0
  27. data/lib/cocoapods/generator/acknowledgements/markdown.rb +40 -0
  28. data/lib/cocoapods/generator/acknowledgements/plist.rb +64 -0
  29. data/lib/cocoapods/generator/bridge_support.rb +22 -0
  30. data/lib/cocoapods/generator/copy_resources_script.rb +54 -0
  31. data/lib/cocoapods/generator/dummy_source.rb +22 -0
  32. data/lib/cocoapods/generator/prefix_header.rb +82 -0
  33. data/lib/cocoapods/generator/target_environment_header.rb +86 -0
  34. data/lib/cocoapods/generator/xcconfig.rb +185 -0
  35. data/lib/cocoapods/hooks/installer_representation.rb +134 -0
  36. data/lib/cocoapods/hooks/library_representation.rb +94 -0
  37. data/lib/cocoapods/hooks/pod_representation.rb +74 -0
  38. data/lib/cocoapods/installer.rb +571 -0
  39. data/lib/cocoapods/installer/analyzer.rb +559 -0
  40. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +253 -0
  41. data/lib/cocoapods/installer/file_references_installer.rb +179 -0
  42. data/lib/cocoapods/installer/pod_source_installer.rb +248 -0
  43. data/lib/cocoapods/installer/target_installer.rb +379 -0
  44. data/lib/cocoapods/installer/user_project_integrator.rb +180 -0
  45. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +224 -0
  46. data/lib/cocoapods/library.rb +202 -0
  47. data/lib/cocoapods/open_uri.rb +24 -0
  48. data/lib/cocoapods/project.rb +209 -0
  49. data/lib/cocoapods/resolver.rb +212 -0
  50. data/lib/cocoapods/sandbox.rb +343 -0
  51. data/lib/cocoapods/sandbox/file_accessor.rb +217 -0
  52. data/lib/cocoapods/sandbox/headers_store.rb +96 -0
  53. data/lib/cocoapods/sandbox/path_list.rb +208 -0
  54. data/lib/cocoapods/sources_manager.rb +276 -0
  55. data/lib/cocoapods/user_interface.rb +304 -0
  56. data/lib/cocoapods/user_interface/error_report.rb +101 -0
  57. data/lib/cocoapods/validator.rb +350 -0
  58. metadata +238 -0
@@ -0,0 +1,36 @@
1
+ if RUBY_VERSION >= "1.9"
2
+ require 'rake/file_list'
3
+ else
4
+ require 'rake'
5
+ end
6
+
7
+ # This makes Rake::FileList usable with the Specification attributes
8
+ # source_files, public_header_files, preserve_paths, and resources.
9
+ #
10
+ # @todo This needs to be deprecated as we no have the PathList List
11
+ #
12
+ module Rake
13
+ class FileList
14
+ def prepend_patterns(pathname)
15
+ @pending_add.map! { |pattern| (pathname + pattern).to_s }
16
+ end
17
+
18
+ def directory?
19
+ false
20
+ end
21
+
22
+ def glob
23
+ to_a.map { |path| Pathname.new(path) }
24
+ end
25
+
26
+ def inspect
27
+ "<##{self.class} pending_add=#{@pending_add}>"
28
+ end
29
+ alias :to_s :inspect
30
+ end
31
+ end
32
+
33
+ # TODO Defined in CocoaPods Core
34
+ # module Pod
35
+ # FileList = Rake::FileList
36
+ # end
@@ -0,0 +1,7 @@
1
+ module Pod
2
+
3
+ # The version of the cocoapods command line tool.
4
+ #
5
+ VERSION = '0.19.1' unless defined? Pod::VERSION
6
+ end
7
+
@@ -0,0 +1,107 @@
1
+ module Pod
2
+ module Generator
3
+
4
+ class Acknowledgements
5
+
6
+ # @return [Array<Class>] The classes of the acknowledgements generator
7
+ # subclasses.
8
+ #
9
+ def self.generators
10
+ [Plist, Markdown]
11
+ end
12
+
13
+ # @return [Array<Sandbox::FileAccessor>] the list of the file accessors
14
+ # for the specs of the target that needs to generate the
15
+ # acknowledgements.
16
+ #
17
+ attr_reader :file_accessors
18
+
19
+ # @param [Array<Sandbox::FileAccessor>] @see file_accessors.
20
+ #
21
+ def initialize(file_accessors)
22
+ @file_accessors = file_accessors
23
+ end
24
+
25
+ #-----------------------------------------------------------------------#
26
+
27
+ # !@group Configuration
28
+
29
+ # @return [String] The title of the acknowledgements file.
30
+ #
31
+ def header_title
32
+ "Acknowledgements"
33
+ end
34
+
35
+ # @return [String] A text to present before listing the acknowledgements.
36
+ #
37
+ def header_text
38
+ "This application makes use of the following third party libraries:"
39
+ end
40
+
41
+ # @return [String] The title of the foot notes.
42
+ #
43
+ def footnote_title
44
+ ""
45
+ end
46
+
47
+ # @return [String] the foot notes.
48
+ #
49
+ def footnote_text
50
+ "Generated by CocoaPods - http://cocoapods.org"
51
+ end
52
+
53
+ #-----------------------------------------------------------------------#
54
+
55
+ private
56
+
57
+ # !@group Private methods
58
+
59
+ # @return [Array<Specification>] The root specifications for which the
60
+ # acknowledgements should be generated.
61
+ #
62
+ def specs
63
+ file_accessors.map{ |accessor| accessor.spec.root }.uniq
64
+ end
65
+
66
+ # Returns the text of the license for the given spec.
67
+ #
68
+ # @param [Specification] spec
69
+ # the specification for which license is needed.
70
+ #
71
+ # @return [String] The text of the license.
72
+ # @return [Nil] If not license text could be found.
73
+ #
74
+ def license_text(spec)
75
+ return nil unless spec.license
76
+ text = spec.license[:text]
77
+ unless text
78
+ if license_file = file_accessor(spec).license
79
+ if license_file.exist?
80
+ text = IO.read(license_file)
81
+ else
82
+ UI.warn "Unable to read the license file `#{license_file }` " \
83
+ "for the spec `#{spec}`"
84
+ end
85
+ end
86
+ end
87
+ text
88
+ end
89
+
90
+ protected
91
+
92
+ # Returns the file accessor for the given spec.
93
+ #
94
+ # @param [Specification] spec
95
+ # the specification for which the file accessor is needed.
96
+ #
97
+ # @return [Sandbox::FileAccessor] The file accessor.
98
+ #
99
+ def file_accessor(spec)
100
+ file_accessors.find { |accessor| accessor.spec.root == spec }
101
+ end
102
+
103
+ #-----------------------------------------------------------------------#
104
+
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,40 @@
1
+ module Pod
2
+ module Generator
3
+
4
+ class Markdown < Acknowledgements
5
+
6
+ def self.path_from_basepath(path)
7
+ Pathname.new(path.dirname + "#{path.basename.to_s}.markdown")
8
+ end
9
+
10
+ def save_as(path)
11
+ file = File.new(path, "w")
12
+ file.write(licenses)
13
+ file.close
14
+ end
15
+
16
+ def title_from_string(string, level)
17
+ if !string.empty?
18
+ "#" * level << " #{string}"
19
+ end
20
+ end
21
+
22
+ def string_for_spec(spec)
23
+ if (license_text = license_text(spec))
24
+ "\n" << title_from_string(spec.name, 2) << "\n\n" << license_text << "\n"
25
+ end
26
+ end
27
+
28
+ def licenses
29
+ licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n"
30
+ specs.each do |spec|
31
+ if (license = string_for_spec(spec))
32
+ license = license.force_encoding("UTF-8") if license.respond_to?(:force_encoding)
33
+ licenses_string += license
34
+ end
35
+ end
36
+ licenses_string += "#{title_from_string(footnote_title, 2)}#{footnote_text}\n"
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,64 @@
1
+ module Pod
2
+ module Generator
3
+
4
+ class Plist < Acknowledgements
5
+ require "xcodeproj/xcodeproj_ext"
6
+
7
+ def self.path_from_basepath(path)
8
+ Pathname.new(path.dirname + "#{path.basename.to_s}.plist")
9
+ end
10
+
11
+ def save_as(path)
12
+ Xcodeproj.write_plist(plist, path)
13
+ end
14
+
15
+ def plist
16
+ {
17
+ :Title => plist_title,
18
+ :StringsTable => plist_title,
19
+ :PreferenceSpecifiers => licenses
20
+ }
21
+ end
22
+
23
+ def plist_title
24
+ "Acknowledgements"
25
+ end
26
+
27
+ def licenses
28
+ licences_array = [header_hash]
29
+ specs.each do |spec|
30
+ if (hash = hash_for_spec(spec))
31
+ licences_array << hash
32
+ end
33
+ end
34
+ licences_array << footnote_hash
35
+ end
36
+
37
+ def hash_for_spec(spec)
38
+ if (license = license_text(spec))
39
+ {
40
+ :Type => "PSGroupSpecifier",
41
+ :Title => spec.name,
42
+ :FooterText => license
43
+ }
44
+ end
45
+ end
46
+
47
+ def header_hash
48
+ {
49
+ :Type => "PSGroupSpecifier",
50
+ :Title => header_title,
51
+ :FooterText => header_text
52
+ }
53
+ end
54
+
55
+ def footnote_hash
56
+ {
57
+ :Type => "PSGroupSpecifier",
58
+ :Title => footnote_title,
59
+ :FooterText => footnote_text
60
+ }
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,22 @@
1
+ module Pod
2
+ module Generator
3
+ class BridgeSupport
4
+ extend Executable
5
+ executable :gen_bridge_metadata
6
+
7
+ attr_reader :headers
8
+
9
+ def initialize(headers)
10
+ @headers = headers
11
+ end
12
+
13
+ def search_paths
14
+ @headers.map { |header| "-I '#{header.dirname}'" }.uniq
15
+ end
16
+
17
+ def save_as(pathname)
18
+ gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'}
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,54 @@
1
+ module Pod
2
+ module Generator
3
+ class CopyResourcesScript
4
+ CONTENT = <<EOS
5
+ #!/bin/sh
6
+
7
+ install_resource()
8
+ {
9
+ case $1 in
10
+ *\.storyboard)
11
+ echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$1\\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
12
+ ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$1\\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
13
+ ;;
14
+ *\.xib)
15
+ echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$1\\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}"
16
+ ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$1\\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}"
17
+ ;;
18
+ *.framework)
19
+ echo "rsync -rp ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20
+ rsync -rp "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
21
+ ;;
22
+ *.xcdatamodeld)
23
+ echo "xcrun momc ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xcdatamodeld`.momd"
24
+ xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xcdatamodeld`.momd"
25
+ ;;
26
+ *)
27
+ echo "rsync -av --exclude '*/.svn/*' ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
28
+ rsync -av --exclude '*/.svn/*' "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
29
+ ;;
30
+ esac
31
+ }
32
+ EOS
33
+
34
+ attr_reader :resources
35
+
36
+ # A list of files relative to the project pods root.
37
+ def initialize(resources = [], reference_external_strings_file = false)
38
+ @resources = resources
39
+ @reference_external_strings_file = reference_external_strings_file
40
+ end
41
+
42
+ def save_as(pathname)
43
+ pathname.open('w') do |script|
44
+ script.puts @reference_external_strings_file ? CONTENT : CONTENT.gsub(' --reference-external-strings-file', '')
45
+ @resources.each do |resource|
46
+ script.puts "install_resource '#{resource}'"
47
+ end
48
+ end
49
+ # @todo use File api
50
+ system("chmod +x '#{pathname}'")
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,22 @@
1
+ module Pod
2
+ module Generator
3
+ class DummySource
4
+ attr_reader :class_name
5
+
6
+ def initialize(class_name_identifier)
7
+ validated_class_name_identifier = class_name_identifier.gsub(/[^0-9a-z_]/i, '_')
8
+ @class_name = "PodsDummy_#{validated_class_name_identifier}"
9
+ end
10
+
11
+ def save_as(pathname)
12
+ pathname.open('w') do |source|
13
+ source.puts "#import <Foundation/Foundation.h>"
14
+ source.puts "@interface #{class_name} : NSObject"
15
+ source.puts "@end"
16
+ source.puts "@implementation #{class_name}"
17
+ source.puts "@end"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,82 @@
1
+ module Pod
2
+ module Generator
3
+
4
+ # Generates a prefix header file for a Pods library. The prefix header is
5
+ # generated according to the platform of the target and the pods.
6
+ #
7
+ # According to the platform the prefix header imports `UIKit/UIKit.h` or
8
+ # `Cocoa/Cocoa.h`.
9
+ #
10
+ class PrefixHeader
11
+
12
+ # @return [Platform] the platform for which the prefix header will be
13
+ # generated.
14
+ #
15
+ attr_reader :file_accessors
16
+ attr_reader :platform
17
+
18
+ # @return [Array<LocalPod>] the LocalPod for the target for which the
19
+ # prefix header needs to be generated.
20
+ #
21
+ # attr_reader :consumers
22
+
23
+ # @return [Array<String>] any header to import (with quotes).
24
+ #
25
+ attr_reader :imports
26
+
27
+ # @param [Platform] platform @see platform
28
+ # @param [Array<LocalPod>] consumers @see consumers
29
+ #
30
+ def initialize(file_accessors, platform)
31
+ @file_accessors = file_accessors
32
+ @platform = platform
33
+ @imports = []
34
+ end
35
+
36
+ # Generates the contents of the prefix header according to the platform
37
+ # and the pods.
38
+ #
39
+ # @note If the platform is iOS an import call to `UIKit/UIKit.h` is
40
+ # added to the top of the prefix header. For OS X `Cocoa/Cocoa.h`
41
+ # is imported.
42
+ #
43
+ # @return [String]
44
+ #
45
+ # @todo Subspecs can specify prefix header information too.
46
+ #
47
+ def generate
48
+ result = "#ifdef __OBJC__\n"
49
+ result << "#import #{platform == :ios ? '<UIKit/UIKit.h>' : '<Cocoa/Cocoa.h>'}\n"
50
+ result << "#endif\n"
51
+
52
+ imports.each do |import|
53
+ result << %|\n#import "#{import}"|
54
+ end
55
+
56
+ file_accessors.each do |file_accessor|
57
+ result << "\n"
58
+ if prefix_header_contents = file_accessor.spec_consumer.prefix_header_contents
59
+ result << prefix_header_contents
60
+ result << "\n"
61
+ end
62
+ if prefix_header = file_accessor.prefix_header
63
+ result << Pathname(prefix_header).read
64
+ end
65
+ end
66
+ result
67
+ end
68
+
69
+ # Generates and saves the prefix header to the given path.
70
+ #
71
+ # @param [Pathname] path
72
+ # the path where the prefix header should be stored.
73
+ #
74
+ # @return [void]
75
+ #
76
+ def save_as(path)
77
+ path.open('w') { |header| header.write(generate) }
78
+ end
79
+
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,86 @@
1
+ module Pod
2
+ module Generator
3
+
4
+ # Generates a header which allows to inspect at compile time the installed
5
+ # pods and the installed specifications of a pod.
6
+ #
7
+ # Example output:
8
+ #
9
+ # #define COCOAPODS_POD_AVAILABLE_ObjectiveSugar 1
10
+ # #define COCOAPODS_VERSION_MAJOR_ObjectiveSugar 0
11
+ # #define COCOAPODS_VERSION_MINOR_ObjectiveSugar 6
12
+ # #define COCOAPODS_VERSION_PATCH_ObjectiveSugar 2
13
+ #
14
+ # Example usage:
15
+ #
16
+ # #ifdef COCOAPODS
17
+ # #ifdef COCOAPODS_POD_AVAILABLE_ObjectiveSugar
18
+ # #import "ObjectiveSugar.h"
19
+ # #endif
20
+ # #else
21
+ # // Non CocoaPods code
22
+ # #endif
23
+ #
24
+ class TargetEnvironmentHeader
25
+
26
+ # @return [Array<LocalPod>] the specifications installed for the target.
27
+ #
28
+ attr_reader :specs
29
+
30
+ # @param [Array<LocalPod>] pods @see pods
31
+ #
32
+ def initialize(specs)
33
+ @specs = specs
34
+ end
35
+
36
+ # Generates and saves the file.
37
+ #
38
+ # @param [Pathname] pathname
39
+ # The path where to save the generated file.
40
+ #
41
+ # @return [void]
42
+ #
43
+ def save_as(pathname)
44
+ pathname.open('w') do |source|
45
+ source.puts
46
+ source.puts "// To check if a library is compiled with CocoaPods you"
47
+ source.puts "// can use the `COCOAPODS` macro definition which is"
48
+ source.puts "// defined in the xcconfigs so it is available in"
49
+ source.puts "// headers also when they are imported in the client"
50
+ source.puts "// project."
51
+ source.puts
52
+ source.puts
53
+ specs.each do |spec|
54
+ spec_name = safe_spec_name(spec.name)
55
+ source.puts "// #{spec.name}"
56
+ source.puts "#define COCOAPODS_POD_AVAILABLE_#{spec_name}"
57
+ if spec.version.semantic?
58
+ source.puts "#define COCOAPODS_VERSION_MAJOR_#{spec_name} #{spec.version.major}"
59
+ source.puts "#define COCOAPODS_VERSION_MINOR_#{spec_name} #{spec.version.minor}"
60
+ source.puts "#define COCOAPODS_VERSION_PATCH_#{spec_name} #{spec.version.patch}"
61
+ else
62
+ source.puts "// This library does not follow semantic-versioning,"
63
+ source.puts "// so we were not able to define version macros."
64
+ source.puts "// Please contact the author."
65
+ source.puts "// Version: #{spec.version}."
66
+ end
67
+ source.puts
68
+ end
69
+ end
70
+ end
71
+
72
+ #-----------------------------------------------------------------------#
73
+
74
+ private
75
+
76
+ # !@group Private Helpers
77
+
78
+ def safe_spec_name(spec_name)
79
+ spec_name.gsub(/[^\w]/,'_')
80
+ end
81
+
82
+ #-----------------------------------------------------------------------#
83
+
84
+ end
85
+ end
86
+ end