cocoapods-tdfire-binary 1.2.1 → 1.2.2

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: 7915044a0d73ec21c492c83bb27b87d7d9ea834f
4
- data.tar.gz: 5f76e87ee1c80a862f0bffb5093d20637b6f07e9
3
+ metadata.gz: 45829ae42e2a0f6c412b2cf810af6f003b9a41e3
4
+ data.tar.gz: 8f5a58fa5f96f30572af33628d43ef3a6c4c3aee
5
5
  SHA512:
6
- metadata.gz: dac999ec5ab4483d7c64f80f819efefaec0e20e6088e11d47f26f26bd457e43e62603c16aab92f45d9755efe08891077299e2c1223d5e7036c1174240936c362
7
- data.tar.gz: d9807ae59b68239a08854b8db1cc54f3cfcaab446588420574bbfc7d96c6e93513ab1b4d01d5231f928112fc0ad83f4fd9ce59952d57b6aace8ec44cb072edc5
6
+ metadata.gz: ef3864030787c1e79cea783b4191a4ec78c0b1009ad4b7569efa77fbbd075f2254e7e8c6fb57820bae954251e6312e33650df143c4182fad24a53c19f8fd2ad1
7
+ data.tar.gz: bc6bf5177615471d48fdae5b079bced6592714ed2c36f162af7fbbadbf8cf958568991cb273a28a369c9e30d52b5c6135c3432dbcdbdc94299df55a3b84c7aef
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-tdfire-binary (1.2.1)
4
+ cocoapods-tdfire-binary (1.2.2)
5
5
  cocoapods (~> 1.2)
6
6
  cocoapods-packager (~> 1.5.0)
7
7
 
data/README.md CHANGED
@@ -2,13 +2,9 @@
2
2
 
3
3
  <a href="https://travis-ci.org/tripleCC/cocoapods-tdfire-binary"><img src="https://img.shields.io/travis/tripleCC/cocoapods-tdfire-binary/master.svg"></a>
4
4
 
5
- ## 安装
6
-
7
- $ gem install cocoapods-tdfire-binary
8
5
 
9
6
 
10
-
11
- ## 插件目标
7
+ 辅助组件二进制组件化的 CocoaPods 插件,适合希望解决以下业务场景的开发者:
12
8
 
13
9
 
14
10
 
@@ -24,92 +20,30 @@
24
20
 
25
21
 
26
22
 
27
- ## 二进制化策略
28
-
29
- ### 二进制依赖方式
30
-
31
23
 
32
24
 
33
- 先了解下 podspec 的 source 字段,它接收一个 Hash,这个 Hash 对象指定了组件的储存地址。我们可以使用 keys 如下:
34
-
35
-
36
-
37
- ```ruby
38
- :git => :tag, :branch, :commit, :submodules
39
- :svn => :folder, :tag, :revision
40
- :hg => :revision
41
- :http => :flatten, :type, :sha256, :sha1
42
- ```
43
-
44
- 其中值得注意的有两个 key ,:git 不多说,这里说下 :http。 podspec 允许通过 HTTP 去下载组件代码压缩包,支持 zip, tgz, bz2, txz 和 tar 格式 :
45
-
46
-
47
-
48
- ```ruby
49
- spec.source = { :http => 'http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip' }
50
- ```
25
+ ## 安装
51
26
 
52
- 结合上面对 source 字段的了解,可以解决一个比较关键的问题:二进制文件存在哪。这里的选择不多,“常规”无非两种:
27
+ $ gem install cocoapods-tdfire-binary
53
28
 
54
29
 
55
30
 
56
- 1. 和源码一样,存在 tag 中
57
- 2. 起一个独立的二进制文件服务器
31
+ ## 使用
58
32
 
59
- 为什么说 “常规”,因为还有一种“非常规”的选择一一把源码和二进制一起打成 zip ,存在文件服务器上,通过指定 source 为 :http 去下载。当然,由于和 GitLab 本身的 tag 作用冲突,这种方式并不推荐。
60
33
 
61
- 接下来比较下“常规”的两种方式。
62
34
 
63
- 首先是实现起来较简单第一种,在把 framework 加入 tag 后,只需对 podspec 做如下更改:
35
+ 此插件需要结合二进制服务器使用,其中主要接口如下:
64
36
 
65
37
 
66
38
 
67
- ```ruby
68
- ...
69
- s.source = { :git => 'git 地址',
70
- :tag => s.version.to_s }
71
- if ENV['use_binary']
72
- s.vendored_frameworks = 'framework 的相对路径'
73
- else
74
- s.source_files = '源码文件路径'
75
- s.public_header_files = '需要暴露的头文件路径'
76
- end
77
- ...
78
39
  ```
79
40
 
80
-
81
-
82
- 但是考虑到后期产生过多的二进制版本,势必会导致 GitLab 库急剧变大,所以暂时不考虑第一种方式。
83
-
84
- 第二种,我们可以通过编写如下样式的 podspec 实现:
85
-
86
-
87
-
88
- ```ruby
89
- ...
90
- if ENV['use_binary']
91
- spec.source = { :git => 'git url',
92
- :tag => s.version.to_s }
93
- else
94
- spec.source = { :http => 'binary server url' }
95
- end
96
- ...
97
41
  ```
98
42
 
99
43
 
100
44
 
101
45
 
102
46
 
103
-
104
-
105
- ## 插件说明
106
-
107
-
108
-
109
- ## 使用
110
-
111
-
112
-
113
47
  ```
114
48
 
115
49
 
data/explore.md ADDED
@@ -0,0 +1,78 @@
1
+
2
+
3
+ ## 二进制化策略
4
+
5
+ ### 二进制依赖方式
6
+
7
+
8
+
9
+ 先了解下 podspec 的 source 字段,它接收一个 Hash,这个 Hash 对象指定了组件的储存地址。我们可以使用 keys 如下:
10
+
11
+
12
+
13
+ ```ruby
14
+ :git => :tag, :branch, :commit, :submodules
15
+ :svn => :folder, :tag, :revision
16
+ :hg => :revision
17
+ :http => :flatten, :type, :sha256, :sha1
18
+ ```
19
+
20
+ 其中值得注意的有两个 key ,:git 不多说,这里说下 :http。 podspec 允许通过 HTTP 去下载组件代码压缩包,支持 zip, tgz, bz2, txz 和 tar 格式 :
21
+
22
+
23
+
24
+ ```ruby
25
+ spec.source = { :http => 'http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip' }
26
+ ```
27
+
28
+ 结合上面对 source 字段的了解,可以解决一个比较关键的问题:二进制文件存在哪。这里的选择不多,“常规”无非两种:
29
+
30
+
31
+
32
+ 1. 和源码一样,存在 tag 中
33
+ 2. 起一个独立的二进制文件服务器
34
+
35
+ 为什么说 “常规”,因为还有一种“非常规”的选择一一把源码和二进制一起打成 zip ,存在文件服务器上,通过指定 source 为 :http 去下载。当然,由于和 GitLab 本身的 tag 作用冲突,这种方式并不推荐。
36
+
37
+ 接下来比较下“常规”的两种方式。
38
+
39
+ 首先是实现起来较简单第一种,在把 framework 加入 tag 后,只需对 podspec 做如下更改:
40
+
41
+
42
+
43
+ ```ruby
44
+ ...
45
+ s.source = { :git => 'git 地址',
46
+ :tag => s.version.to_s }
47
+ if ENV['use_binary']
48
+ s.vendored_frameworks = 'framework 的相对路径'
49
+ else
50
+ s.source_files = '源码文件路径'
51
+ s.public_header_files = '需要暴露的头文件路径'
52
+ end
53
+ ...
54
+ ```
55
+
56
+
57
+
58
+ 但是考虑到后期产生过多的二进制版本,势必会导致 GitLab 库急剧变大,所以暂时不考虑第一种方式。
59
+
60
+ 第二种,我们可以通过编写如下样式的 podspec 实现:
61
+
62
+
63
+
64
+ ```ruby
65
+ ...
66
+ if ENV['use_binary']
67
+ spec.source = { :git => 'git url',
68
+ :tag => s.version.to_s }
69
+ else
70
+ spec.source = { :http => 'binary server url' }
71
+ end
72
+ ...
73
+ ```
74
+
75
+
76
+
77
+
78
+
@@ -36,6 +36,8 @@ module Pod
36
36
  # 判断有效组件的 cache 中是否有二进制,没有的话,删除组件缓存
37
37
  specs = use_binary_specs - no_binary_specs
38
38
 
39
+ return if specs.empty?
40
+
39
41
  UI.section 'Tdfire: 处理没有二进制版本的组件' do
40
42
  specs.each do |s|
41
43
  # 处理 cache
@@ -78,7 +80,8 @@ module Pod
78
80
  @analysis_result.sandbox_state.add_name(spec.name, :changed)
79
81
  begin
80
82
  FileUtils.rm_rf(pod_dir)
81
- rescue
83
+ rescue => err
84
+ puts err
82
85
  end
83
86
  end
84
87
  end
@@ -97,9 +100,10 @@ module Pod
97
100
  unless (framework_file.exist?)
98
101
  UI.message "Tdfire: 删除缺少二进制的 Cache #{spec.root.name}"
99
102
  begin
100
- FileUtils.rm(descriptor[:spec_file])
101
- FileUtils.rm_rf(descriptor[:slug])
102
- rescue
103
+ FileUtils.rm(d[:spec_file])
104
+ FileUtils.rm_rf(slug)
105
+ rescue => err
106
+ puts err
103
107
  end
104
108
  end
105
109
  end
@@ -1,65 +1,65 @@
1
1
  require 'cocoapods-tdfire-binary/binary_config'
2
2
 
3
3
  module Pod
4
- module Tdfire
5
- class BinaryUrlManager
4
+ module Tdfire
5
+ class BinaryUrlManager
6
6
  def self.pull_url_for_pod_version(pod, version)
7
- host + "/download/#{pod}/#{version}"
8
- end
7
+ host + "/download/#{pod}/#{version}"
8
+ end
9
9
 
10
- def self.get_pull_url_for_pod_version(pod, version)
11
- command = "curl #{pull_url_for_pod_version(pod, version)} > #{pod}.framework.zip"
10
+ def self.get_pull_url_for_pod_version(pod, version)
11
+ command = "curl #{pull_url_for_pod_version(pod, version)} > #{pod}.framework.zip"
12
12
 
13
- run_curl command
14
- end
13
+ run_curl command
14
+ end
15
15
 
16
- def self.push_url
16
+ def self.push_url
17
17
  host + "/upload" #+ param
18
- end
18
+ end
19
19
 
20
- def self.post_push_url(name, version, path, commit = nil, commit_hash = nil)
21
- param = %Q[-F "frameworkName=#{name}" -F "version=#{version}" -F "changelog=#{commit}" -F "featureName=#{commit}" -F "framework=@#{path}" -F "commitHash=#{commit_hash}"]
22
- command = "curl #{push_url} #{param}"
20
+ def self.post_push_url(name, version, path, commit = nil, commit_hash = nil)
21
+ param = %Q[-F "frameworkName=#{name}" -F "version=#{version}" -F "changelog=#{commit}" -F "featureName=#{commit}" -F "framework=@#{path}" -F "commitHash=#{commit_hash}"]
22
+ command = "curl #{push_url} #{param}"
23
23
 
24
- run_curl command
25
- end
24
+ run_curl command
25
+ end
26
26
 
27
- def self.delete_binary(name, version)
28
- command = "curl -X 'DELETE' #{host}/framework/#{name}/#{version} -O -J"
29
- run_curl command
30
- end
27
+ def self.delete_binary(name, version)
28
+ command = "curl -X 'DELETE' #{host}/framework/#{name}/#{version} -O -J"
29
+ run_curl command
30
+ end
31
31
 
32
- def self.list_binary()
33
- command = "curl #{host}/frameworks\?allinfo=true"
34
- run_curl command
35
- end
32
+ def self.list_binary()
33
+ command = "curl #{host}/frameworks\?allinfo=true"
34
+ run_curl command
35
+ end
36
36
 
37
- def self.search_binary(name)
38
- command = "curl #{host}/framework/#{name}"
39
- run_curl command
40
- end
37
+ def self.search_binary(name)
38
+ command = "curl #{host}/framework/#{name}"
39
+ run_curl command
40
+ end
41
41
 
42
- def self.run_curl(command)
43
- Pod::UI.message "CURL: \n" + command + "\n"
42
+ def self.run_curl(command)
43
+ Pod::UI.message "CURL: \n" + command + "\n"
44
44
 
45
- result = `#{command} -s -m 5`
45
+ result = `#{command} -s -m 5`
46
46
 
