cocoapods-bin 0.1.6 → 0.1.7

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: c66ddaf92807762c972bad0aad0d854c8a408c80
4
- data.tar.gz: be00a1dc37583397149733463362b1413621c7d1
3
+ metadata.gz: 7659c97e073a001e2ebdf133d08f85e2ee186c15
4
+ data.tar.gz: 054c458cdd2b9675d25f529803d6fc0f48d445d8
5
5
  SHA512:
6
- metadata.gz: 0c48432d6626d8b64ea426736466123c674819700d659f79a26dd923c270f53c381ef706c2c406cb8db124e3842a3ae9679bf4b6ffeb17d1e83646bc985f88b5
7
- data.tar.gz: 9c796beba91dd941248a0c017a5f4ffdca237b52e095d10e625973ae8969ff30e0cae39eb4005373693be571218d01a75eb0a60f9b077f5c738bf783e2470e18
6
+ metadata.gz: 60fa57fa0d67d9a05cc47d47a08ff78358beebe3c9052382defa468a1b3dd93e63d32f1eae53d4936698d372870f12e2def7c61b2ac93170a7c4cbd2f2b32347
7
+ data.tar.gz: fc2fd9f4856e777edf153d166fdf109a912da641a499dc053f38b7a8442718384b9fd0ea6e52e6b5f2cf78c1b7061afabe5c56a15e93b1ab08ac54be7fed6f4d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-bin (0.1.6)
4
+ cocoapods-bin (0.1.7)
5
5
  cocoapods (~> 1.4)
6
6
  parallel
7
7
 
@@ -37,22 +37,24 @@ module Pod
37
37
  end
38
38
 
39
39
  def run
40
- Podfile.execute_with_allow_prerelease(@allow_prerelease) do
41
- Podfile.execute_with_use_binaries(!@code_dependencies) do
42
- argvs = [
43
- @podspec || code_spec_files.first,
44
- "--sources=#{sources_option(@code_dependencies, @sources)}",
45
- *@additional_args
46
- ]
40
+ Podfile.execute_with_bin_plugin do
41
+ Podfile.execute_with_allow_prerelease(@allow_prerelease) do
42
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
43
+ argvs = [
44
+ @podspec || code_spec_files.first,
45
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
46
+ *@additional_args
47
+ ]
48
+
49
+ if @loose_options
50
+ argvs << '--allow-warnings'
51
+ argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
52
+ end
47
53
 
48
- if @loose_options
49
- argvs << '--allow-warnings'
50
- argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
54
+ lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
55
+ lint.validate!
56
+ lint.run
51
57
  end
52
-
53
- lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
54
- lint.validate!
55
- lint.run
56
58
  end
57
59
  end
58
60
  end
@@ -41,24 +41,26 @@ module Pod
41
41
  end
42
42
 
43
43
  def run
44
- Podfile.execute_with_allow_prerelease(@allow_prerelease) do
45
- Podfile.execute_with_use_binaries(!@code_dependencies) do
46
- argvs = [
47
- repo,
48
- "--sources=#{sources_option(@code_dependencies, @sources)}",
49
- *@additional_args
50
- ]
44
+ Podfile.execute_with_bin_plugin do
45
+ Podfile.execute_with_allow_prerelease(@allow_prerelease) do
46
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
47
+ argvs = [
48
+ repo,
49
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
50
+ *@additional_args
51
+ ]
51
52
 
52
- argvs << spec_file if spec_file
53
+ argvs << spec_file if spec_file
53
54
 
54
- if @loose_options
55
- argvs += ['--allow-warnings', '--use-json']
56
- argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
55
+ if @loose_options
56
+ argvs += ['--allow-warnings', '--use-json']
57
+ argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
58
+ end
59
+
60
+ push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
61
+ push.validate!
62
+ push.run
57
63
  end
58
-
59
- push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
60
- push.validate!
61
- push.run
62
64
  end
63
65
  end
64
66
  ensure
@@ -41,23 +41,25 @@ module Pod
41
41
  end
42
42
 
43
43
  def run
44
- Podfile.execute_with_allow_prerelease(@allow_prerelease) do
45
- Podfile.execute_with_use_binaries(!@code_dependencies) do
46
- argvs = [
47
- "--sources=#{sources_option(@code_dependencies, @sources)}",
48
- *@additional_args
49
- ]
44
+ Podfile.execute_with_bin_plugin do
45
+ Podfile.execute_with_allow_prerelease(@allow_prerelease) do
46
+ Podfile.execute_with_use_binaries(!@code_dependencies) do
47
+ argvs = [
48
+ "--sources=#{sources_option(@code_dependencies, @sources)}",
49
+ *@additional_args
50
+ ]
50
51
 
