cocoapods-bin 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf5d790603abfbbc6e4624f826b0102b94753d15
4
- data.tar.gz: 976cfee2a3ebb99b648b6bf7f0e293fb662cadc2
3
+ metadata.gz: b029e2430ee8a2dc54dfc919930fa13c9d92a130
4
+ data.tar.gz: da795a5e512bc1b729ec5d9cb69216c42d1ede4f
5
5
  SHA512:
6
- metadata.gz: 3c187df578219cf4f1f465061614ffee3c84dc0a740998fcd4560acf5c1646aab11b71060f009cfbd56003bb7a7db3f60231751507ef739d2bedab7f26a665b7
7
- data.tar.gz: 458effc98e7baeea263496fef51a39465eadf71f512ce0479dfd277e594fa7cadc5a814d567bc43ef066399ba7eedea6993728963f6dec197c1f988c21ac3aa7
6
+ metadata.gz: 6939eb1cdfc4d21cd07b901e17348751b6197283336c8ace9556875f3f1363027771f9acef247f9045df969d02ca2a3d986b3453e599ea7548f14651cb54e57a
7
+ data.tar.gz: 1b6c3b98739b91de7725a3a90c9e8677b2fdc35ebd46cc5034a129a272cfe0c8c56195eff142c2b90373546370527f54de20f030f893626e5e1a50b3423ad303
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-bin (0.1.2)
4
+ cocoapods-bin (0.1.3)
5
5
  cocoapods (~> 1.4)
6
6
  parallel
7
7
 
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = CBin::VERSION
9
9
  spec.authors = ['tripleCC']
10
10
  spec.email = ['triplec.linux@gmail.com']
11
- spec.description = %q{cocoapods pods source switcher.}
11
+ spec.description = %q{cocoapods-bin is a plugin which helps develpers switching pods between source code and binary.}
12
12
  spec.summary = %q{cocoapods-bin is a plugin which helps develpers switching pods between source code and binary.}
13
13
  spec.homepage = 'https://github.com/tripleCC/cocoapods-bin'
14
14
  spec.license = 'MIT'
@@ -21,6 +21,7 @@ module Pod
21
21
  [
22
22
  ['--code-dependencies', '使用源码依赖进行 lint'],
23
23
  ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
24
+ ['--allow-prerelease', '允许使用 prerelease 的版本 lint']
24
25
  ].concat(Pod::Command::Lib::Lint.options).concat(super).uniq
25
26
  end
26
27
 
@@ -28,6 +29,7 @@ module Pod
28
29
  @loose_options = argv.flag?('loose-options')
29
30
  @code_dependencies = argv.flag?('code-dependencies')
30
31
  @sources = argv.option('sources') || []
32
+ @allow_prerelease = argv.flag?('allow-prerelease')
31
33
  @podspec = argv.shift_argument
32
34
  super
33
35
 
@@ -35,21 +37,23 @@ module Pod
35
37
  end
36
38
 
37
39
  def run
38
- Podfile.execute_with_use_binaries(!@code_dependencies) do
39
- argvs = [
40
- @podspec || code_spec_files.first,
41
- "--sources=#{sources_option(@code_dependencies, @sources)}",
42
- *@additional_args
43
- ]
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
+ ]
47
+
48
+ if @loose_options
49
+ argvs << '--allow-warnings'
50
+ argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
51
+ end
44
52
 
45
- if @loose_options
46
- argvs << '--allow-warnings'
47
- argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
53
+ lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
54
+ lint.validate!
55
+ lint.run
48
56
  end
49
-
50
- lint = Pod::Command::Lib::Lint.new(CLAide::ARGV.new(argvs))
51
- lint.validate!
52
- lint.run
53
57
  end
54
58
  end
55
59
  end
@@ -21,7 +21,8 @@ module Pod
21
21
  ['--template-podspec=A.binary-template.podspec', '生成拥有 subspec 的二进制 spec 需要的模版 podspec, 插件会更改 version 和 source'],
22
22
  ['--reserve-created-spec', '保留生成的二进制 spec 文件'],
