cocoapods 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -4
- data/lib/cocoapods.rb +18 -15
- data/lib/cocoapods/bridge_support_generator.rb +25 -0
- data/lib/cocoapods/command/install.rb +2 -4
- data/lib/cocoapods/command/spec.rb +1 -1
- data/lib/cocoapods/config.rb +23 -1
- data/lib/cocoapods/downloader.rb +7 -1
- data/lib/cocoapods/executable.rb +2 -0
- data/lib/cocoapods/installer.rb +38 -34
- data/lib/cocoapods/podfile.rb +99 -0
- data/lib/cocoapods/resolver.rb +14 -1
- data/lib/cocoapods/specification.rb +98 -55
- data/lib/cocoapods/specification/set.rb +2 -1
- data/lib/cocoapods/xcode/copy_resources_script.rb +21 -0
- data/lib/cocoapods/xcode/project.rb +266 -111
- data/xcode-project-templates/cocoa-static-library/Pods-Prefix.pch +7 -0
- data/xcode-project-templates/cocoa-static-library/Pods.xcconfig +1 -0
- data/xcode-project-templates/cocoa-static-library/Pods.xcodeproj/project.pbxproj +236 -0
- data/xcode-project-templates/cocoa-static-library/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/xcode-project-templates/cocoa-static-library/PodsResources.sh +8 -0
- data/xcode-project-templates/cocoa-touch-static-library/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- data/xcode-project-templates/cocoa-touch-static-library/PodsResources.sh +8 -0
- metadata +17 -10
data/README.md
CHANGED
@@ -20,9 +20,6 @@ For more in depth information see the [wiki][wiki], specifically the page about
|
|
20
20
|
[creating a project that uses CocoaPods][wiki-create].
|
21
21
|
|
22
22
|
|
23
|
-
**_NOTE: At the moment [only iOS projects are supported][ticket], but this will
|
24
|
-
be fixed in the very near future._**
|
25
|
-
|
26
23
|
## Installing CocoaPods
|
27
24
|
|
28
25
|
You’ll need MacRuby. CocoaPods itself installs through RubyGems, the Ruby
|
@@ -81,7 +78,6 @@ for more info.
|
|
81
78
|
[cocoapods]: https://github.com/alloy/cocoapods
|
82
79
|
[cocoapods-specs]: https://github.com/alloy/cocoapods-specs
|
83
80
|
[tickets]: https://github.com/alloy/cocoapods/issues
|
84
|
-
[ticket]: https://github.com/alloy/cocoapods/issues/3
|
85
81
|
[example-spec]: https://github.com/alloy/cocoapods/blob/master/examples/PodSpec.podspec
|
86
82
|
[dev-setup]: https://github.com/alloy/cocoapods/wiki/Setting-up-for-development-on-CocoaPods
|
87
83
|
[wiki-create]: https://github.com/alloy/cocoapods/wiki/Creating-a-project-that-uses-CocoaPods
|
data/lib/cocoapods.rb
CHANGED
@@ -1,27 +1,30 @@
|
|
1
1
|
module Pod
|
2
|
-
VERSION = '0.0
|
2
|
+
VERSION = '0.1.0'
|
3
3
|
|
4
4
|
class Informative < StandardError
|
5
5
|
end
|
6
6
|
|
7
|
-
autoload :
|
8
|
-
autoload :
|
9
|
-
autoload :
|
10
|
-
autoload :
|
11
|
-
autoload :
|
12
|
-
autoload :
|
13
|
-
autoload :
|
14
|
-
autoload :
|
15
|
-
autoload :
|
16
|
-
autoload :
|
17
|
-
autoload :
|
7
|
+
autoload :BridgeSupportGenerator, 'cocoapods/bridge_support_generator'
|
8
|
+
autoload :Command, 'cocoapods/command'
|
9
|
+
autoload :Config, 'cocoapods/config'
|
10
|
+
autoload :Dependency, 'cocoapods/dependency'
|
11
|
+
autoload :Downloader, 'cocoapods/downloader'
|
12
|
+
autoload :Executable, 'cocoapods/executable'
|
13
|
+
autoload :Installer, 'cocoapods/installer'
|
14
|
+
autoload :Podfile, 'cocoapods/podfile'
|
15
|
+
autoload :Resolver, 'cocoapods/resolver'
|
16
|
+
autoload :Source, 'cocoapods/source'
|
17
|
+
autoload :Spec, 'cocoapods/specification'
|
18
|
+
autoload :Specification, 'cocoapods/specification'
|
19
|
+
autoload :Version, 'cocoapods/version'
|
18
20
|
|
19
21
|
module Xcode
|
20
|
-
autoload :Config,
|
21
|
-
autoload :
|
22
|
+
autoload :Config, 'cocoapods/xcode/config'
|
23
|
+
autoload :CopyResourcesScript, 'cocoapods/xcode/copy_resources_script'
|
24
|
+
autoload :Project, 'cocoapods/xcode/project'
|
22
25
|
end
|
23
26
|
|
24
|
-
autoload :Pathname,
|
27
|
+
autoload :Pathname, 'pathname'
|
25
28
|
end
|
26
29
|
|
27
30
|
class Pathname
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Pod
|
2
|
+
class BridgeSupportGenerator
|
3
|
+
include Config::Mixin
|
4
|
+
|
5
|
+
extend Executable
|
6
|
+
executable :gen_bridge_metadata
|
7
|
+
|
8
|
+
attr_reader :headers
|
9
|
+
|
10
|
+
def initialize(headers)
|
11
|
+
@headers = headers
|
12
|
+
end
|
13
|
+
|
14
|
+
def search_paths
|
15
|
+
@headers.map { |header| "-I '#{header.dirname}'" }.uniq
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_in(root)
|
19
|
+
puts "==> Generating BridgeSupport metadata file" unless config.silent?
|
20
|
+
file = root + "Pods.bridgesupport"
|
21
|
+
gen_bridge_metadata %{-c "#{search_paths.join(' ')}" -o '#{file}' '#{headers.join("' '")}'}
|
22
|
+
file
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -30,14 +30,12 @@ module Pod
|
|
30
30
|
spec = nil
|
31
31
|
if @podspec
|
32
32
|
if @podspec.exist?
|
33
|
-
spec = Specification.
|
33
|
+
spec = Specification.from_file(@podspec)
|
34
34
|
else
|
35
35
|
raise Informative, "The specified podspec `#{@podspec}' doesn't exist."
|
36
36
|
end
|
37
37
|
else
|
38
|
-
|
39
|
-
spec = Specification.from_podfile(config.project_podfile)
|
40
|
-
else
|
38
|
+
unless spec = config.rootspec
|
41
39
|
raise Informative, "No `Podfile' or `.podspec' file found in the current working directory."
|
42
40
|
end
|
43
41
|
end
|
data/lib/cocoapods/config.rb
CHANGED
@@ -10,7 +10,7 @@ module Pod
|
|
10
10
|
@instance = instance
|
11
11
|
end
|
12
12
|
|
13
|
-
attr_accessor :repos_dir, :project_pods_root, :clean, :verbose, :silent
|
13
|
+
attr_accessor :repos_dir, :project_pods_root, :rootspec, :clean, :verbose, :silent
|
14
14
|
alias_method :clean?, :clean
|
15
15
|
alias_method :verbose?, :verbose
|
16
16
|
alias_method :silent?, :silent
|
@@ -40,6 +40,28 @@ module Pod
|
|
40
40
|
@project_podfile
|
41
41
|
end
|
42
42
|
|
43
|
+
# Returns the spec at the pat returned from `project_podfile`.
|
44
|
+
def rootspec
|
45
|
+
unless @rootspec
|
46
|
+
if project_podfile
|
47
|
+
if project_podfile.basename.to_s == 'Podfile'
|
48
|
+
@rootspec = Podfile.from_file(project_podfile)
|
49
|
+
else
|
50
|
+
@rootspec = Specification.from_file(project_podfile)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
@rootspec
|
55
|
+
end
|
56
|
+
|
57
|
+
def ios?
|
58
|
+
rootspec.platform == :ios
|
59
|
+
end
|
60
|
+
|
61
|
+
def osx?
|
62
|
+
rootspec.platform == :osx
|
63
|
+
end
|
64
|
+
|
43
65
|
module Mixin
|
44
66
|
def config
|
45
67
|
Config.instance
|
data/lib/cocoapods/downloader.rb
CHANGED
@@ -47,8 +47,14 @@ module Pod
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
def clean
|
50
|
+
def clean(clean_paths = [])
|
51
51
|
(@pod_root + '.git').rmtree
|
52
|
+
clean_paths.each do |pattern|
|
53
|
+
pattern = @pod_root + pattern
|
54
|
+
pattern.glob.each do |path|
|
55
|
+
path.rmtree
|
56
|
+
end
|
57
|
+
end if clean_paths
|
52
58
|
end
|
53
59
|
end
|
54
60
|
end
|
data/lib/cocoapods/executable.rb
CHANGED
data/lib/cocoapods/installer.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
module Pod
|
2
|
-
# TODO the static library needs an extra xcconfig which sets the values from issue #1.
|
3
|
-
# Or we could edit the project.pbxproj file, but that seems like more work...
|
4
2
|
class Installer
|
5
3
|
include Config::Mixin
|
6
4
|
|
@@ -16,55 +14,44 @@ module Pod
|
|
16
14
|
dependent_specification_sets.reject(&:only_part_of_other_pod?)
|
17
15
|
end
|
18
16
|
|
19
|
-
def
|
20
|
-
|
21
|
-
build_specification_sets.each do |set|
|
22
|
-
spec = set.specification
|
23
|
-
source_files[spec.name] = []
|
24
|
-
spec.source_files.each do |pattern|
|
25
|
-
pattern = spec.pod_destroot + pattern
|
26
|
-
pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory?
|
27
|
-
pattern.glob.each do |file|
|
28
|
-
source_files[spec.name] << file.relative_path_from(config.project_pods_root)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
source_files
|
17
|
+
def build_specifications
|
18
|
+
build_specification_sets.map(&:specification)
|
33
19
|
end
|
34
20
|
|
35
21
|
def xcconfig
|
36
22
|
@xcconfig ||= Xcode::Config.new({
|
37
|
-
# In a workspace this is where the static library headers should be found
|
38
|
-
# We could also make this recursive, but let's let the user decide on that.
|
23
|
+
# In a workspace this is where the static library headers should be found.
|
39
24
|
'USER_HEADER_SEARCH_PATHS' => '"$(BUILT_PRODUCTS_DIR)/Pods"',
|
40
|
-
# search the user headers
|
41
25
|
'ALWAYS_SEARCH_USER_PATHS' => 'YES',
|
26
|
+
# This makes categories from static libraries work, which many libraries
|
27
|
+
# require, so we add these by default.
|
28
|
+
'OTHER_LDFLAGS' => '-ObjC -all_load',
|
42
29
|
})
|
43
30
|
end
|
44
31
|
|
45
32
|
def xcodeproj
|
46
|
-
@xcodeproj ||= Xcode::Project.
|
33
|
+
@xcodeproj ||= Xcode::Project.static_library(@specification.platform)
|
47
34
|
end
|
48
35
|
|
36
|
+
# TODO move xcconfig related code into the xcconfig method, like copy_resources_script and generate_bridge_support.
|
49
37
|
def generate_project
|
50
38
|
puts "==> Generating Xcode project and xcconfig" unless config.silent?
|
51
39
|
user_header_search_paths = []
|
52
|
-
|
53
|
-
spec = set.specification
|
40
|
+
build_specifications.each do |spec|
|
54
41
|
xcconfig.merge!(spec.xcconfig)
|
55
|
-
xcodeproj.
|
42
|
+
group = xcodeproj.add_pod_group(spec.name)
|
56
43
|
|
57
44
|
# Only add implementation files to the compile phase
|
58
45
|
spec.implementation_files.each do |file|
|
59
|
-
|
46
|
+
group.add_source_file(file, nil, spec.compiler_flags)
|
60
47
|
end
|
61
48
|
|
62
49
|
# Add header files to a `copy header build phase` for each destination
|
63
50
|
# directory in the pod's header directory.
|
64
|
-
|
65
|
-
|
51
|
+
spec.copy_header_mappings.each do |header_dir, files|
|
52
|
+
copy_phase = xcodeproj.add_copy_header_build_phase(spec.name, header_dir)
|
66
53
|
files.each do |file|
|
67
|
-
|
54
|
+
group.add_source_file(file, copy_phase)
|
68
55
|
end
|
69
56
|
end
|
70
57
|
|
@@ -74,16 +61,33 @@ module Pod
|
|
74
61
|
xcconfig.merge!('USER_HEADER_SEARCH_PATHS' => user_header_search_paths.sort.uniq.join(" "))
|
75
62
|
end
|
76
63
|
|
77
|
-
|
78
|
-
|
64
|
+
def copy_resources_script
|
65
|
+
@copy_resources_script ||= Xcode::CopyResourcesScript.new(build_specifications.map { |spec| spec.expanded_resources }.flatten)
|
66
|
+
end
|
67
|
+
|
68
|
+
def bridge_support_generator
|
69
|
+
BridgeSupportGenerator.new(build_specifications.map do |spec|
|
70
|
+
spec.header_files.map do |header|
|
71
|
+
config.project_pods_root + header
|
72
|
+
end
|
73
|
+
end.flatten)
|
74
|
+
end
|
75
|
+
|
79
76
|
def install!
|
80
77
|
puts "Installing dependencies of: #{@specification.defined_in_file}" unless config.silent?
|
81
|
-
|
82
|
-
set.specification.install!
|
83
|
-
end
|
78
|
+
build_specifications.each(&:install!)
|
84
79
|
generate_project
|
85
|
-
|
86
|
-
|
80
|
+
|
81
|
+
root = config.project_pods_root
|
82
|
+
xcodeproj.create_in(root)
|
83
|
+
xcconfig.create_in(root)
|
84
|
+
if @specification.generate_bridge_support?
|
85
|
+
path = bridge_support_generator.create_in(root)
|
86
|
+
copy_resources_script.resources << path.relative_path_from(config.project_pods_root)
|
87
|
+
end
|
88
|
+
copy_resources_script.create_in(root)
|
89
|
+
|
90
|
+
build_specifications.each(&:post_install)
|
87
91
|
end
|
88
92
|
end
|
89
93
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module Pod
|
2
|
+
class Podfile
|
3
|
+
def self.from_file(path)
|
4
|
+
podfile = Podfile.new do
|
5
|
+
eval(path.read, nil, path.to_s)
|
6
|
+
end
|
7
|
+
podfile.defined_in_file = path
|
8
|
+
podfile.validate!
|
9
|
+
podfile
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(&block)
|
13
|
+
@dependencies = []
|
14
|
+
instance_eval(&block)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Specifies the platform for which a static library should be build.
|
18
|
+
#
|
19
|
+
# This can be either `:osx` for Mac OS X applications, or `:ios` for iOS
|
20
|
+
# applications.
|
21
|
+
def platform(platform = nil)
|
22
|
+
platform ? @platform = platform : @platform
|
23
|
+
end
|
24
|
+
|
25
|
+
# Specifies a dependency of the project.
|
26
|
+
#
|
27
|
+
# A dependency requirement is defined by the name of the Pod and _optionally_
|
28
|
+
# a list of version requirements.
|
29
|
+
#
|
30
|
+
#
|
31
|
+
# When starting out with a project it is likely that you will want to use the
|
32
|
+
# latest version of a Pod. If this is the case, simply omit the version
|
33
|
+
# requirements.
|
34
|
+
#
|
35
|
+
# dependency 'SSZipArchive'
|
36
|
+
#
|
37
|
+
#
|
38
|
+
# Later on in the project you may want to freeze to a specific version of a
|
39
|
+
# Pod, in which case you can specify that version number.
|
40
|
+
#
|
41
|
+
# dependency 'Objection', '0.9'
|
42
|
+
#
|
43
|
+
#
|
44
|
+
# Besides no version, or a specific one, it is also possible to use operators:
|
45
|
+
#
|
46
|
+
# * `> 0.1` Any version higher than 0.1
|
47
|
+
# * `>= 0.1` Version 0.1 and any higher version
|
48
|
+
# * `< 0.1` Any version lower than 0.1
|
49
|
+
# * `<= 0.1` Version 0.1 and any lower version
|
50
|
+
# * `~> 0.1.2` Version 0.1.2 and the versions upto 0.2, not including 0.2
|
51
|
+
#
|
52
|
+
#
|
53
|
+
# Finally, a list of version requirements can be specified for even more fine
|
54
|
+
# grained control.
|
55
|
+
#
|
56
|
+
# For more information, regarding versioning policy, see:
|
57
|
+
#
|
58
|
+
# * http://semver.org
|
59
|
+
# * http://docs.rubygems.org/read/chapter/7
|
60
|
+
def dependency(name, *version_requirements)
|
61
|
+
@dependencies << Dependency.new(name, *version_requirements)
|
62
|
+
end
|
63
|
+
|
64
|
+
attr_reader :dependencies
|
65
|
+
|
66
|
+
# Specifies that a BridgeSupport metadata should be generated from the
|
67
|
+
# headers of all installed Pods.
|
68
|
+
#
|
69
|
+
# This is for scripting languages such as MacRuby, Nu, and JSCocoa, which use
|
70
|
+
# it to bridge types, functions, etc better.
|
71
|
+
def generate_bridge_support!
|
72
|
+
@generate_bridge_support = true
|
73
|
+
end
|
74
|
+
|
75
|
+
# This is to be compatible with a Specification for use in the Installer and
|
76
|
+
# Resolver.
|
77
|
+
|
78
|
+
def podfile?
|
79
|
+
true
|
80
|
+
end
|
81
|
+
|
82
|
+
attr_accessor :defined_in_file
|
83
|
+
|
84
|
+
def generate_bridge_support?
|
85
|
+
@generate_bridge_support
|
86
|
+
end
|
87
|
+
|
88
|
+
def dependency_by_name(name)
|
89
|
+
@dependencies.find { |d| d.name == name }
|
90
|
+
end
|
91
|
+
|
92
|
+
def validate!
|
93
|
+
lines = []
|
94
|
+
lines << "* the `platform` attribute should be either `:osx` or `:ios`" unless [:osx, :ios].include?(@platform)
|
95
|
+
lines << "* no dependencies were specified, which is, well, kinda pointless" if @dependencies.empty?
|
96
|
+
raise(Informative, (["The Podfile at `#{@defined_in_file}' is invalid:"] + lines).join("\n")) unless lines.empty?
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
data/lib/cocoapods/resolver.rb
CHANGED
@@ -12,13 +12,26 @@ module Pod
|
|
12
12
|
|
13
13
|
def find_dependency_sets(specification)
|
14
14
|
specification.dependencies.each do |dependency|
|
15
|
-
set =
|
15
|
+
set = find_dependency_set(dependency)
|
16
16
|
set.required_by(specification)
|
17
17
|
unless @sets.include?(set)
|
18
|
+
validate_platform!(set)
|
18
19
|
@sets << set
|
19
20
|
find_dependency_sets(set.specification)
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
24
|
+
|
25
|
+
def find_dependency_set(dependency)
|
26
|
+
Source.search(dependency)
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate_platform!(set)
|
30
|
+
spec = set.specification
|
31
|
+
unless spec.platform.nil? || spec.platform == @specification.platform
|
32
|
+
raise Informative, "The platform required by the Podfile (:#{@specification.platform}) " \
|
33
|
+
"does not match that of #{spec} (:#{spec.platform})"
|
34
|
+
end
|
35
|
+
end
|
23
36
|
end
|
24
37
|
end
|
@@ -1,21 +1,15 @@
|
|
1
1
|
module Pod
|
2
|
+
extend Config::Mixin
|
3
|
+
|
2
4
|
def self._eval_podspec(path)
|
3
5
|
eval(path.read, nil, path.to_s)
|
4
6
|
end
|
5
7
|
|
6
|
-
|
8
|
+
class Specification
|
7
9
|
autoload :Set, 'cocoapods/specification/set'
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
spec = new
|
12
|
-
spec.instance_eval(path.read)
|
13
|
-
spec.defined_in_file = path
|
14
|
-
spec
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.from_podspec(path)
|
11
|
+
# The file is expected to define and return a Pods::Specification.
|
12
|
+
def self.from_file(path)
|
19
13
|
spec = Pod._eval_podspec(path)
|
20
14
|
spec.defined_in_file = path
|
21
15
|
spec
|
@@ -70,17 +64,20 @@ module Pod
|
|
70
64
|
end
|
71
65
|
|
72
66
|
def source_files=(*patterns)
|
73
|
-
@source_files = patterns.flatten
|
67
|
+
@source_files = patterns.flatten
|
74
68
|
end
|
75
69
|
attr_reader :source_files
|
76
70
|
|
77
|
-
def
|
78
|
-
|
79
|
-
dep = Dependency.new(name, *version_requirements)
|
80
|
-
@dependencies << dep
|
81
|
-
dep
|
71
|
+
def resources=(*patterns)
|
72
|
+
@resources = patterns.flatten
|
82
73
|
end
|
83
|
-
attr_reader :
|
74
|
+
attr_reader :resources
|
75
|
+
alias_method :resource=, :resources=
|
76
|
+
|
77
|
+
def clean_paths=(*patterns)
|
78
|
+
@clean_paths = patterns.flatten.map { |p| Pathname.new(p) }
|
79
|
+
end
|
80
|
+
attr_reader :clean_paths
|
84
81
|
|
85
82
|
def xcconfig=(hash)
|
86
83
|
@xcconfig.merge!(hash)
|
@@ -95,7 +92,7 @@ module Pod
|
|
95
92
|
|
96
93
|
def libraries=(*libraries)
|
97
94
|
libraries.unshift('')
|
98
|
-
self.xcconfig = { 'OTHER_LDFLAGS' => libraries.join(' -l
|
95
|
+
self.xcconfig = { 'OTHER_LDFLAGS' => libraries.join(' -l').strip }
|
99
96
|
end
|
100
97
|
alias_method :library=, :libraries=
|
101
98
|
|
@@ -106,8 +103,6 @@ module Pod
|
|
106
103
|
@header_dir || pod_destroot_name
|
107
104
|
end
|
108
105
|
|
109
|
-
attr_accessor :requires_arc
|
110
|
-
|
111
106
|
attr_writer :compiler_flags
|
112
107
|
def compiler_flags
|
113
108
|
flags = "#{@compiler_flags} "
|
@@ -115,14 +110,31 @@ module Pod
|
|
115
110
|
flags
|
116
111
|
end
|
117
112
|
|
113
|
+
# These are attributes which are also on a Podfile
|
114
|
+
|
115
|
+
attr_accessor :platform
|
116
|
+
|
117
|
+
attr_accessor :requires_arc
|
118
|
+
|
119
|
+
attr_accessor :generate_bridge_support
|
120
|
+
alias_method :generate_bridge_support?, :generate_bridge_support
|
121
|
+
|
122
|
+
def dependency(*name_and_version_requirements)
|
123
|
+
name, *version_requirements = name_and_version_requirements.flatten
|
124
|
+
dep = Dependency.new(name, *version_requirements)
|
125
|
+
@dependencies << dep
|
126
|
+
dep
|
127
|
+
end
|
128
|
+
attr_reader :dependencies
|
129
|
+
|
118
130
|
# Not attributes
|
119
131
|
|
120
132
|
include Config::Mixin
|
121
133
|
|
122
134
|
def ==(other)
|
123
135
|
self.class === other &&
|
124
|
-
|
125
|
-
|
136
|
+
name && name == other.name &&
|
137
|
+
version && version == other.version
|
126
138
|
end
|
127
139
|
|
128
140
|
def dependency_by_name(name)
|
@@ -130,8 +142,8 @@ module Pod
|
|
130
142
|
end
|
131
143
|
|
132
144
|
def part_of_specification_set
|
133
|
-
if
|
134
|
-
Set.by_specification_name(
|
145
|
+
if part_of
|
146
|
+
Set.by_specification_name(part_of.name)
|
135
147
|
end
|
136
148
|
end
|
137
149
|
|
@@ -141,7 +153,6 @@ module Pod
|
|
141
153
|
end
|
142
154
|
|
143
155
|
def pod_destroot
|
144
|
-
return if from_podfile?
|
145
156
|
if part_of_other_pod?
|
146
157
|
part_of_specification.pod_destroot
|
147
158
|
else
|
@@ -156,17 +167,32 @@ module Pod
|
|
156
167
|
end
|
157
168
|
|
158
169
|
def part_of_other_pod?
|
159
|
-
|
170
|
+
!part_of.nil?
|
160
171
|
end
|
161
172
|
|
162
|
-
def
|
163
|
-
|
173
|
+
def podfile?
|
174
|
+
false
|
164
175
|
end
|
165
176
|
|
166
|
-
# Returns all
|
177
|
+
# Returns all resource files of this pod, but relative to the
|
178
|
+
# project pods root.
|
179
|
+
def expanded_resources
|
180
|
+
files = []
|
181
|
+
[*resources].each do |pattern|
|
182
|
+
pattern = pod_destroot + pattern
|
183
|
+
pattern = pattern + '*' if pattern.directory?
|
184
|
+
pattern.glob.each do |file|
|
185
|
+
files << file.relative_path_from(config.project_pods_root)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
files
|
189
|
+
end
|
190
|
+
|
191
|
+
# Returns all source files of this pod including header files,
|
192
|
+
# but relative to the project pods root.
|
167
193
|
def expanded_source_files
|
168
194
|
files = []
|
169
|
-
source_files.each do |pattern|
|
195
|
+
[*source_files].each do |pattern|
|
170
196
|
pattern = pod_destroot + pattern
|
171
197
|
pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory?
|
172
198
|
pattern.glob.each do |file|
|
@@ -215,11 +241,7 @@ module Pod
|
|
215
241
|
end
|
216
242
|
|
217
243
|
def to_s
|
218
|
-
|
219
|
-
"podfile at `#{@defined_in_file}'"
|
220
|
-
else
|
221
|
-
"`#{@name}' version `#{@version}'"
|
222
|
-
end
|
244
|
+
"`#{name}' version `#{version}'"
|
223
245
|
end
|
224
246
|
|
225
247
|
def inspect
|
@@ -227,18 +249,24 @@ module Pod
|
|
227
249
|
end
|
228
250
|
|
229
251
|
def validate!
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
252
|
+
missing = []
|
253
|
+
missing << "`name'" unless name
|
254
|
+
missing << "`version'" unless version
|
255
|
+
missing << "`summary'" unless summary
|
256
|
+
missing << "`homepage'" unless homepage
|
257
|
+
missing << "`author(s)'" unless authors
|
258
|
+
missing << "either `source' or `part_of'" unless source || part_of
|
259
|
+
missing << "`source_files'" unless source_files
|
260
|
+
|
261
|
+
incorrect = []
|
262
|
+
allowed = [nil, :ios, :osx]
|
263
|
+
incorrect << ["`platform'", allowed] unless allowed.include?(platform)
|
264
|
+
|
265
|
+
unless missing.empty? && incorrect.empty?
|
266
|
+
message = "The following #{(missing + incorrect).size == 1 ? 'attribute is' : 'attributes are'}:\n"
|
267
|
+
message << "* missing: #{missing.join(", ")}" unless missing.empty?
|
268
|
+
message << "* incorrect: #{incorrect.map { |x| "#{x[0]} (#{x[1..-1]})" }.join(", ")}" unless incorrect.empty?
|
269
|
+
raise Informative, message
|
242
270
|
end
|
243
271
|
end
|
244
272
|
|
@@ -249,8 +277,8 @@ module Pod
|
|
249
277
|
# Override this if you need to perform work before or after activating the
|
250
278
|
# pod. Eg:
|
251
279
|
#
|
252
|
-
# Pod::Spec.new do
|
253
|
-
# def install!
|
280
|
+
# Pod::Spec.new do |s|
|
281
|
+
# def s.install!
|
254
282
|
# # pre-install
|
255
283
|
# super
|
256
284
|
# # post-install
|
@@ -260,7 +288,7 @@ module Pod
|
|
260
288
|
puts "==> Installing: #{self}" unless config.silent?
|
261
289
|
config.project_pods_root.mkpath
|
262
290
|
require 'fileutils'
|
263
|
-
FileUtils.cp(
|
291
|
+
FileUtils.cp(defined_in_file, config.project_pods_root)
|
264
292
|
|
265
293
|
# In case this spec is part of another pod's source, we need to dowload
|
266
294
|
# the other pod's source.
|
@@ -282,17 +310,32 @@ module Pod
|
|
282
310
|
# Override this if you need to perform work before or after downloading the
|
283
311
|
# pod, or if you need to implement custom dowloading. Eg:
|
284
312
|
#
|
285
|
-
# Pod::Spec.new do
|
286
|
-
# def download!
|
313
|
+
# Pod::Spec.new do |s|
|
314
|
+
# def s.download!
|
287
315
|
# # pre-download
|
288
316
|
# super # or custom downloading
|
289
317
|
# # post-download
|
290
318
|
# end
|
291
319
|
# end
|
292
320
|
def download!
|
293
|
-
downloader = Downloader.for_source(pod_destroot,
|
321
|
+
downloader = Downloader.for_source(pod_destroot, source)
|
294
322
|
downloader.download
|
295
|
-
downloader.clean if config.clean
|
323
|
+
downloader.clean(clean_paths) if config.clean
|
324
|
+
end
|
325
|
+
|
326
|
+
# This is a convenience method which gets called after all pods have been
|
327
|
+
# downloaded, installed, and the Xcode project and related files have been
|
328
|
+
# generated. Override this to, for instance, add to the prefix header:
|
329
|
+
#
|
330
|
+
# Pod::Spec.new do |s|
|
331
|
+
# def s.post_install
|
332
|
+
# prefix_header = config.project_pods_root + 'Pods-Prefix.pch'
|
333
|
+
# prefix_header.open('a') do |file|
|
334
|
+
# file.puts(%{#ifdef __OBJC__\n#import "SSToolkitDefines.h"\n#endif})
|
335
|
+
# end
|
336
|
+
# end
|
337
|
+
# end
|
338
|
+
def post_install
|
296
339
|
end
|
297
340
|
|
298
341
|
end
|