cocoapods-dongjia 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: 2f058eeb279bb4d5dd289e40603e490e3d53e59e34f2f83cb5c43ebe0bcb8479
4
- data.tar.gz: 3d08fd738481fc88bc165772fc800aed48547b65dea27732d083f86f1b06b4cf
3
+ metadata.gz: fff0abb621b63173844d0bc61aac836d53b99409c3188dcf3cc9ed0010b8c57a
4
+ data.tar.gz: f7955cc93569b28eb0660b62f4909573718f1831f21c7f9160829fb2315b8d76
5
5
  SHA512:
6
- metadata.gz: 74689cf1250bd97272fc9605a257544039f737f3ded014856a2cf03583a3d13b6f27d56fce5880fbbb601bda87376d21358fef5fdce43a0a9c44d7fb97b0fdbd
7
- data.tar.gz: 6ee0bf4a3048313fd4fd67a8c24715427b5b84907fe1aac4e76570b070e34c8de02ca822c941e8693570cf91f1b9335a14e7aebe69381956a2536fd516bfbe53
6
+ metadata.gz: a61a7b1bd97990903f9186db5f5bb3d5745421f61cf1ac4aa59f4d7d8c85a0de52d4518dba9e8473e2c994b5e3aa60d768f97198b5c61c3ee2f4ceb9943d6745
7
+ data.tar.gz: 66133007037b29df7d8b083ed76102038dd8d07ca26cc98fdacd074a62f79d4835615dbb089e0e9b086ab3ee03b4cbec6b84f8840f426fc36d2c25a409633bce
@@ -1,3 +1,3 @@
1
1
  module CocoapodsDongjia
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -1,9 +1,12 @@
1
1
  require 'cocoapods-dongjia/command'
2
2
  require_relative 'dongjia_source'
3
3
  require_relative 'dongjia_inspector'
4
- require_relative 'dongjia_import_helper'
5
4
  require_relative 'dongjia_warning_manager'
6
5
 
6
+ require_relative 'helper/podfile_local_importer'
7
+ require_relative 'helper/podfile_options'
8
+ require_relative 'helper/podfile_warnings'
9
+
7
10
  module Dongjia
8
11
 
9
12
  Pod::HooksManager.register('cocoapods-dongjia', :pre_install) do |ctx, params|
@@ -20,7 +23,7 @@ module Dongjia
20
23
 
21
24
  Pod::HooksManager.register('cocoapods-dongjia', :post_install) do |ctx, params|
22
25
 
