cocoapods-repo-update 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f943bdfe08c5b73e39d69c2e45a95d409166148
|
4
|
+
data.tar.gz: c4a9c6f9981ba750cc2f626ea9de5a590c48918f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b71d276fb4c4261256c36d02f1c89b9c73583821e60943434c1853e6afea09b363046579c7a61ea2386634c2a4459e61d187c00b35cf711a496f4bcd5297bb6
|
7
|
+
data.tar.gz: dbec013ac1bb9059491d25ee17b33147886aaf7a1223939fca427484892ca981e7efab1d5177cb2f73d675bed4d0a2a62fd9db1f9c4de07a17001a746524d834
|
@@ -13,5 +13,17 @@ module CocoapodsRepoUpdate
|
|
13
13
|
$stdout.reopen original_stdout
|
14
14
|
$stderr.reopen original_stderr
|
15
15
|
end
|
16
|
+
|
17
|
+
def self.specs_need_update?(exception)
|
18
|
+
no_spec_found?(exception) || version_conflict?(exception)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.no_spec_found?(exception)
|
22
|
+
exception.is_a?(Pod::NoSpecFoundError)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.version_conflict?(exception)
|
26
|
+
exception.cause.is_a?(Molinillo::VersionConflict)
|
27
|
+
end
|
16
28
|
end
|
17
29
|
end
|
@@ -16,8 +16,15 @@ module CocoapodsRepoUpdate
|
|
16
16
|
analyzer.analyze
|
17
17
|
end
|
18
18
|
Pod::UI.puts "Not updating local specs repo"
|
19
|
-
rescue
|
20
|
-
|
19
|
+
rescue Exception => e
|
20
|
+
raise unless CocoapodsRepoUpdate::Helper.specs_need_update?(e)
|
21
|
+
|
22
|
+
message = "At least one Pod is not in the local specs repo"
|
23
|
+
if CocoapodsRepoUpdate::Helper.version_conflict?(e)
|
24
|
+
message = "There was a version conflict with some of your pods"
|
25
|
+
end
|
26
|
+
|
27
|
+
Pod::UI.puts "#{message}. Updating specs repo..."
|
21
28
|
# Update the specs repos, silently
|
22
29
|
CocoapodsRepoUpdate::Helper.suppress_output do
|
23
30
|
analyzer.update_repositories
|
data/spec/unit/hooks_spec.rb
CHANGED
@@ -13,10 +13,16 @@ describe CocoapodsRepoUpdate::Hooks do
|
|
13
13
|
lockfile: double('lockfile')) }
|
14
14
|
let(:analyzer) { double('analyzer') }
|
15
15
|
|
16
|
+
let(:no_spec_found) { Pod::NoSpecFoundError.new }
|
17
|
+
let(:version_conflict) { double('version conflict', cause: double('conflict')) }
|
18
|
+
|
16
19
|
before do
|
17
20
|
allow(Pod::Installer::Analyzer).to receive(:new).with(installer_context.sandbox,
|
18
21
|
installer_context.podfile,
|
19
22
|
installer_context.lockfile).and_return(analyzer)
|
23
|
+
|
24
|
+
allow(no_spec_found).to receive(:is_a?).with(Pod::NoSpecFoundError).and_return(true)
|
25
|
+
allow(version_conflict.cause).to receive(:is_a?).with(Molinillo::VersionConflict).and_return(true)
|
20
26
|
end
|
21
27
|
|
22
28
|
context 'pre install' do
|
@@ -27,11 +33,21 @@ describe CocoapodsRepoUpdate::Hooks do
|
|
27
33
|
trigger_pre_install(installer_context, options)
|
28
34
|
end
|
29
35
|
|
30
|
-
it 'runs the post install action and updates specs' do
|
36
|
+
it 'runs the post install action and updates specs if a spec is not found' do
|
31
37
|
allow(analyzer).to receive(:analyze).and_raise(Pod::NoSpecFoundError)
|
32
38
|
expect(analyzer).to receive(:update_repositories)
|
33
39
|
|
34
40
|
trigger_pre_install(installer_context, options)
|
35
41
|
end
|
42
|
+
|
43
|
+
it 'runs the post install action and updates specs if there is a version conflict' do
|
44
|
+
exception = StandardError.new
|
45
|
+
allow(exception).to receive(:cause).and_return(Molinillo::VersionConflict.new({}, nil))
|
46
|
+
|
47
|
+
allow(analyzer).to receive(:analyze).and_raise(exception)
|
48
|
+
expect(analyzer).to receive(:update_repositories)
|
49
|
+
|
50
|
+
trigger_pre_install(installer_context, options)
|
51
|
+
end
|
36
52
|
end
|
37
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-repo-update
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Treanor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|