23
23
  ['--code-dependencies', '使用源码依赖进行 lint'],
24
- ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],s
24
+ ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
25
+ ['--allow-prerelease', '允许使用 prerelease 的版本 lint']
25
26
  ].concat(Pod::Command::Repo::Push.options).concat(super).uniq
26
27
  end
27
28
 
@@ -33,29 +34,32 @@ module Pod
33
34
  @sources = argv.option('sources') || []
34
35
  @reserve_created_spec = argv.flag?('reserve-created-spec')
35
36
  @template_podspec = argv.option('template-podspec')
37
+ @allow_prerelease = argv.flag?('allow-prerelease')
36
38
  super
37
39
 
38
40
  @additional_args = argv.remainder!
39
41
  end
40
42
 
41
43
  def run
42
- Podfile.execute_with_use_binaries(!@code_dependencies) do
43
- argvs = [
44
- repo,
45
- "--sources=#{sources_option(@code_dependencies, @sources)}",
46
- *@additional_args
47
- ]
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
+ ]
48
51
 
49
- argvs << spec_file if spec_file
52
+ argvs << spec_file if spec_file
50
53
 
51
- if @loose_options
52
- argvs += ['--allow-warnings', '--use-json']
53
- argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
54
+ if @loose_options
55
+ argvs += ['--allow-warnings', '--use-json']
56
+ argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
57
+ end
58
+
59
+ push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
60
+ push.validate!
61
+ push.run
54
62
  end
55
-
56
- push = Pod::Command::Repo::Push.new(CLAide::ARGV.new(argvs))
57
- push.validate!
58
- push.run
59
63
  end
60
64
  ensure
61
65
  clear_binary_spec_file_if_needed unless @reserve_created_spec
@@ -22,6 +22,7 @@ module Pod
22
22
  ['--reserve-created-spec', '保留生成的二进制 spec 文件'],
23
23
  ['--code-dependencies', '使用源码依赖进行 lint'],
24
24
  ['--loose-options', '添加宽松的 options, 包括 --use-libraries (可能会造成 entry point (start) undefined)'],
25
+ ['--allow-prerelease', '允许使用 prerelease 的版本 lint']
25
26
  ].concat(Pod::Command::Lib::Spec.options).concat(super).uniq
26
27
  end
27
28
 
@@ -33,28 +34,31 @@ module Pod
33
34
  @binary = argv.flag?('binary')
34
35
  @reserve_created_spec = argv.flag?('reserve-created-spec')
35
36
  @template_podspec = argv.option('template-podspec')
37
+ @allow_prerelease = argv.flag?('allow-prerelease')
36
38
  super
37
39
 
38
40
  @additional_args = argv.remainder!
39
41
  end
40
42
 
41
43
  def run
42
- Podfile.execute_with_use_binaries(!@code_dependencies) do
43
- argvs = [
44
- "--sources=#{sources_option(@code_dependencies, @sources)}",
45
- *@additional_args
46
- ]
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
+ ]
47
50
 
48
- argvs << spec_file if spec_file
51
+ argvs << spec_file if spec_file
49
52
 
50
- if @loose_options
51
- argvs += ['--allow-warnings']
52
- argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
53
- end
53
+ if @loose_options
54
+ argvs += ['--allow-warnings']
55
+ argvs << '--use-libraries' if code_spec&.all_dependencies&.any?
56
+ end
54
57
 
55
- lint = Pod::Command::Spec::Lint.new(CLAide::ARGV.new(argvs))
56
- lint.validate!
57
- lint.run
58
+ lint = Pod::Command::Spec::Lint.new(CLAide::ARGV.new(argvs))
59
+ lint.validate!
60
+ lint.run
61
+ end
58
62
  end
59
63
  ensure
60
64
  clear_binary_spec_file_if_needed unless @reserve_created_spec
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
4
4
 
5
5
  module Pod
@@ -5,9 +5,14 @@ module Pod
5
5
  USE_BINARIES = 'use_binaries'.freeze
