cocoapods-tdfire-binary 1.3.8 → 1.3.9

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: fece042809d277fc9ced8983f9ddfe21be344ae8
4
- data.tar.gz: b868c43363b5f13885739fe8e9d31b954ddb231b
3
+ metadata.gz: 634fd53981febf3d906dc8eac645e9fcb3aa587c
4
+ data.tar.gz: 249b2eee8fede99bb2e13b4529e5bfdfde90c0ef
5
5
  SHA512:
6
- metadata.gz: 9895fab2d02a195aaee0ed6caf29db32ca386e8e856f9ce0411ac60f97444f2644d96be0fb00c9f31ece79d7cc8198aab7c56a630253fc683374262f37cb0535
7
- data.tar.gz: 822a298b41f9a8b64201c2e77522cc7addb82a995c830da641b3b2d1c114c369874be9646c69f62d586141229ff1be2f1254f533837087df6275df6b158bc26f
6
+ metadata.gz: 64ad162b0a8c2a9133105879a3a8736af3da1cc9f527c58f26a4f66f89784df6b4fcda6c6cb166f9629e8b367013eb933edb57ab7c01d77574428dfec5cf7a4d
7
+ data.tar.gz: f78da99150e3aa00ddda4355af716764acb9a554a8941e83f93df0184849383c3728b693cc6928e7ccffa3622d4698cf59d49508c626ba2e5fb9d6d6b8aff930
data/README.md CHANGED
@@ -30,103 +30,22 @@
30
30
 
31
31
  ## 使用
32
32
 
33
- > 二进制组件发布
34
33
 
35
- 此插件需要结合[二进制服务器](https://github.com/tripleCC/binary-server)使用,运行服务器之后,就可以测试二进制打包了。
36
34
 
37
- 运行 `pod binary init` 配置二进制插件基本信息,其中包括二进制服务器地址,私有源 Git 地址,pod 模版地址:
35
+ 此插件需要结合二进制服务器使用,其中主要接口如下:
38
36
 
39
- ```shell
40
- 开始设置二进制化初始信息.
41
- 所有的信息都会保存在 binary_config.yaml 文件中.
42
- 你可以在 /Users/songruiwang/.cocoapods/binary_config.yml 目录下手动添加编辑该文件.
43
- /Users/songruiwang/.cocoapods/binary_config.yml 文件包含配置信息如下:
44
37
 
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)
49
38
 
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
- 设置完成.
67
39
  ```
68
40
 
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
97
41
  ```
98
42
 
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
- > 使用二进制组件
110
43
 
111
- 执行 `pod binary lib create` 创建测试工程,修改 `Podfile` :
112
44
 
113
- ```ruby
114
- # 引入插件
115
- plugin 'cocoapods-tdfire-binary'
116
45
 
117
- # 使用二进制依赖
118
- tdfire_use_binary!
119
46
 
120
- # 使用源码依赖的组件
121
- tdfire_use_source_pods ['AFNetworking']
122
47
  ```
123
48
 
124
- 运行 `pod update --verbose`,可以看到插件输出额外的 `Tdfire: xxx` 信息。
125
-
126
- 集成完成后,点击工程 `Pods` 下对应组件目录,就可以看到此次集成采用的二进制依赖了。
127
-
128
- <!-- ```
129
-
130
49
 
131
50
  Usage:
132
51
 
@@ -260,4 +179,4 @@ end
260
179
  ```
261
180
  env tdfire_use_binary=1 tdfire_unpublished_pods=PodA pod lib lint xxxx
262
181
  env tdfire_force_use_source=1 pod install
263
- ``` -->
182
+ ```
@@ -50,15 +50,9 @@ module Pod
50
50
  end
51
51
 
52
52
  def private_sources(keywords = repo_url)
53
- sources = config.sources_manager.all.select do |source|
53
+ 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
62
56
  end
63
57
 
64
58
  private
@@ -4,41 +4,45 @@ module Pod
4
4
  module Tdfire
5
5
  class BinaryUrlManager
6
6
  def self.pull_url_for_pod_version(pod, version)
7
- host + "/frameworks/#{pod}/#{version}/zip"
7
+ host + "/download/#{pod}/#{version}"
8
8
  end
9
9
 
10
10
  def self.get_pull_url_for_pod_version(pod, version)
11
11
  command = "curl #{pull_url_for_pod_version(pod, version)} > #{pod}.framework.zip"
12
12
 
13
- run_curl command
13
+ run_curl command, 20
14
+ end
15
+
16
+ def self.push_url
17
+ host + "/upload" #+ param
14
18
  end
15
19
 
16
20
  def self.post_push_url(name, version, path, commit = nil, commit_hash = nil)
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}"
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}"
19
23
 
20
- run_curl command
24
+ run_curl command, 20
21
25
  end
22
26
 
23
27
  def self.delete_binary(name, version)
24
- command = "curl -X 'DELETE' #{host}/frameworks/#{name}/#{version} -O -J"
28
+ command = "curl -X 'DELETE' #{host}/framework/#{name}/#{version} -O -J"
25
29
  run_curl command
26
30
  end
27
31
 
28
32
  def self.list_binary()
29
- command = "curl #{host}/frameworks"
33
+ command = "curl #{host}/frameworks\?allinfo=true"
30
34
  run_curl command
31
35
  end
32
36
 
33
37
  def self.search_binary(name)
34
- command = "curl #{host}/frameworks/#{name}"
38
+ command = "curl #{host}/framework/#{name}"
35
39
  run_curl command
36
40
  end
37
41
 
38
- def self.run_curl(command)
42
+ def self.run_curl(command, time_out = 5)
39
43
  Pod::UI.message "CURL: \n" + command + "\n"
40
44
 
41
- result = `#{command} -f -s -m 5`
45
+ result = `#{command} -s -m #{time_out}`
42
46
 
43
47
  raise Pod::Informative, "执行 #{command} 失败,查看网络或者 binary_config.yml 配置." if $?.exitstatus != 0
44
48
 
@@ -21,9 +21,9 @@ module Pod
21
21
  @asker.wellcome_message
22
22
 
23
23
  hash = binary_config.setting_hash
24
+
24
25
  Pod::Tdfire::InitAsker::QUESTIONS.each do |k, v|
25
- default = hash[k] unless hash.nil?
26
- hash[k] = @asker.ask_with_answer(v, default)
26
+ hash[k] = @asker.ask_with_answer(v, hash[k])
27
27
  end
28
28
 
29
29
  binary_config.config_with_setting(hash)
@@ -30,11 +30,10 @@ 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 ||= {@name => []}
33
+ pod ||= {'' => []}
34
34
 
35
-
36
- name = pod.keys.first
37
- versions = pod.values.first || []
35
+ name = pod['name'] || @name
36
+ versions = pod['versions'] || []
38
37
 
39
38
  title = "-> #{name} (#{versions.last})".green
40
39
 
@@ -1,3 +1,3 @@
1
1
  module CocoapodsTdfireBinary
2
- VERSION = "1.3.8"
2
+ VERSION = "1.3.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-tdfire-binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - tripleCC