51
- argvs << spec_file if spec_file
52
+ argvs << spec_file if spec_file
52
53
 
53
- if @loose_options
54
- argvs += ['--allow-warnings']
55
- argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
56
- end
54
+ if @loose_options
55
+ argvs += ['--allow-warnings']
56
+ argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
57
+ end
57
58
 
58
- lint = Pod::Command::Spec::Lint.new(CLAide::ARGV.new(argvs))
59
- lint.validate!
60
- lint.run
59
+ lint = Pod::Command::Spec::Lint.new(CLAide::ARGV.new(argvs))
60
+ lint.validate!
61
+ lint.run
62
+ end
61
63
  end
62
64
  end
63
65
  ensure
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
4
4
 
5
5
  module Pod
@@ -1,4 +1,4 @@
1
- require 'cocoapods-bin/native'
1
+ require 'cocoapods-bin/native/sources_manager.rb'
2
2
 
3
3
  module CBin
4
4
  module SourcesHelper
@@ -1,4 +1,5 @@
1
- require 'cocoapods-bin/native'
1
+ require 'cocoapods-bin/native/sources_manager.rb'
2
+ require 'cocoapods-bin/helpers/spec_creator'
2
3
 
3
4
  module CBin
4
5
  module SpecFilesHelper
@@ -15,5 +15,3 @@ if Pod.match_version?('~> 1.4')
15
15
  require 'cocoapods-bin/native/acknowledgements'
16
16
  require 'cocoapods-bin/native/sandbox_analyzer'
17
17
  end
18
-
19
- require 'cocoapods-bin/native/source_provider_hook'
@@ -1,11 +1,8 @@
1
1
  require 'cocoapods'
2
+ require 'cocoapods-bin/native/podfile_env'
2
3
 
3
4
  module Pod
4
5
  class Podfile
5
- USE_BINARIES = 'use_binaries'.freeze
6
- USE_SOURCE_PODS = 'use_source_pods'.freeze
7
- USE_BINARIES_SELECTOR = 'use_binaries_selector'.freeze
8
- ALLOW_PRERELEASE = 'allow_prerelease'.freeze
9
6
  # TREAT_DEVELOPMENTS_AS_NORMAL = 'treat_developments_as_normal'.freeze
10
7
 
11
8
  module DSL
@@ -30,27 +27,19 @@ module Pod
30
27
  end
31
28
  end
32
29
 
33
- module ENVExecutor
34
- def execute_with_allow_prerelease(allow_prerelease, &block)
35
- execute_with_key(ALLOW_PRERELEASE, -> { allow_prerelease ? 'true' : 'false' }, &block)
36
- end
37
-
38
- def execute_with_use_binaries(use_binaries, &block)
39
- execute_with_key(USE_BINARIES, -> { use_binaries ? 'true' : 'false' }, &block)
40
- end
41
-
42
- def execute_with_key(key, value_returner, &block)
43
- origin_value = ENV[key]
44
- ENV[key] = value_returner.call
45
-
46
- yield if block_given?
47
-
48
- ENV[key] = origin_value
30
+ alias_method :old_plugins, :plugins
31
+ def plugins
32
+ if ENV[USE_PLUGINS]
33
+ env_plugins = ENV[USE_PLUGINS].split(',').reduce({}) do |result, name|
34
+ result[name] = {}
35
+ result
36
+ end
37
+ env_plugins.merge!(old_plugins)
38
+ else
39
+ old_plugins
49
40
  end
50
41
  end
51
42
 
52
- extend ENVExecutor
53
-
54
43
  def use_binaries_selector
55
44
  get_internal_hash_value(USE_BINARIES_SELECTOR, nil)
56
45
  end
@@ -68,8 +57,14 @@ module Pod
68
57
  end
69
58
 
70
59
  private
60
+ def valid_bin_plugin
61
+ raise Pod::Informative, 'You should add `plugin \'cocoapods-bin\'` before using its DSL' unless plugins.keys.include?('cocoapods-bin')
62
+ end
63
+
71
64
  # set_hash_value 有 key 限制
72
65
  def set_internal_hash_value(key, value)
