cocoapods 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cocoapods.rb +1 -1
- data/lib/cocoapods/command/install.rb +17 -23
- data/lib/cocoapods/command/setup.rb +10 -3
- data/lib/cocoapods/command/spec.rb +69 -6
- data/lib/cocoapods/downloader.rb +14 -43
- data/lib/cocoapods/downloader/git.rb +46 -0
- data/lib/cocoapods/downloader/mercurial.rb +30 -0
- data/lib/cocoapods/downloader/subversion.rb +29 -0
- data/lib/cocoapods/executable.rb +7 -3
- data/lib/cocoapods/installer.rb +3 -3
- data/lib/cocoapods/podfile.rb +11 -1
- metadata +5 -2
data/lib/cocoapods.rb
CHANGED
@@ -2,15 +2,18 @@ module Pod
|
|
2
2
|
class Command
|
3
3
|
class Install < Command
|
4
4
|
def self.banner
|
5
|
-
%{Installing dependencies of a
|
5
|
+
%{Installing dependencies of a project:
|
6
6
|
|
7
|
-
$ pod install [
|
7
|
+
$ pod install [PROJECT]
|
8
8
|
|
9
|
-
Downloads all dependencies
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
Downloads all dependencies defined in `Podfile' and creates an Xcode
|
10
|
+
Pods library project in `./Pods'.
|
11
|
+
|
12
|
+
In case `PROJECT' is given, it configures it to use the specified Pods
|
13
|
+
and generates a workspace with the Pods project and `PROJECT'. (It is
|
14
|
+
important that once you have run this you open the workspace instead of
|
15
|
+
`PROJECT'.) You usually specify `PROJECT' only the first time that you
|
16
|
+
run `pod install'.
|
14
17
|
}
|
15
18
|
end
|
16
19
|
|
@@ -21,27 +24,18 @@ module Pod
|
|
21
24
|
|
22
25
|
def initialize(argv)
|
23
26
|
config.clean = !argv.option('--no-clean')
|
24
|
-
projpath = argv.shift_argument
|
25
|
-
projpath =~ /\.xcodeproj\/?$/ ? @projpath = projpath : podspec = projpath
|
26
|
-
@podspec = Pathname.new(podspec) if podspec
|
27
|
-
@projpath ||= argv.shift_argument
|
27
|
+
@projpath = argv.shift_argument
|
28
28
|
super unless argv.empty?
|
29
29
|
end
|
30
30
|
|
31
31
|
def run
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
raise Informative, "The specified podspec `#{@podspec}' doesn't exist."
|
38
|
-
end
|
39
|
-
else
|
40
|
-
unless spec = config.rootspec
|
41
|
-
raise Informative, "No `Podfile' or `.podspec' file found in the current working directory."
|
42
|
-
end
|
32
|
+
unless podfile = config.rootspec
|
33
|
+
raise Informative, "No `Podfile' found in the current working directory."
|
34
|
+
end
|
35
|
+
if @projpath && !File.exist?(@projpath)
|
36
|
+
raise Informative, "The specified project `#{@projpath}' does not exist."
|
43
37
|
end
|
44
|
-
installer = Installer.new(
|
38
|
+
installer = Installer.new(podfile)
|
45
39
|
installer.install!
|
46
40
|
installer.configure_project(@projpath) if @projpath
|
47
41
|
end
|
@@ -11,8 +11,7 @@ module Pod
|
|
11
11
|
|
12
12
|
https://github.com/CocoaPods/Specs
|
13
13
|
|
14
|
-
If the clone already exists, it will ensure that it
|
15
|
-
remote.}
|
14
|
+
If the clone already exists, it will ensure that it is up-to-date.}
|
16
15
|
end
|
17
16
|
|
18
17
|
def initialize(argv)
|
@@ -28,15 +27,23 @@ module Pod
|
|
28
27
|
end
|
29
28
|
|
30
29
|
def update_master_repo_remote_command
|
31
|
-
|
30
|
+
Repo.new(ARGV.new(['set-url', 'master', master_repo_url]))
|
31
|
+
end
|
32
|
+
|
33
|
+
def update_master_repo_command
|
34
|
+
Repo.new(ARGV.new(['update', 'master']))
|
32
35
|
end
|
33
36
|
|
34
37
|
def run
|
35
38
|
if (config.repos_dir + 'master').exist?
|
36
39
|
update_master_repo_remote_command.run
|
40
|
+
update_master_repo_command.run
|
37
41
|
else
|
38
42
|
add_master_repo_command.run
|
39
43
|
end
|
44
|
+
hook = config.repos_dir + 'master/.git/hooks/pre-commit'
|
45
|
+
hook.open('w') { |f| f << "#!/bin/sh\nrake lint" }
|
46
|
+
`chmod +x '#{hook}'`
|
40
47
|
end
|
41
48
|
end
|
42
49
|
end
|
@@ -31,24 +31,87 @@ module Pod
|
|
31
31
|
author = `git config --get user.name`.strip
|
32
32
|
email = `git config --get user.email`.strip
|
33
33
|
spec = <<-SPEC.gsub(/^ /, '')
|
34
|
+
#
|
35
|
+
# Be sure to run `pod lint #{@name}.podspec' to ensure this is a
|
36
|
+
# valid spec.
|
37
|
+
#
|
38
|
+
# Remove all comments before submitting the spec.
|
39
|
+
#
|
34
40
|
Pod::Spec.new do |s|
|
35
41
|
s.name = '#{@name}'
|
36
42
|
s.version = '1.0.0'
|
37
43
|
s.license = 'MIT'
|
38
44
|
s.summary = 'A short description of #{@name}.'
|
39
|
-
s.homepage = 'http://
|
45
|
+
s.homepage = 'http://EXAMPLE/#{@name}'
|
40
46
|
s.author = { '#{author}' => '#{email}' }
|
41
|
-
|
47
|
+
|
48
|
+
# Specify the location from where the source should be retreived.
|
49
|
+
#
|
50
|
+
s.source = { :git => 'http://EXAMPLE/#{@name}.git', :tag => '1.0.0' }
|
51
|
+
# s.source = { :svn => 'http://EXAMPLE/#{@name}/tags/1.0.0' }
|
52
|
+
# s.source = { :hg => 'http://EXAMPLE/#{@name}', :revision => '1.0.0' }
|
42
53
|
|
43
54
|
s.description = 'An optional longer description of #{@name}.'
|
44
55
|
|
45
|
-
#
|
46
|
-
#
|
56
|
+
# If this Pod runs only on iOS or OS X, then specify that with one of
|
57
|
+
# these, or none if it runs on both platforms.
|
58
|
+
#
|
59
|
+
# s.platform = :ios
|
60
|
+
# s.platform = :osx
|
61
|
+
|
62
|
+
# A list of file patterns which select the source files that should be
|
63
|
+
# added to the Pods project. If the pattern is a directory then the
|
64
|
+
# path will automatically have '*.{h,m,mm,c,cpp}' appended.
|
65
|
+
#
|
66
|
+
# Alternatively, you can use the FileList class for even more control
|
67
|
+
# over the selected files.
|
68
|
+
# (See http://rake.rubyforge.org/classes/Rake/FileList.html.)
|
69
|
+
#
|
47
70
|
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
|
48
71
|
|
49
|
-
|
72
|
+
# A list of resources included with the Pod. These are copied into the
|
73
|
+
# target bundle with a build phase script.
|
74
|
+
#
|
75
|
+
# Also allows the use of the FileList class like `source_files does.
|
76
|
+
#
|
77
|
+
# s.resource = "icon.png"
|
78
|
+
# s.resources = "Resources/*.png"
|
79
|
+
|
80
|
+
# A list of paths to remove after installing the Pod without the
|
81
|
+
# `--no-clean' option. These can be examples, docs, and any other type
|
82
|
+
# of files that are not needed to build the Pod.
|
83
|
+
#
|
84
|
+
# *NOTE*: Never remove license and README files.
|
85
|
+
#
|
86
|
+
# Also allows the use of the FileList class like `source_files does.
|
87
|
+
#
|
88
|
+
# s.clean_path = "examples"
|
89
|
+
# s.clean_paths = "examples", "doc"
|
90
|
+
|
91
|
+
# Specify a list of frameworks that the application needs to link
|
92
|
+
# against for this Pod to work.
|
93
|
+
#
|
94
|
+
# s.framework = 'SomeFramework'
|
95
|
+
# s.frameworks = 'SomeFramework', 'AnotherFramework'
|
96
|
+
|
97
|
+
# Specify a list of libraries that the application needs to link
|
98
|
+
# against for this Pod to work.
|
99
|
+
#
|
100
|
+
# s.library = 'iconv'
|
101
|
+
# s.libraries = 'iconv', 'xml2'
|
102
|
+
|
103
|
+
# If this Pod uses ARC, specify it like so.
|
104
|
+
#
|
105
|
+
# s.requires_arc = true
|
106
|
+
|
107
|
+
# If you need to specify any other build settings, add them to the
|
108
|
+
# xcconfig hash.
|
109
|
+
#
|
110
|
+
# s.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2' }
|
50
111
|
|
51
|
-
|
112
|
+
# Finally, specify any Pods that this Pod depends on.
|
113
|
+
#
|
114
|
+
# s.dependency 'JSONKit', '~> 1.4'
|
52
115
|
end
|
53
116
|
SPEC
|
54
117
|
(Pathname.pwd + "#{@name}.podspec").open('w') { |f| f << spec }
|
data/lib/cocoapods/downloader.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
module Pod
|
2
2
|
class Downloader
|
3
|
+
autoload :Git, 'cocoapods/downloader/git'
|
4
|
+
autoload :Mercurial, 'cocoapods/downloader/mercurial'
|
5
|
+
autoload :Subversion, 'cocoapods/downloader/subversion'
|
6
|
+
|
7
|
+
extend Executable
|
8
|
+
|
3
9
|
def self.for_source(pod_root, source)
|
4
10
|
options = source.dup
|
5
11
|
if url = options.delete(:git)
|
6
12
|
Git.new(pod_root, url, options)
|
13
|
+
elsif url = options.delete(:hg)
|
14
|
+
Mercurial.new(pod_root, url, options)
|
15
|
+
elsif url = options.delete(:svn)
|
16
|
+
Subversion.new(pod_root, url, options)
|
7
17
|
else
|
8
18
|
raise "Unsupported download strategy `#{source.inspect}'."
|
9
19
|
end
|
@@ -15,49 +25,10 @@ module Pod
|
|
15
25
|
@pod_root, @url, @options = pod_root, url, options
|
16
26
|
end
|
17
27
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
def download
|
23
|
-
@pod_root.dirname.mkpath
|
24
|
-
if @options[:tag]
|
25
|
-
download_tag
|
26
|
-
elsif @options[:commit]
|
27
|
-
download_commit
|
28
|
-
else
|
29
|
-
download_head
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def download_head
|
34
|
-
git "clone '#{@url}' '#{@pod_root}'"
|
35
|
-
end
|
36
|
-
|
37
|
-
def download_tag
|
38
|
-
@pod_root.mkpath
|
39
|
-
Dir.chdir(@pod_root) do
|
40
|
-
git "init"
|
41
|
-
git "remote add origin '#{@url}'"
|
42
|
-
git "fetch origin tags/#{@options[:tag]}"
|
43
|
-
git "reset --hard FETCH_HEAD"
|
44
|
-
git "checkout -b activated-pod-commit"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def download_commit
|
49
|
-
git "clone '#{@url}' '#{@pod_root}'"
|
50
|
-
Dir.chdir(@pod_root) do
|
51
|
-
git "checkout -b activated-pod-commit #{@options[:commit]}"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def clean(clean_paths = [])
|
56
|
-
(@pod_root + '.git').rmtree
|
57
|
-
clean_paths.each do |path|
|
58
|
-
path.rmtree
|
59
|
-
end if clean_paths
|
60
|
-
end
|
28
|
+
def clean(clean_paths = [])
|
29
|
+
clean_paths.each do |path|
|
30
|
+
path.rmtree
|
31
|
+
end if clean_paths
|
61
32
|
end
|
62
33
|
end
|
63
34
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Pod
|
2
|
+
class Downloader
|
3
|
+
class Git < Downloader
|
4
|
+
executable :git
|
5
|
+
|
6
|
+
def download
|
7
|
+
@pod_root.dirname.mkpath
|
8
|
+
if @options[:tag]
|
9
|
+
download_tag
|
10
|
+
elsif @options[:commit]
|
11
|
+
download_commit
|
12
|
+
else
|
13
|
+
download_head
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def download_head
|
18
|
+
git "clone '#{@url}' '#{@pod_root}'"
|
19
|
+
end
|
20
|
+
|
21
|
+
def download_tag
|
22
|
+
@pod_root.mkpath
|
23
|
+
Dir.chdir(@pod_root) do
|
24
|
+
git "init"
|
25
|
+
git "remote add origin '#{@url}'"
|
26
|
+
git "fetch origin tags/#{@options[:tag]}"
|
27
|
+
git "reset --hard FETCH_HEAD"
|
28
|
+
git "checkout -b activated-pod-commit"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def download_commit
|
33
|
+
git "clone '#{@url}' '#{@pod_root}'"
|
34
|
+
Dir.chdir(@pod_root) do
|
35
|
+
git "checkout -b activated-pod-commit #{@options[:commit]}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def clean(clean_paths = [])
|
40
|
+
super
|
41
|
+
(@pod_root + '.git').rmtree
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Pod
|
2
|
+
class Downloader
|
3
|
+
class Mercurial < Downloader
|
4
|
+
executable :hg
|
5
|
+
|
6
|
+
def download
|
7
|
+
@pod_root.dirname.mkpath
|
8
|
+
if @options[:revision]
|
9
|
+
download_revision
|
10
|
+
else
|
11
|
+
download_head
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def download_head
|
16
|
+
hg "clone '#{@url}' '#{@pod_root}'"
|
17
|
+
end
|
18
|
+
|
19
|
+
def download_revision
|
20
|
+
hg "clone '#{@url}' --rev '#{@options[:revision]}' '#{@pod_root}'"
|
21
|
+
end
|
22
|
+
|
23
|
+
def clean(clean_paths = [])
|
24
|
+
super
|
25
|
+
(@pod_root + '.hg').rmtree
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Pod
|
2
|
+
class Downloader
|
3
|
+
class Subversion < Downloader
|
4
|
+
executable :svn
|
5
|
+
|
6
|
+
def download
|
7
|
+
@pod_root.dirname.mkpath
|
8
|
+
if @options[:revision]
|
9
|
+
download_revision
|
10
|
+
else
|
11
|
+
download_head
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def download_head
|
16
|
+
svn "checkout '#{@url}' '#{@pod_root}'"
|
17
|
+
end
|
18
|
+
|
19
|
+
def download_revision
|
20
|
+
svn "checkout '#{@url}' -r '#{@options[:revision]}' '#{@pod_root}'"
|
21
|
+
end
|
22
|
+
|
23
|
+
def clean(clean_paths = [])
|
24
|
+
super
|
25
|
+
@pod_root.glob('**/.svn').each(&:rmtree)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/cocoapods/executable.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
module Pod
|
2
2
|
module Executable
|
3
3
|
def executable(name)
|
4
|
+
bin = `which #{name}`.strip
|
4
5
|
define_method(name) do |command|
|
6
|
+
if bin.empty?
|
7
|
+
raise Informative, "Unable to locate the executable `#{name}'"
|
8
|
+
end
|
5
9
|
if Config.instance.verbose?
|
6
|
-
puts "#{
|
7
|
-
`#{
|
10
|
+
puts "#{bin} #{command}"
|
11
|
+
`#{bin} #{command} 1>&2`
|
8
12
|
else
|
9
|
-
`#{
|
13
|
+
`#{bin} #{command} 2> /dev/null`
|
10
14
|
end
|
11
15
|
end
|
12
16
|
private name
|
data/lib/cocoapods/installer.rb
CHANGED
@@ -18,7 +18,7 @@ module Pod
|
|
18
18
|
include Config::Mixin
|
19
19
|
include Shared
|
20
20
|
|
21
|
-
attr_reader :target
|
21
|
+
attr_reader :podfile, :project, :definition, :target
|
22
22
|
|
23
23
|
def initialize(podfile, project, definition)
|
24
24
|
@podfile, @project, @definition = podfile, project, definition
|
@@ -163,8 +163,8 @@ module Pod
|
|
163
163
|
|
164
164
|
def target_installers
|
165
165
|
@target_installers ||= @podfile.target_definitions.values.map do |definition|
|
166
|
-
TargetInstaller.new(@podfile, project, definition)
|
167
|
-
end
|
166
|
+
TargetInstaller.new(@podfile, project, definition) unless definition.empty?
|
167
|
+
end.compact
|
168
168
|
end
|
169
169
|
|
170
170
|
def install!
|
data/lib/cocoapods/podfile.rb
CHANGED
@@ -8,7 +8,13 @@ module Pod
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def lib_name
|
11
|
-
name == :default
|
11
|
+
if name == :default
|
12
|
+
"Pods"
|
13
|
+
elsif @parent
|
14
|
+
"#{@parent.lib_name}-#{name}"
|
15
|
+
else
|
16
|
+
"Pods-#{name}"
|
17
|
+
end
|
12
18
|
end
|
13
19
|
|
14
20
|
# Returns *all* dependencies of this target, not only the target specific
|
@@ -16,6 +22,10 @@ module Pod
|
|
16
22
|
def dependencies
|
17
23
|
@target_dependencies + (@parent ? @parent.dependencies : [])
|
18
24
|
end
|
25
|
+
|
26
|
+
def empty?
|
27
|
+
target_dependencies.empty?
|
28
|
+
end
|
19
29
|
end
|
20
30
|
|
21
31
|
def self.from_file(path)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 5
|
9
|
+
version: 0.3.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Eloy Duran
|
@@ -53,6 +53,9 @@ files:
|
|
53
53
|
- lib/cocoapods/command.rb
|
54
54
|
- lib/cocoapods/config.rb
|
55
55
|
- lib/cocoapods/dependency.rb
|
56
|
+
- lib/cocoapods/downloader/git.rb
|
57
|
+
- lib/cocoapods/downloader/mercurial.rb
|
58
|
+
- lib/cocoapods/downloader/subversion.rb
|
56
59
|
- lib/cocoapods/downloader.rb
|
57
60
|
- lib/cocoapods/executable.rb
|
58
61
|
- lib/cocoapods/file_list.rb
|