6
6
  USE_SOURCE_PODS = 'use_source_pods'.freeze
7
7
  USE_BINARIES_SELECTOR = 'use_binaries_selector'.freeze
8
+ ALLOW_PRERELEASE = 'allow_prerelease'.freeze
8
9
  # TREAT_DEVELOPMENTS_AS_NORMAL = 'treat_developments_as_normal'.freeze
9
10
 
10
11
  module DSL
12
+ def allow_prerelease!
13
+ set_internal_hash_value(ALLOW_PRERELEASE, true)
14
+ end
15
+
11
16
  def use_binaries!(flag = true)
12
17
  set_internal_hash_value(USE_BINARIES, flag)
13
18
  end
@@ -26,6 +31,10 @@ module Pod
26
31
  end
27
32
 
28
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
+
29
38
  def execute_with_use_binaries(use_binaries, &block)
30
39
  execute_with_key(USE_BINARIES, -> { use_binaries ? 'true' : 'false' }, &block)
31
40
  end
@@ -46,6 +55,10 @@ module Pod
46
55
  get_internal_hash_value(USE_BINARIES_SELECTOR, nil)
47
56
  end
48
57
 
58
+ def allow_prerelease?
59
+ get_internal_hash_value(ALLOW_PRERELEASE, false) || ENV[ALLOW_PRERELEASE] == 'true'
60
+ end
61
+
49
62
  def use_binaries?
50
63
  get_internal_hash_value(USE_BINARIES, false) || ENV[USE_BINARIES] == 'true'
51
64
  end
@@ -7,6 +7,37 @@ require 'cocoapods-bin/gem_version'
7
7
 
8
8
  module Pod
9
9
  class Resolver
10
+
11
+ if Pod.match_version?('~> 1.4')
12
+ def specifications_for_dependency(dependency, additional_requirements = [])
13
+ requirement = Requirement.new(dependency.requirement.as_list + additional_requirements.flat_map(&:as_list))
14
+ requirement = Requirement.new(dependency.requirement.as_list.map { |r| r + '.a' } + additional_requirements.flat_map(&:as_list)) if podfile.allow_prerelease? && !requirement.prerelease?
15
+ find_cached_set(dependency).
16
+ all_specifications(installation_options.warn_for_multiple_pod_sources).
17
+ select { |s| requirement.satisfied_by? s.version }.
18
+ map { |s| s.subspec_by_name(dependency.name, false, true) }.
19
+ compact
20
+ end
21
+ end
22
+
23
+ if Pod.match_version?('~> 1.6')
24
+ alias_method :old_valid_possibility_version_for_root_name?, :valid_possibility_version_for_root_name?
25
+ def valid_possibility_version_for_root_name?(requirement, activated, spec)
26
+ return true if podfile.allow_prerelease?
27
+ old_valid_possibility_version_for_root_name?(requirement, activated, spec)
28
+ end
29
+ elsif Pod.match_version?('~> 1.4')
30
+ def requirement_satisfied_by?(requirement, activated, spec)
31
+ version = spec.version
32
+ return false unless requirement.requirement.satisfied_by?(version)
33
+ shared_possibility_versions, prerelease_requirement = possibility_versions_for_root_name(requirement, activated)
34
+ return false if !shared_possibility_versions.empty? && !shared_possibility_versions.include?(version)
35
+ return false if !podfile.allow_prerelease? && version.prerelease? && !prerelease_requirement
36
+ return false unless spec_is_platform_compatible?(activated, requirement, spec)
37
+ true
38
+ end
39
+ end
40
+
10
41
  # >= 1.4.0 才有 resolver_specs_by_target 以及 ResolverSpecification
11
42
  # >= 1.5.0 ResolverSpecification 才有 source,供 install 或者其他操作时,输入 source 变更
12
43
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - tripleCC
@@ -66,7 +66,8 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: cocoapods pods source switcher.
69
+ description: cocoapods-bin is a plugin which helps develpers switching pods between
70
+ source code and binary.
70
71
  email:
71
72
  - triplec.linux@gmail.com
72
73
  executables: []