cocoapods 0.32.1 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +97 -1
- data/lib/cocoapods/command.rb +4 -10
- data/lib/cocoapods/command/help.rb +3 -1
- data/lib/cocoapods/command/init.rb +3 -1
- data/lib/cocoapods/command/inter_process_communication.rb +9 -5
- data/lib/cocoapods/command/lib.rb +4 -1
- data/lib/cocoapods/command/outdated.rb +64 -15
- data/lib/cocoapods/command/project.rb +9 -7
- data/lib/cocoapods/command/push.rb +5 -160
- data/lib/cocoapods/command/repo.rb +15 -4
- data/lib/cocoapods/command/repo/push.rb +199 -0
- data/lib/cocoapods/command/search.rb +3 -1
- data/lib/cocoapods/command/spec.rb +16 -6
- data/lib/cocoapods/executable.rb +1 -1
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/installer.rb +31 -65
- data/lib/cocoapods/installer/user_project_integrator.rb +7 -6
- data/lib/cocoapods/sources_manager.rb +28 -5
- data/lib/cocoapods/user_interface.rb +2 -2
- data/lib/cocoapods/user_interface/error_report.rb +15 -1
- data/lib/cocoapods/validator.rb +24 -27
- metadata +85 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff40392dc1f5d3bf6a6bb31da9a0682506d65859
|
4
|
+
data.tar.gz: 044a9e333d0eeee8ddf5b3334e1879d22dfc1322
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dad9e16a494562952e401a0c350aaa0225707cea4314e870aa314cc7b5283d66d7d662c01eb8f07d17a2c9e2e27b7a770c6f9b38e5741dfaaee208e6f9b33b9c
|
7
|
+
data.tar.gz: 8ebab7ed68083acd1c4d52f988a120ab920e1b70ce878dc11b5104cf66309a6d4335b3a2e3b88cfb99e06ced4e18d59888c7cc8165656e89cfb2a2733401f5ea
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,97 @@
|
|
2
2
|
|
3
3
|
To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides/installing_cocoapods.html).
|
4
4
|
|
5
|
+
## 0.33.0
|
6
|
+
|
7
|
+
##### Breaking
|
8
|
+
|
9
|
+
* The deprecated `pre_install` and the `pod_install` hooks of the specification
|
10
|
+
class have been removed.
|
11
|
+
[Fabio Pelosin][irrationalfab]
|
12
|
+
[#2151](https://github.com/CocoaPods/CocoaPods/issues/2151)
|
13
|
+
[#2153](https://github.com/CocoaPods/CocoaPods/pull/2153)
|
14
|
+
|
15
|
+
##### Enhancements
|
16
|
+
|
17
|
+
* Added the `cocoapods-trunk` plugin which introduces the `trunk` subcommand.
|
18
|
+
[Fabio Pelosin][irrationalfab]
|
19
|
+
[#2151](https://github.com/CocoaPods/CocoaPods/issues/2151)
|
20
|
+
[#2153](https://github.com/CocoaPods/CocoaPods/pull/2153)
|
21
|
+
|
22
|
+
* The `pod push` sub-command has been moved to the `pod repo push` sub-command.
|
23
|
+
Moreover pushing to the master repo from it has been disabled.
|
24
|
+
[Fabio Pelosin][irrationalfab]
|
25
|
+
[#2151](https://github.com/CocoaPods/CocoaPods/issues/2151)
|
26
|
+
[#2153](https://github.com/CocoaPods/CocoaPods/pull/2153)
|
27
|
+
|
28
|
+
* Overhauled command line interface. Add support for auto-completion script
|
29
|
+
(d). If auto-completion is enabled for your shell you can configure it for
|
30
|
+
CocoaPods with the following command:
|
31
|
+
|
32
|
+
rm -f /usr/local/share/zsh/site-functions/_pod
|
33
|
+
dpod --completion-script > /usr/local/share/zsh/site-functions/_pod
|
34
|
+
exec zsh
|
35
|
+
|
36
|
+
Currently only the Z shell is supported.
|
37
|
+
[Fabio Pelosin][irrationalfab]
|
38
|
+
[CLAide#25](https://github.com/CocoaPods/CLAide/issues/25)
|
39
|
+
[CLAide#20](https://github.com/CocoaPods/CLAide/issues/20)
|
40
|
+
[CLAide#19](https://github.com/CocoaPods/CLAide/issues/19)
|
41
|
+
[CLAide#17](https://github.com/CocoaPods/CLAide/issues/17)
|
42
|
+
[CLAide#12](https://github.com/CocoaPods/CLAide/issues/12)
|
43
|
+
|
44
|
+
* The `--version` flag is now only supported for the root `pod` command. If
|
45
|
+
used in conjunction with the `--verbose` flag the version of the detected
|
46
|
+
plugins will be printed as well.
|
47
|
+
[Fabio Pelosin][irrationalfab]
|
48
|
+
[CLAide#13](https://github.com/CocoaPods/CLAide/issues/13)
|
49
|
+
[CLAide#14](https://github.com/CocoaPods/CLAide/issues/14)
|
50
|
+
|
51
|
+
* The extremely meta `cocoaPods-plugins` is now installed by default providing
|
52
|
+
information about the available and the installed plug-ins.
|
53
|
+
[David Grandinetti](https://github.com/dbgrandi)
|
54
|
+
[Olivier Halligon](https://github.com/AliSoftware)
|
55
|
+
[Fabio Pelosin][irrationalfab]
|
56
|
+
[#2092](https://github.com/CocoaPods/CocoaPods/issues/2092)
|
57
|
+
|
58
|
+
* Validate the reachability of `social_media_url`, `documentation_url` and
|
59
|
+
`docset_url` in podspecs we while linting a specification.
|
60
|
+
[Kyle Fuller](https://github.com/kylef)
|
61
|
+
[#2025](https://github.com/CocoaPods/CocoaPods/issues/2025)
|
62
|
+
|
63
|
+
* Print the current version when the repo/lockfile requires a higher version.
|
64
|
+
[Samuel E. Giddins](https://github.com/segiddins)
|
65
|
+
[#2049](https://github.com/CocoaPods/CocoaPods/issues/2049)
|
66
|
+
|
67
|
+
* Show `help` when running the `pod` command instead of defaulting to `pod
|
68
|
+
install`.
|
69
|
+
[Kyle Fuller](https://github.com/kylef)
|
70
|
+
[#1771](https://github.com/CocoaPods/CocoaPods/issues/1771)
|
71
|
+
|
72
|
+
##### Bug Fixes
|
73
|
+
|
74
|
+
* Show the actual executable when external commands fail.
|
75
|
+
[Boris Bügling][neonichu]
|
76
|
+
[#2102](https://github.com/CocoaPods/CocoaPods/issues/2102)
|
77
|
+
|
78
|
+
* Fixed support for file references in the workspace generated by CocoaPods.
|
79
|
+
[Kyle Fuller][kylef]
|
80
|
+
[Fabio Pelosin][irrationalfab]
|
81
|
+
[Xcodeproj#105](https://github.com/CocoaPods/Xcodeproj/pull/150)
|
82
|
+
|
83
|
+
* Show a helpful error message when reading version information with merge
|
84
|
+
conflict.
|
85
|
+
[Samuel E. Giddins][segiddins]
|
86
|
+
[#1853](https://github.com/CocoaPods/CocoaPods/issues/1853)
|
87
|
+
|
88
|
+
* Show deprecated specs when invoking `pod outdated`.
|
89
|
+
[Samuel E. Giddins](https://github.com/segiddins)
|
90
|
+
[#2003](https://github.com/CocoaPods/CocoaPods/issues/2003)
|
91
|
+
|
92
|
+
* Fixes an issue where `pod repo update` may start an un-committed merge.
|
93
|
+
[Kyle Fuller][kylef]
|
94
|
+
[#2024](https://github.com/CocoaPods/CocoaPods/issues/2024)
|
95
|
+
|
5
96
|
## 0.32.1
|
6
97
|
|
7
98
|
##### Bug Fixes
|
@@ -10,7 +101,6 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
|
|
10
101
|
[Fabio Pelosin][irrationalfab]
|
11
102
|
[#2050](https://github.com/CocoaPods/CocoaPods/issues/2050)
|
12
103
|
|
13
|
-
|
14
104
|
## 0.32.0
|
15
105
|
|
16
106
|
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/master...0.31.1)
|
@@ -103,6 +193,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
|
|
103
193
|
|
104
194
|
|
105
195
|
|
196
|
+
* Warn when including deprecated pods
|
197
|
+
[Samuel E. Giddins](https://github.com/segiddins)
|
198
|
+
[#2003](https://github.com/CocoaPods/CocoaPods/issues/2003)
|
199
|
+
|
106
200
|
## 0.31.1
|
107
201
|
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.31.1...0.31.0)
|
108
202
|
• [CocoaPods-Core](https://github.com/CocoaPods/Core/compare/0.31.1...0.31.0)
|
@@ -2314,4 +2408,6 @@ allowing you to automate Xcode related tasks.
|
|
2314
2408
|
[7]: https://github.com/CocoaPods/CocoaPods/compare/0.3.10...0.5.0
|
2315
2409
|
|
2316
2410
|
[irrationalfab]: https://github.com/irrationalfab
|
2411
|
+
[kylef]: (https://github.com/kylef)
|
2412
|
+
[neonichu]: (https://github.com/neonichu)
|
2317
2413
|
|
data/lib/cocoapods/command.rb
CHANGED
@@ -14,23 +14,24 @@ module Pod
|
|
14
14
|
require 'cocoapods/command/list'
|
15
15
|
require 'cocoapods/command/outdated'
|
16
16
|
require 'cocoapods/command/project'
|
17
|
-
require 'cocoapods/command/push'
|
18
17
|
require 'cocoapods/command/repo'
|
19
18
|
require 'cocoapods/command/search'
|
20
19
|
require 'cocoapods/command/setup'
|
21
20
|
require 'cocoapods/command/spec'
|
22
21
|
require 'cocoapods/command/init'
|
23
22
|
|
23
|
+
# TODO: remove
|
24
|
+
require 'cocoapods/command/push'
|
25
|
+
|
24
26
|
self.abstract_command = true
|
25
|
-
self.default_subcommand = 'install'
|
26
27
|
self.command = 'pod'
|
28
|
+
self.version = VERSION
|
27
29
|
self.description = 'CocoaPods, the Objective-C library package manager.'
|
28
30
|
self.plugin_prefix = 'cocoapods'
|
29
31
|
|
30
32
|
def self.options
|
31
33
|
[
|
32
34
|
['--silent', 'Show nothing'],
|
33
|
-
['--version', 'Show the version of CocoaPods'],
|
34
35
|
].concat(super)
|
35
36
|
end
|
36
37
|
|
@@ -44,13 +45,6 @@ module Pod
|
|
44
45
|
|
45
46
|
def self.run(argv)
|
46
47
|
help! "You cannot run CocoaPods as root." if Process.uid == 0
|
47
|
-
|
48
|
-
argv = CLAide::ARGV.new(argv)
|
49
|
-
if argv.flag?('version')
|
50
|
-
UI.puts VERSION
|
51
|
-
exit 0
|
52
|
-
end
|
53
|
-
|
54
48
|
super(argv)
|
55
49
|
UI.print_warnings
|
56
50
|
end
|
@@ -17,7 +17,9 @@ module Pod
|
|
17
17
|
(test targets) files which should be stored in the
|
18
18
|
`~/.cocoapods/templates` folder.
|
19
19
|
DESC
|
20
|
-
self.arguments =
|
20
|
+
self.arguments = [
|
21
|
+
['XCODEPROJ', :optional]
|
22
|
+
]
|
21
23
|
|
22
24
|
def initialize(argv)
|
23
25
|
@podfile_path = Pathname.pwd + "Podfile"
|
@@ -15,7 +15,9 @@ module Pod
|
|
15
15
|
|
16
16
|
self.summary = 'Converts a podspec to JSON.'
|
17
17
|
self.description = 'Converts a podspec to JSON and prints it to STDOUT.'
|
18
|
-
self.arguments =
|
18
|
+
self.arguments = [
|
19
|
+
['PATH', :required]
|
20
|
+
]
|
19
21
|
|
20
22
|
def initialize(argv)
|
21
23
|
@path = argv.shift_argument
|
@@ -40,7 +42,9 @@ module Pod
|
|
40
42
|
|
41
43
|
self.summary = 'Converts a Podfile to YAML.'
|
42
44
|
self.description = 'Converts a Podfile to YAML and prints it to STDOUT.'
|
43
|
-
self.arguments =
|
45
|
+
self.arguments = [
|
46
|
+
['PATH', :required]
|
47
|
+
]
|
44
48
|
|
45
49
|
def initialize(argv)
|
46
50
|
@path = argv.shift_argument
|
@@ -63,11 +67,11 @@ module Pod
|
|
63
67
|
|
64
68
|
class List < IPC
|
65
69
|
|
66
|
-
self.summary = 'Lists the specifications
|
70
|
+
self.summary = 'Lists the specifications known to CocoaPods.'
|
67
71
|
self.description = <<-DESC
|
68
72
|
Prints to STDOUT a YAML dictionary where the keys are the name of the
|
69
|
-
specifications and
|
70
|
-
keys
|
73
|
+
specifications and each corresponding value is a dictionary with
|
74
|
+
the following keys:
|
71
75
|
|
72
76
|
- defined_in_file
|
73
77
|
- version
|
@@ -14,7 +14,10 @@ module Pod
|
|
14
14
|
If a `TEMPLATE_URL`, pointing to a git repo containing a compatible template, is specified, it will be used in place of the default one.
|
15
15
|
DESC
|
16
16
|
|
17
|
-
self.arguments =
|
17
|
+
self.arguments = [
|
18
|
+
['NAME', :required],
|
19
|
+
['TEMPLATE_URL', :optional]
|
20
|
+
]
|
18
21
|
|
19
22
|
def initialize(argv)
|
20
23
|
@name = argv.shift_argument
|
@@ -23,21 +23,6 @@ module Pod
|
|
23
23
|
# @todo fix.
|
24
24
|
#
|
25
25
|
def run
|
26
|
-
verify_podfile_exists!
|
27
|
-
verify_lockfile_exists!
|
28
|
-
|
29
|
-
lockfile = config.lockfile
|
30
|
-
pods = lockfile.pod_names
|
31
|
-
updates = []
|
32
|
-
pods.each do |pod_name|
|
33
|
-
set = SourcesManager.search(Dependency.new(pod_name))
|
34
|
-
next unless set
|
35
|
-
source_version = set.versions.first
|
36
|
-
lockfile_version = lockfile.version(pod_name)
|
37
|
-
if source_version > lockfile_version
|
38
|
-
updates << [pod_name, lockfile_version, source_version]
|
39
|
-
end
|
40
|
-
end
|
41
26
|
|
42
27
|
if updates.empty?
|
43
28
|
UI.puts "No updates are available.".yellow
|
@@ -48,7 +33,71 @@ module Pod
|
|
48
33
|
end
|
49
34
|
end
|
50
35
|
end
|
36
|
+
|
37
|
+
if deprecated_pods.any?
|
38
|
+
UI.section 'The following pods are deprecated:' do
|
39
|
+
deprecated_pods.each do |spec|
|
40
|
+
if spec.deprecated_in_favor_of
|
41
|
+
UI.puts "- #{spec.name}" \
|
42
|
+
" (in favor of #{spec.deprecated_in_favor_of})"
|
43
|
+
else
|
44
|
+
UI.puts "- #{spec.name}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def updates
|
55
|
+
@updates ||= begin
|
56
|
+
spec_sets.map do |set|
|
57
|
+
spec = set.specification
|
58
|
+
source_version = set.versions.first
|
59
|
+
pod_name = spec.name
|
60
|
+
lockfile_version = lockfile.version(pod_name)
|
61
|
+
if source_version > lockfile_version
|
62
|
+
[pod_name, lockfile_version, source_version]
|
63
|
+
else
|
64
|
+
nil
|
65
|
+
end
|
66
|
+
end.compact.uniq
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def deprecated_pods
|
71
|
+
@deprecated_pods ||= begin
|
72
|
+
spec_sets.map(&:specification).select do |spec|
|
73
|
+
spec.deprecated || spec.deprecated_in_favor_of
|
74
|
+
end.compact.uniq
|
75
|
+
end
|
51
76
|
end
|
77
|
+
|
78
|
+
def spec_sets
|
79
|
+
@spec_sets ||= begin
|
80
|
+
installed_pods.map do |pod_name|
|
81
|
+
SourcesManager.search(Dependency.new(pod_name))
|
82
|
+
end.compact.uniq
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def installed_pods
|
87
|
+
@installed_pods ||= begin
|
88
|
+
verify_podfile_exists!
|
89
|
+
|
90
|
+
lockfile.pod_names
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def lockfile
|
95
|
+
@lockfile ||= begin
|
96
|
+
verify_lockfile_exists!
|
97
|
+
config.lockfile
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
52
101
|
end
|
53
102
|
end
|
54
103
|
end
|
@@ -8,7 +8,7 @@ module Pod
|
|
8
8
|
module Options
|
9
9
|
def options
|
10
10
|
[
|
11
|
-
["--no-clean", "Leave SCM dirs like `.git
|
11
|
+
["--no-clean", "Leave SCM dirs like `.git` and `.svn` intact after downloading"],
|
12
12
|
["--no-integrate", "Skip integration of the Pods libraries in the Xcode project(s)"],
|
13
13
|
["--no-repo-update", "Skip running `pod repo update` before install"],
|
14
14
|
].concat(super)
|
@@ -49,15 +49,15 @@ module Pod
|
|
49
49
|
self.summary = 'Install project dependencies'
|
50
50
|
|
51
51
|
self.description = <<-DESC
|
52
|
-
Downloads all dependencies defined in `Podfile
|
53
|
-
Pods library project in `./Pods
|
52
|
+
Downloads all dependencies defined in `Podfile` and creates an Xcode
|
53
|
+
Pods library project in `./Pods`.
|
54
54
|
|
55
55
|
The Xcode project file should be specified in your `Podfile` like this:
|
56
56
|
|
57
|
-
|
57
|
+
xcodeproj 'path/to/XcodeProject'
|
58
58
|
|
59
59
|
If no xcodeproj is specified, then a search for an Xcode project will
|
60
|
-
be made.
|
60
|
+
be made. If more than one Xcode project is found, the command will
|
61
61
|
raise an error.
|
62
62
|
|
63
63
|
This will configure the project to reference the Pods static library,
|
@@ -85,7 +85,9 @@ module Pod
|
|
85
85
|
be used to install changes to the Podfile.
|
86
86
|
DESC
|
87
87
|
|
88
|
-
self.arguments =
|
88
|
+
self.arguments = [
|
89
|
+
['POD_NAMES...', :optional]
|
90
|
+
]
|
89
91
|
|
90
92
|
def initialize(argv)
|
91
93
|
@pods = argv.arguments! unless argv.arguments.empty?
|
@@ -104,7 +106,7 @@ module Pod
|
|
104
106
|
raise Informative, (missing_pods.length > 1 \
|
105
107
|
? "Pods %s are not installed and cannot be updated" \
|
106
108
|
: "Pod %s is not installed and cannot be updated"
|
107
|
-
) % missing_pods.map { |p| "`#{p}
|
109
|
+
) % missing_pods.map { |p| "`#{p}`" }.join(', ')
|
108
110
|
end
|
109
111
|
|
110
112
|
run_install_with_update(:pods => @pods)
|
@@ -1,177 +1,22 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'active_support/core_ext/string/inflections'
|
3
|
-
|
4
1
|
module Pod
|
5
2
|
class Command
|
6
3
|
class Push < Command
|
7
|
-
self.summary = '
|
8
|
-
|
9
|
-
self.description = <<-DESC
|
10
|
-
Validates NAME.podspec or `*.podspec' in the current working dir, creates
|
11
|
-
a directory and version folder for the pod in the local copy of
|
12
|
-
REPO (~/.cocoapods/repos/[REPO]), copies the podspec file into the version
|
13
|
-
directory, and finally it pushes REPO to its remote.
|
14
|
-
DESC
|
4
|
+
self.summary = 'Temporary alias for the `pod repo push` command'
|
15
5
|
|
16
|
-
self.arguments = 'REPO [NAME.podspec]'
|
17
|
-
|
18
|
-
def self.options
|
19
|
-
[ ["--allow-warnings", "Allows pushing even if there are warnings"],
|
20
|
-
["--local-only", "Does not perform the step of pushing REPO to its remote"] ].concat(super)
|
21
|
-
end
|
22
6
|
|
23
7
|
def initialize(argv)
|
24
|
-
@
|
25
|
-
@local_only = argv.flag?('local-only')
|
26
|
-
@repo = argv.shift_argument
|
27
|
-
if @repo.nil?
|
28
|
-
@repo = "master"
|
29
|
-
elsif @repo.end_with? ".podspec"
|
30
|
-
@podspec = @repo
|
31
|
-
@repo = "master"
|
32
|
-
else
|
33
|
-
@podspec = argv.shift_argument
|
34
|
-
end
|
8
|
+
@push_command = Repo::Push.new(argv)
|
35
9
|
super
|
36
10
|
end
|
37
11
|
|
38
12
|
def validate!
|
39
|
-
|
40
|
-
|
13
|
+
UI.puts '[!] The `pod push` command has been moved to `pod repo push`.'.ansi.yellow
|
14
|
+
@push_command.validate!
|
41
15
|
end
|
42
16
|
|
43
17
|
def run
|
44
|
-
|
45
|
-
check_repo_status
|
46
|
-
update_repo
|
47
|
-
add_specs_to_repo
|
48
|
-
push_repo unless @local_only
|
49
|
-
end
|
50
|
-
|
51
|
-
#-----------------------------------------------------------------------#
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
# @!group Push sub-steps
|
56
|
-
|
57
|
-
extend Executable
|
58
|
-
executable :git
|
59
|
-
|
60
|
-
# Performs a full lint against the podspecs.
|
61
|
-
#
|
62
|
-
def validate_podspec_files
|
63
|
-
UI.puts "\nValidating #{'spec'.pluralize(count)}".yellow
|
64
|
-
podspec_files.each do |podspec|
|
65
|
-
validator = Validator.new(podspec)
|
66
|
-
validator.only_errors = @allow_warnings
|
67
|
-
begin
|
68
|
-
validator.validate
|
69
|
-
rescue Exception
|
70
|
-
raise Informative, "The `#{podspec}` specification does not validate."
|
71
|
-
end
|
72
|
-
raise Informative, "The `#{podspec}` specification does not validate." unless validator.validated?
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
# Checks that the repo is clean.
|
77
|
-
#
|
78
|
-
# @raise If the repo is not clean.
|
79
|
-
#
|
80
|
-
# @todo Add specs for staged and unstaged files.
|
81
|
-
#
|
82
|
-
# @todo Gracefully handle the case where source is not under git
|
83
|
-
# source control.
|
84
|
-
#
|
85
|
-
# @return [void]
|
86
|
-
#
|
87
|
-
def check_repo_status
|
88
|
-
clean = Dir.chdir(repo_dir) { `git status --porcelain 2>&1` } == ''
|
89
|
-
raise Informative, "The repo `#{@repo}` is not clean" unless clean
|
90
|
-
end
|
91
|
-
|
92
|
-
# Updates the git repo against the remote.
|
93
|
-
#
|
94
|
-
# @return [void]
|
95
|
-
#
|
96
|
-
def update_repo
|
97
|
-
UI.puts "Updating the `#{@repo}' repo\n".yellow
|
98
|
-
Dir.chdir(repo_dir) { UI.puts `git pull 2>&1` }
|
18
|
+
@push_command.run
|
99
19
|
end
|
100
|
-
|
101
|
-
# Commits the podspecs to the source, which should be a git repo.
|
102
|
-
#
|
103
|
-
# @note The pre commit hook of the repo is skipped as the podspecs have
|
104
|
-
# already been linted.
|
105
|
-
#
|
106
|
-
# @return [void]
|
107
|
-
#
|
108
|
-
def add_specs_to_repo
|
109
|
-
UI.puts "\nAdding the #{'spec'.pluralize(count)} to the `#{@repo}' repo\n".yellow
|
110
|
-
podspec_files.each do |spec_file|
|
111
|
-
spec = Pod::Specification.from_file(spec_file)
|
112
|
-
output_path = File.join(repo_dir, spec.name, spec.version.to_s)
|
113
|
-
if Pathname.new(output_path).exist?
|
114
|
-
message = "[Fix] #{spec}"
|
115
|
-
elsif Pathname.new(File.join(repo_dir, spec.name)).exist?
|
116
|
-
message = "[Update] #{spec}"
|
117
|
-
else
|
118
|
-
message = "[Add] #{spec}"
|
119
|
-
end
|
120
|
-
|
121
|
-
FileUtils.mkdir_p(output_path)
|
122
|
-
FileUtils.cp(spec_file, output_path)
|
123
|
-
Dir.chdir(repo_dir) do
|
124
|
-
# only commit if modified
|
125
|
-
if git!("status --porcelain 2>&1").include?(spec.name)
|
126
|
-
UI.puts " - #{message}"
|
127
|
-
git!("add #{spec.name}")
|
128
|
-
git!("commit --no-verify -m '#{message}'")
|
129
|
-
else
|
130
|
-
UI.puts " - [No change] #{spec}"
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
# Pushes the git repo against the remote.
|
137
|
-
#
|
138
|
-
# @return [void]
|
139
|
-
#
|
140
|
-
def push_repo
|
141
|
-
UI.puts "\nPushing the `#{@repo}' repo\n".yellow
|
142
|
-
Dir.chdir(repo_dir) { UI.puts `git push origin master 2>&1` }
|
143
|
-
end
|
144
|
-
|
145
|
-
#-----------------------------------------------------------------------#
|
146
|
-
|
147
|
-
private
|
148
|
-
|
149
|
-
# @!group Private helpers
|
150
|
-
|
151
|
-
# @return [Pathname] The directory of the repository.
|
152
|
-
#
|
153
|
-
def repo_dir
|
154
|
-
dir = config.repos_dir + @repo
|
155
|
-
raise Informative, "`#{@repo}` repo not found" unless dir.exist?
|
156
|
-
dir
|
157
|
-
end
|
158
|
-
|
159
|
-
# @return [Array<Pathname>] The path of the specifications to push.
|
160
|
-
#
|
161
|
-
def podspec_files
|
162
|
-
files = Pathname.glob(@podspec || "*.podspec")
|
163
|
-
raise Informative, "Couldn't find any .podspec file in current directory" if files.empty?
|
164
|
-
files
|
165
|
-
end
|
166
|
-
|
167
|
-
# @return [Integer] The number of the podspec files to push.
|
168
|
-
#
|
169
|
-
def count
|
170
|
-
podspec_files.count
|
171
|
-
end
|
172
|
-
|
173
|
-
#-----------------------------------------------------------------------#
|
174
|
-
|
175
20
|
end
|
176
21
|
end
|
177
22
|
end
|