47
- raise Pod::Informative, "执行 #{command} 失败,查看网络或者 binary_config.yml 配置." if $?.exitstatus != 0
47
+ raise Pod::Informative, "执行 #{command} 失败,查看网络或者 binary_config.yml 配置." if $?.exitstatus != 0
48
48
 
49
- result
50
- end
49
+ result
50
+ end
51
51
 
52
52
  def self.host
53
53
  BinaryConfig.instance.server_host
54
54
  end
55
55
 
56
- def self.private_cocoapods_url
56
+ def self.private_cocoapods_url
57
57
  BinaryConfig.instance.repo_url
58
- end
58
+ end
59
59
 
60
- def self.template_lib_url
60
+ def self.template_lib_url
61
61
  BinaryConfig.instance.template_url
62
- end
63
- end
64
- end
62
+ end
63
+ end
64
+ end
65
65
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsTdfireBinary
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-tdfire-binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tripleCC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2018-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,6 +114,7 @@ files:
114
114
  - example/test/test/Assets/.gitkeep
115
115
  - example/test/test/Classes/.gitkeep
116
116
  - example/test/test/Classes/ReplaceMe.m
117
+ - explore.md
117
118
  - lib/cocoapods-tdfire-binary.rb
118
119
  - lib/cocoapods-tdfire-binary/binary_cache_cleaner.rb
119
120
  - lib/cocoapods-tdfire-binary/binary_config.rb