cocoapods-tdfire-binary 1.3.7 → 1.3.8

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: ea1d376b0a06e9e6e6ed83ebb20eb4ef788eadec
4
- data.tar.gz: 38db755f1e60f2c6a06318b4392abccfbf4f54d1
3
+ metadata.gz: fece042809d277fc9ced8983f9ddfe21be344ae8
4
+ data.tar.gz: b868c43363b5f13885739fe8e9d31b954ddb231b
5
5
  SHA512:
6
- metadata.gz: 4b17d33a39e4baa73717c7644aff7e94732a067f5ff3b39b4c38aed31ff349a4002a08ccf75f44b0f76657445073d4cd477097ac27358cc0182b4934cde8bc13
7
- data.tar.gz: 6b3805bfd0b6a35b5ec09cc56aa49fd78955da75758bde29f678bbfad518ec168dfcc75a09fa9e884cfabb972165873538326402cff08195dcf51c44b2a1637b
6
+ metadata.gz: 9895fab2d02a195aaee0ed6caf29db32ca386e8e856f9ce0411ac60f97444f2644d96be0fb00c9f31ece79d7cc8198aab7c56a630253fc683374262f37cb0535
7
+ data.tar.gz: 822a298b41f9a8b64201c2e77522cc7addb82a995c830da641b3b2d1c114c369874be9646c69f62d586141229ff1be2f1254f533837087df6275df6b158bc26f
data/README.md CHANGED
@@ -30,22 +30,103 @@
30
30
 
31
31
  ## 使用
32
32
 
33
+ > 二进制组件发布
33
34
 
35
+ 此插件需要结合[二进制服务器](https://github.com/tripleCC/binary-server)使用,运行服务器之后,就可以测试二进制打包了。
34
36
 
35
- 此插件需要结合二进制服务器使用,其中主要接口如下:
37
+ 运行 `pod binary init` 配置二进制插件基本信息,其中包括二进制服务器地址,私有源 Git 地址,pod 模版地址:
36
38
 
39
+ ```shell
40
+ 开始设置二进制化初始信息.
41
+ 所有的信息都会保存在 binary_config.yaml 文件中.
42
+ 你可以在 /Users/songruiwang/.cocoapods/binary_config.yml 目录下手动添加编辑该文件.
43
+ /Users/songruiwang/.cocoapods/binary_config.yml 文件包含配置信息如下:
37
44
 
45
+ ---
46
+ server_host: 输入二进制服务器地址 (比如 http://xxxxx:8080)
47
+ repo_url: 输入私有源 Git 地址 (比如 https://github.com/tripleCC/PrivateSpecRepo.git)
48
+ template_url: 输入 pod 模版 Git 地址 (比如 https://github.com/CocoaPods/pod-template.git)
38
49
 
50
+
51
+ 输入二进制服务器地址 (比如 http://xxxxx:8080)
52
+ 旧值:http://localhost:8080
53
+ >
54
+ http://localhost:8080
55
+
56
+ 输入私有源 Git 地址 (比如 https://github.com/tripleCC/PrivateSpecRepo.git)
57
+ 旧值:git@git.2dfire-inc.com:ios/cocoapods-spec.git
58
+ >
59
+ git@git.2dfire-inc.com:ios/cocoapods-spec.git
60
+
61
+ 输入 pod 模版 Git 地址 (比如 https://github.com/CocoaPods/pod-template.git)
62
+ 旧值:git@git.2dfire-inc.com:ios/binary-pod-template.git
63
+ >
64
+ git@git.2dfire-inc.com:ios/binary-pod-template.git
65
+
66
+ 设置完成.
39
67
  ```
40
68
 
69
+ 设置完成之后,运行 `pod binary lib create` 创建组件库。
70
+
71
+ 组件库创建完成后,修改 `podspec` 文件:
72
+
73
+ ```ruby
74
+ Pod::Spec.new do |s|
75
+ s.name = 'XXXX'
76
+ ....
77
+
78
+ tdfire_source_configurator = lambda do |s|
79
+ # 把一些源码配置移到 lambda 中
80
+ # source configuration
81
+ # s.source_files = 'PodA/Classes/**/*'
82
+ # s.resource_bundles = {
83
+ # 'PodA' => ['PodA/Assets/*']
84
+ # }
85
+ end
86
+
87
+ # 此段原样拷贝即可
88
+ unless %w[tdfire_set_binary_download_configurations tdfire_source tdfire_binary].reduce(true) { |r, m| s.respond_to?(m) & r }
89
+
90
+ tdfire_source_configurator.call s
91
+ else
92
+ s.tdfire_source tdfire_source_configurator
93
+ s.tdfire_binary tdfire_source_configurator
94
+ s.tdfire_set_binary_download_configurations
95
+ end
96
+ end
41
97
  ```
42
98
 
99
+ 修改完成后,提交代码,打个 Tag ,推送至远程仓库。
100
+
101
+ 接下来处理二进制版本事宜。
102
+
103
+ 首先执行 `pod binary package` 创建二进制版本(静态 framework),可以看到本地文件中会新增 `xxx.framework.zip` 压缩文件。
104
+
105
+ 接下来执行 `pod binary push` 推送二进制至服务器,执行 `pod binary list` 可以查看推送上去的组件信息。
106
+
107
+ 源码和二进制版本都安排妥当,就可以执行 `pod binary publish` 发布组件了。
108
+
109
+ > 使用二进制组件
43
110
 
111
+ 执行 `pod binary lib create` 创建测试工程,修改 `Podfile` :
44
112
 
113
+ ```ruby
114
+ # 引入插件
115
+ plugin 'cocoapods-tdfire-binary'
45
116
 
117
+ # 使用二进制依赖
118
+ tdfire_use_binary!
46
119
 
120
+ # 使用源码依赖的组件
121
+ tdfire_use_source_pods ['AFNetworking']
47
122
  ```
48
123
 
124
+ 运行 `pod update --verbose`,可以看到插件输出额外的 `Tdfire: xxx` 信息。
125
+
126
+ 集成完成后,点击工程 `Pods` 下对应组件目录,就可以看到此次集成采用的二进制依赖了。
127
+
128
+ <!-- ```
129
+
49
130
 
50
131
  Usage:
51
132
 
@@ -179,4 +260,4 @@ end
179
260
  ```
180
261
  env tdfire_use_binary=1 tdfire_unpublished_pods=PodA pod lib lint xxxx
181
262
  env tdfire_force_use_source=1 pod install
182
- ```
263
+ ``` -->
@@ -50,9 +50,15 @@ module Pod
50
50
  end
51
51
 
52
52
  def private_sources(keywords = repo_url)
53
- config.sources_manager.all.select do |source|
53
+ sources = config.sources_manager.all.select do |source|
54
54
  source.url.downcase.include? keywords
55
55
  end
56
+
57
+ if sources.empty?
58
+ raise Pod::Informative, "获取不到与 #{repo_url} 相关的私有源信息,执行 pod binary init 或手动在 #{binary_setting_file} 重新设置."
59
+ end
60
+
61
+ sources
56
62
  end
57
63
 
58
64
  private
@@ -4,7 +4,7 @@ module Pod
4
4
  module Tdfire
5
5
  class BinaryUrlManager
6
6
  def self.pull_url_for_pod_version(pod, version)
7
- host + "/download/#{pod}/#{version}"
7
+ host + "/frameworks/#{pod}/#{version}/zip"
8
8
  end
9
9
 
10
10
  def self.get_pull_url_for_pod_version(pod, version)
@@ -13,36 +13,32 @@ module Pod
13
13
  run_curl command
14
14
  end
15
15
 
16
- def self.push_url
17
- host + "/upload" #+ param
18
- end
19
-
20
16
  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}"