23
- # 关闭一些警告
26
+ # 关闭工程内的一些警告
24
27
  DongjiaWarningManager.turn_off_warnings(
25
28
  params[:turn_off_warnings],
26
29
  ctx.sandbox_root
@@ -9,7 +9,7 @@ module Pod
9
9
  if branch == 'dev' or branch == 'master'
10
10
 
11
11
  # Hook pod 方法
12
- alias_method :original_pod, :pod
12
+ alias_method :pod_alias_by_inspector, :pod
13
13
 
14
14
  def pod(name = nil, *requirements, &block)
15
15
 
@@ -27,7 +27,7 @@ module Pod
27
27
  end
28
28
  end
29
29
 
30
- original_pod(name, *requirements, &block)
30
+ pod_alias_by_inspector(name, *requirements, &block)
31
31
  end
32
32
 
33
33
  end
data/lib/helper/pod.rb ADDED
@@ -0,0 +1,12 @@
1
+ module Pod
2
+
3
+ def self.repo_name(name)
4
+ pos = name.index('/')
5
+ ret = pos == nil ? name : name[0, pos]
6
+ if ret == 'ProtocolBuffers'
7
+ ret = 'protobuf-objc'
8
+ end
9
+ ret
10
+ end
11
+
12
+ end
@@ -0,0 +1,30 @@
1
+ require_relative 'pod'
2
+
3
+ module Pod
4
+
5
+ class Podfile
6
+
7
+ # 导入工程目录下相对位置的 pod
8
+ @local_spec_importing = false
9
+ @local_spec_path = nil
10
+ def import_relative_in(path = './')
11
+ @local_spec_importing = true
12
+ @local_spec_path = path
13
+ yield if block_given?
14
+ @local_spec_path = nil
15
+ @local_spec_importing = false
16
+ end
17
+
18
+ original_pod = instance_method(:pod)
19
+ define_method(:pod) do |name = nil, *requirements|
20
+ if @local_spec_importing
21
+ if requirements.length == 0
22
+ requirements = [{ :path => "#{@local_spec_path}/#{Pod::repo_name(name)}" }]
23
+ end
24
+ end
25
+ original_pod.bind(self).(name, *requirements)
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,58 @@
1
+ require_relative 'pod'
2
+
3
+ module Pod
4
+
5
+ class Podfile
6
+
7
+ module DSL
8
+ def localpod(name = nil, *requirements)
9
+ local_path = nil
10
+ local_root = ENV['POD_LOCAL_ROOT']
11
+ if !local_root
12
+ UI.warn '环境变量中未发现 POD_LOCAL_ROOT 定义'
13
+ elsif local_root.length
14
+ local_path = File.join(local_root, Pod::repo_name(name))
15
+ end
16
+ if local_path
17
+ requirements.pop
18
+ requirements.push({:path => local_path})
19
+ end
20
+ pod(name, *requirements)
21
+ end
22
+
23
+ alias :lpod :localpod
24
+ end
25
+
26
+ class TargetDefinition
27
+
28
+ def parse_requirements(name, requirements)
29
+
30
+ local_path = nil
31
+
32
+ options = requirements.last
33
+ if options.is_a?(Hash) && options[:local] == true
34
+ local_root = ENV['POD_LOCAL_ROOT']
35
+ if !local_root
36
+ UI.warn '环境变量中未发现 POD_LOCAL_ROOT 定义'
37
+ elsif local_root.length
38
+ local_path = File.join(local_root, Pod::repo_name(name))
39
+ end
40
+ end
41
+
42
+ if local_path
43
+ requirements.pop
44
+ requirements.push({:path => local_path})
45
+ end
46
+ end
47
+
48
+ old_method = instance_method(:parse_inhibit_warnings)
49
+ define_method(:parse_inhibit_warnings) do |name, requirements|
50
+ parse_requirements(name, requirements)
51
+ old_method.bind(self).(name, requirements)
52
+ end
53
+
54
+ end
55
+
56
+ end
57
+
58
+ end
@@ -0,0 +1,20 @@
1
+ module Pod
2
+
3
+ class Installer
4
+
5
+ class PodSourceInstaller
6
+
7
+ # 关闭自己仓库中 pod 的安全警告
8
+ old_method = instance_method(:verify_source_is_secure)
9
+ define_method(:verify_source_is_secure) do |root_spec|
10
+ url = root_spec.source[:http]
11
+ if url != nil && !url.start_with?('http://code.kaipao.cc')
12
+ old_method.bind(self).(root_spec)
13
+ end
14
+ end
15
+
16
+ end
17
+
18
+ end
19
+
20
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-dongjia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiangzhuoyi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-18 00:00:00.000000000 Z
11
+ date: 2019-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -50,10 +50,13 @@ files:
50
50
  - lib/cocoapods-dongjia/command/dongjia.rb
51
51
  - lib/cocoapods-dongjia/gem_version.rb
52
52
  - lib/cocoapods_plugin.rb
53
- - lib/dongjia_import_helper.rb
54
53
  - lib/dongjia_inspector.rb
55
54
  - lib/dongjia_source.rb
56
55
  - lib/dongjia_warning_manager.rb
56
+ - lib/helper/pod.rb
57
+ - lib/helper/podfile_local_importer.rb
58
+ - lib/helper/podfile_options.rb
59
+ - lib/helper/podfile_warnings.rb
57
60
  homepage: https://github.com/EXAMPLE/cocoapods-dongjia
58
61
  licenses:
59
62
  - MIT
@@ -1,80 +0,0 @@
1
- #
2
- # 辅助导入第三方或本地的 pod
3
- #
4
- module Pod
5
-
6
- class Podfile
7
-
8
- $IS_WRAPED = false
9
- $REMOTE_PATH = nil
10
- # 导入 gitlab 上的远程 pod
11
- def import_wrapper(path = 'components')
12
- $IS_WRAPED = true
13
- $REMOTE_PATH = path
14
- yield if block_given?
15
- $IS_WRAPED = false
16
- end
17
-
18
- # 导入本地 Components 目录下的 pod
19
- $IS_IMPORTING_LOCAL_SPEC = false
20
- def import_from_local_spec
21
- $IS_IMPORTING_LOCAL_SPEC = true
22
- yield if block_given?
23
- $IS_IMPORTING_LOCAL_SPEC = false
24
- end
25
-
26
- # Hook
27
- alias_method :pod_alias_by_import, :pod
28
- def pod(name = nil, *requirements)
29
-
30
- if $IS_WRAPED
31
-
32
- local_path = nil
33
- if requirements.include?(:local)
34
- local_root = ENV['POD_LOCAL_ROOT']
35
- if !local_root
36
- UI.warn '环境变量中未发现 POD_LOCAL_ROOT 定义'
37
- elsif local_root.length
38
- local_path = File.join(local_root, repo_name(name))
39
- end
40
- end
41
-
42
- if local_path
43
- requirements = [{:path => local_path}]
44
- end
45
-
46
- elsif $IS_IMPORTING_LOCAL_SPEC
47
-
48
- if requirements.length == 0
49
- requirements = [{ :path => "Components/#{repo_name(name)}" }]
50
- end
51
-
52
- end
53
-
54
- pod_alias_by_import(name, *requirements)
55
- end
56
-
57
- def repo_name(name)
58
- pos = name.index('/')
59
- ret = pos == nil ? name : name[0, pos]
60
- if ret == 'ProtocolBuffers'
61
- ret = 'protobuf-objc'
62
- end
63
- ret
64
- end
65
-
66
- end
67
-
68
- # 针对自己的 pod,关闭安全警告
69
- class Installer
70
- class PodSourceInstaller
71
- alias_method :verify_source_is_secure_alias_by_import, :verify_source_is_secure
72
- def verify_source_is_secure(root_spec)
73
- url = root_spec.source[:http]
74
- if url != nil && !url.start_with?('http://code.kaipao.cc')
75
- verify_source_is_secure_alias_by_import(root_spec)
76
- end
77
- end
78
- end
79
- end
80
- end