66
+ valid_bin_plugin
67
+
73
68
  internal_hash[key] = value
74
69
  end
75
70
 
@@ -0,0 +1,34 @@
1
+ module Pod
2
+ class Podfile
3
+ USE_BINARIES = 'use_binaries'.freeze
4
+ USE_SOURCE_PODS = 'use_source_pods'.freeze
5
+ USE_BINARIES_SELECTOR = 'use_binaries_selector'.freeze
6
+ ALLOW_PRERELEASE = 'allow_prerelease'.freeze
7
+ USE_PLUGINS = 'use_plugins'.freeze
8
+
9
+ module ENVExecutor
10
+ def execute_with_bin_plugin(&block)
11
+ execute_with_key(USE_PLUGINS, -> {'cocoapods-bin'}, &block)
12
+ end
13
+
14
+ def execute_with_allow_prerelease(allow_prerelease, &block)
15
+ execute_with_key(ALLOW_PRERELEASE, -> { allow_prerelease ? 'true' : 'false' }, &block)
16
+ end
17
+
18
+ def execute_with_use_binaries(use_binaries, &block)
19
+ execute_with_key(USE_BINARIES, -> { use_binaries ? 'true' : 'false' }, &block)
20
+ end
21
+
22
+ def execute_with_key(key, value_returner, &block)
23
+ origin_value = ENV[key]
24
+ ENV[key] = value_returner.call
25
+
26
+ yield if block_given?
27
+
28
+ ENV[key] = origin_value
29
+ end
30
+ end
31
+
32
+ extend ENVExecutor
33
+ end
34
+ end
@@ -0,0 +1,17 @@
1
+ require 'cocoapods-bin/native/sources_manager'
2
+
3
+ Pod::HooksManager.register('cocoapods-bin', :pre_install) do |context, _|
4
+ require 'cocoapods-bin/native'
5
+ end
6
+
7
+ Pod::HooksManager.register('cocoapods-bin', :source_provider) do |context, _|
8
+ sources_manager = Pod::Config.instance.sources_manager
9
+ podfile = Pod::Config.instance.podfile
10
+
11
+ if podfile
12
+ # 添加二进制私有源 && 源码私有源
13
+ added_sources = [sources_manager.code_source, sources_manager.binary_source]
14
+ added_sources.reverse! if podfile.use_binaries? || podfile.use_binaries_selector
15
+ added_sources.each { |source| context.add_source(source) }
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  require 'cocoapods-bin/gem_version.rb'
2
2
  require 'cocoapods-bin/command'
3
- require 'cocoapods-bin/native'
3
+ require 'cocoapods-bin/source_provider_hook'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - tripleCC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-22 00:00:00.000000000 Z
11
+ date: 2019-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -112,13 +112,14 @@ files:
112
112
  - lib/cocoapods-bin/native/path_source.rb
113
113
  - lib/cocoapods-bin/native/pod_source_installer.rb
114
114
  - lib/cocoapods-bin/native/podfile.rb
115
+ - lib/cocoapods-bin/native/podfile_env.rb
115
116
  - lib/cocoapods-bin/native/resolver.rb
116
117
  - lib/cocoapods-bin/native/sandbox_analyzer.rb
117
118
  - lib/cocoapods-bin/native/source.rb
118
- - lib/cocoapods-bin/native/source_provider_hook.rb
119
119
  - lib/cocoapods-bin/native/sources_manager.rb
120
120
  - lib/cocoapods-bin/native/specification.rb
121
121
  - lib/cocoapods-bin/native/validator.rb
122
+ - lib/cocoapods-bin/source_provider_hook.rb
122
123
  - lib/cocoapods_plugin.rb
123
124
  - spec/command/bin_spec.rb
124
125
  - spec/spec_helper.rb
@@ -1,11 +0,0 @@
1
- require 'cocoapods-bin/native/sources_manager'
2
-
3
- Pod::HooksManager.register('cocoapods-bin', :source_provider) do |context, _|
4
- sources_manager = Pod::Config.instance.sources_manager
5
- podfile = Pod::Config.instance.podfile
6
-
7
- # 添加二进制私有源 && 源码私有源
8
- added_sources = [sources_manager.code_source, sources_manager.binary_source]
9
- added_sources.reverse! if podfile.use_binaries? || podfile.use_binaries_selector
10
- added_sources.each { |source| context.add_source(source) }
11
- end