17
+ param = %Q[-F "name=#{name}" -F "version=#{version}" -F "annotate=#{commit}" -F "file=@#{path}" -F "sha=#{commit_hash}"]
18
+ command = "curl #{host}/frameworks #{param}"
23
19
 
24
20
  run_curl command
25
21
  end
26
22
 
27
23
  def self.delete_binary(name, version)
28
- command = "curl -X 'DELETE' #{host}/framework/#{name}/#{version} -O -J"
24
+ command = "curl -X 'DELETE' #{host}/frameworks/#{name}/#{version} -O -J"
29
25
  run_curl command
30
26
  end
31
27
 
32
28
  def self.list_binary()
33
- command = "curl #{host}/frameworks\?allinfo=true"
29
+ command = "curl #{host}/frameworks"
34
30
  run_curl command
35
31
  end
36
32
 
37
33
  def self.search_binary(name)
38
- command = "curl #{host}/framework/#{name}"
34
+ command = "curl #{host}/frameworks/#{name}"
39
35
  run_curl command
40
36
  end
41
37
 
42
38
  def self.run_curl(command)
43
39
  Pod::UI.message "CURL: \n" + command + "\n"
44
40
 
45
- result = `#{command} -s -m 5`
41
+ result = `#{command} -f -s -m 5`
46
42
 
47
43
  raise Pod::Informative, "执行 #{command} 失败,查看网络或者 binary_config.yml 配置." if $?.exitstatus != 0
48
44
 
@@ -21,9 +21,9 @@ module Pod
21
21
  @asker.wellcome_message
22
22
 
23
23
  hash = binary_config.setting_hash
24
-
25
24
  Pod::Tdfire::InitAsker::QUESTIONS.each do |k, v|
26
- hash[k] = @asker.ask_with_answer(v, hash[k])
25
+ default = hash[k] unless hash.nil?
26
+ hash[k] = @asker.ask_with_answer(v, default)
27
27
  end
28
28
 
29
29
  binary_config.config_with_setting(hash)
@@ -41,11 +41,13 @@ module Pod
41
41
  name = spec.name
42
42
  end
43
43
 
44
- path += ZIP_SUBFFIX unless path.end_with?(ZIP_SUBFFIX)
44
+ if path
45
+ path += ZIP_SUBFFIX unless path.end_with?(ZIP_SUBFFIX)
46
+ end
45
47
 
46
48
 
47
49
  @path = path
48
- @name = name || path.split('/').last.sub(ZIP_SUBFFIX, '')
50
+ @name = name || path.split('/').last.sub(ZIP_SUBFFIX, '') if path
49
51
  @version = version
50
52
  @commit = commit
51
53
  super
@@ -30,10 +30,11 @@ module Pod
30
30
  def run
31
31
  result = Pod::Tdfire::BinaryUrlManager.search_binary(@name)
32
32
  pod = JSON.parse(result) unless result.nil?
33
- pod ||= {'' => []}
33
+ pod ||= {@name => []}
34
34
 
35
- name = pod['name'] || @name
36
- versions = pod['versions'] || []
35
+
36
+ name = pod.keys.first
37
+ versions = pod.values.first || []
37
38
 
38
39
  title = "-> #{name} (#{versions.last})".green
39
40
 
@@ -1,3 +1,3 @@
1
1
  module CocoapodsTdfireBinary
2
- VERSION = "1.3.7"
2
+ VERSION = "1.3.8"
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.3.7
4
+ version: 1.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - tripleCC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-28 00:00:00.000000000 Z
11
+ date: 2018-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler