ppdbiu 0.2.2 → 0.2.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 +4 -4
- data/.gitignore +0 -2
- data/Gemfile.lock +2 -2
- data/LICENSE +10 -18
- data/README.md +116 -41
- data/lib/ppdbiu.rb +52 -0
- data/lib/ppdbiu/version.rb +16 -1
- metadata +2 -3
- data/LICENSE.txt +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bf2fb64138440028dd5af7b24ae707bc7919a37
|
4
|
+
data.tar.gz: 1d65e05fa93b506282fa14e23d375883aba920e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72d7d5af51267a7dffd406b9bc7e9016b874534404b848465e228df05258409c3ed61cbba08bc7ffdabf7f873c6dd4536f25b4112b1c5b7575c0c6f493df6c9f
|
7
|
+
data.tar.gz: ba1703988b5253ccd3a08084b693d98f22bd83ac59c9f54e572bfebc683ce6f29b917209813ae29a9ea9d98baca11d9cce02dbeb0b7d9a6be716431475d7bccb
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/LICENSE
CHANGED
@@ -1,21 +1,13 @@
|
|
1
|
-
|
1
|
+
Copyright 2018 ppdai.com
|
2
2
|
|
3
|
-
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
4
6
|
|
5
|
-
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,34 +1,44 @@
|
|
1
|
-
|
1
|
+
### 项目简介
|
2
2
|
|
3
|
-
|
3
|
+
ppdbiu 是一个使用 Ruby 编写的iOS远程依赖配置安装工具,用来获取服务端配置的CocoaPods依赖,并自动安装。 从而解决Podfile中频繁修改依赖组件,或者组件的版本。 特别适合项目发展到一定程度形成组件化,Podfile中依赖的组件越多,越适合使用ppdbiu。
|
4
4
|
|
5
|
-
|
5
|
+
### 为什么有这个项目
|
6
6
|
|
7
|
-
|
7
|
+
拍拍贷财富App经过几年的迭代发展,目前已经完全进入组件化开发的方式,项目中已经有将近上百个组件,如果这些组件的依赖都写到Podfile中,里面将有将近上百条类似`Pod 'xxxx'`的内容存在,而且在多人同时修改的情况也容易形成冲突。为此我们开发了移动应用管理系统,用来线上管理应用、管理组件、管理应用版本对组件的依赖。线上系统中配置的依赖需要能够在执行`pod install`的时候自动被安装,此项目就是为了解决这个问题而产生的,它是整个移动应用管理系统中很重要的一部分。
|
8
8
|
|
9
|
-
|
9
|
+
### 安装
|
10
|
+
|
11
|
+
将下面这行代码添加到您应用目录下的Gemfile中
|
10
12
|
|
11
13
|
```ruby
|
12
14
|
gem 'ppdbiu'
|
13
15
|
```
|
14
16
|
|
15
|
-
|
17
|
+
然后执行:
|
16
18
|
|
17
19
|
$ bundle
|
18
20
|
|
19
|
-
|
21
|
+
或者用下面的命令进行安装:
|
20
22
|
|
21
23
|
$ gem install ppdbiu
|
22
24
|
|
23
|
-
|
25
|
+
### 使用
|
26
|
+
|
27
|
+
1. 在Podfile中引入依赖 `require 'ppdbiu'`
|
28
|
+
|
29
|
+
2. 删除所有可以通过服务端配置的依赖代码如: pod 'xxxxx'
|
30
|
+
|
31
|
+
3. 添加`makeup_pods(url, params, method, ignores)`来获取依赖并进行依赖安装, 参数中含义解释如下:
|
24
32
|
|
25
|
-
-
|
33
|
+
- url: 为获取json依赖内容的地址,通过url接口请求得到Podfile中的依赖,来安装依赖内容
|
26
34
|
|
27
|
-
-
|
35
|
+
- params为url的请求参数
|
28
36
|
|
29
|
-
-
|
37
|
+
- method为网络请求的方式,支持GET和POST
|
30
38
|
|
31
|
-
-
|
39
|
+
- ignores为忽略依赖的数组,在执行依赖安装的过程中会判断依赖名称是否在忽略的数组中,忽略数组一般用来调试本地组件或者指定git地址使用,放弃从配置中安装依赖,再在Podfile中添加本地组件或者git地址。
|
40
|
+
|
41
|
+
4. 服务端配置返回的json内容格式如下:
|
32
42
|
|
33
43
|
```json
|
34
44
|
{
|
@@ -37,65 +47,130 @@ Or install it yourself as:
|
|
37
47
|
"resultMessage": "响应成功",
|
38
48
|
"content": [
|
39
49
|
{
|
40
|
-
"dependencyName": "
|
41
|
-
"componentVersion": "~>
|
50
|
+
"dependencyName": "AFNetworking",
|
51
|
+
"componentVersion": "~> 3.2.0"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"dependencyName": "YYModel",
|
55
|
+
"componentVersion": "1.0.4"
|
42
56
|
},
|
43
57
|
{
|
44
|
-
"dependencyName": "
|
45
|
-
"componentVersion": "1.
|
58
|
+
"dependencyName": "YYText",
|
59
|
+
"componentVersion": "1.0.5"
|
46
60
|
},
|
47
61
|
{
|
48
|
-
"dependencyName": "
|
49
|
-
"gitUrl": "
|
62
|
+
"dependencyName": "Masonry",
|
63
|
+
"gitUrl": "https://github.com/SnapKit/Masonry.git"
|
50
64
|
},
|
51
65
|
{
|
52
|
-
"dependencyName": "
|
53
|
-
"gitUrl": "
|
66
|
+
"dependencyName": "MBProgressHUD",
|
67
|
+
"gitUrl": "https://github.com/jdg/MBProgressHUD.git",
|
54
68
|
"componentBranch": "master"
|
55
69
|
},
|
56
70
|
{
|
57
|
-
"dependencyName": "
|
58
|
-
"gitUrl": "
|
59
|
-
"tag": "1.1
|
71
|
+
"dependencyName": "UICKeyChainStore",
|
72
|
+
"gitUrl": "https://github.com/kishikawakatsumi/UICKeyChainStore.git",
|
73
|
+
"tag": "v2.1.1"
|
60
74
|
}
|
61
|
-
]
|
62
|
-
"pageNo": 1,
|
63
|
-
"pageSize": 10,
|
64
|
-
"totalCount": 5,
|
65
|
-
"totalPageCount": 1
|
75
|
+
]
|
66
76
|
}
|
67
77
|
```
|
68
78
|
|
79
|
+
5. 依赖安装过程优先安装指定`componentVersion`的版本,如果返回的有`componentVersion`字段,会安装此字段设置的版本进行安装,否则安装giturl、tag,componentBranch等信息进行依赖安装
|
80
|
+
|
69
81
|
实例:
|
70
82
|
|
71
83
|
```ruby
|
72
|
-
source 'http://
|
84
|
+
source 'http://github.com/CocoaPods/Specs.git'
|
73
85
|
|
74
86
|
platform :ios, "8.0"
|
75
87
|
inhibit_all_warnings!
|
88
|
+
workspace 'Demo.xcworkspace'
|
89
|
+
|
90
|
+
target 'Demo' do
|
91
|
+
project 'Demo/Demo.xcodeproj'
|
76
92
|
|
77
|
-
target 'CityLoan' do
|
78
93
|
require 'ppdbiu'
|
79
94
|
|
80
|
-
#
|
81
|
-
makeup_pods('
|
82
|
-
|
83
|
-
# makeup_pods('http://mplatform.ppdaicorp.com/dep/list', {'applicationVersionId' => '4', 'pageSize' => '99999'}, 'POST', ['PPDBLNetworking', 'PPDBLUtils'])
|
95
|
+
# 包含忽略依赖数组,如['YYText']
|
96
|
+
makeup_pods('https://raw.githubusercontent.com/wanyakun/resources/master/dependency.json', {'applicationVersionId' => '4', 'pageSize' => '99999'}, 'GET', ['YYText'])
|
97
|
+
pod 'YYText', :git => 'https://github.com/ibireme/YYText.git'
|
84
98
|
|
99
|
+
# 不包含忽略数字键
|
100
|
+
# makeup_pods('https://raw.githubusercontent.com/wanyakun/resources/master/dependency.json', {'applicationVersionId' => '4', 'pageSize' => '99999'}, 'GET')
|
85
101
|
end
|
102
|
+
```
|
103
|
+
|
104
|
+
### 项目结构
|
86
105
|
|
106
|
+
整个项目结构如下:
|
107
|
+
|
108
|
+
```
|
109
|
+
ppdbiu/
|
110
|
+
├── Gemfile
|
111
|
+
├── Gemfile.lock
|
112
|
+
├── LICENSE
|
113
|
+
├── README.md
|
114
|
+
├── Rakefile
|
115
|
+
├── bin
|
116
|
+
│ ├── console
|
117
|
+
│ └── setup
|
118
|
+
├── lib
|
119
|
+
│ ├── ppdbiu
|
120
|
+
│ │ └── version.rb
|
121
|
+
│ └── ppdbiu.rb
|
122
|
+
├── ppdbiu.gemspec
|
123
|
+
└── test
|
124
|
+
├── Demo
|
125
|
+
│ ├── Demo
|
126
|
+
│ │ ├── AppDelegate.h
|
127
|
+
│ │ ├── AppDelegate.m
|
128
|
+
│ │ ├── Assets.xcassets
|
129
|
+
│ │ │ ├── AppIcon.appiconset
|
130
|
+
│ │ │ │ └── Contents.json
|
131
|
+
│ │ │ └── Contents.json
|
132
|
+
│ │ ├── Base.lproj
|
133
|
+
│ │ │ ├── LaunchScreen.storyboard
|
134
|
+
│ │ │ └── Main.storyboard
|
135
|
+
│ │ ├── Info.plist
|
136
|
+
│ │ ├── ViewController.h
|
137
|
+
│ │ ├── ViewController.m
|
138
|
+
│ │ └── main.m
|
139
|
+
│ ├── Demo.xcodeproj
|
140
|
+
│ │ ├── project.pbxproj
|
141
|
+
│ │ └── xcuserdata
|
142
|
+
│ │ └── wanyakun.xcuserdatad
|
143
|
+
│ │ └── xcschemes
|
144
|
+
│ │ └── xcschememanagement.plist
|
145
|
+
│ └── DemoTests
|
146
|
+
│ ├── DemoTests.m
|
147
|
+
│ └── Info.plist
|
148
|
+
├── Demo.xcworkspace
|
149
|
+
│ ├── contents.xcworkspacedata
|
150
|
+
│ ├── xcshareddata
|
151
|
+
│ │ └── IDEWorkspaceChecks.plist
|
152
|
+
│ └── xcuserdata
|
153
|
+
│ └── wanyakun.xcuserdatad
|
154
|
+
│ └── UserInterfaceState.xcuserstate
|
155
|
+
├── Gemfile
|
156
|
+
├── Gemfile.lock
|
157
|
+
├── Podfile
|
158
|
+
├── Podfile.lock
|
159
|
+
└── dependency.json
|
87
160
|
```
|
88
161
|
|
89
|
-
|
162
|
+
项目编译使用到Ruby 2.3.0, 并使用Rake进行构建、打包和发布。
|
163
|
+
|
164
|
+
### 开发
|
90
165
|
|
91
|
-
|
166
|
+
克隆代码后进入项目目录,执行`bin/setup`来安装依赖。
|
92
167
|
|
93
|
-
|
168
|
+
想要在本机安装此gem,可以执行`bundle exec rake install`。如果想要发布一个新版本,先更新`version.rb`里的版本号,然后执行`bundle exec rake release`,这个操作将为这个版本创建一个git tag,并且推送git提交和tags,而且会推送`.gem`文件到[rubygems.org](https://rubygems.org)。
|
94
169
|
|
95
|
-
|
170
|
+
### 联系
|
96
171
|
|
97
|
-
|
172
|
+
我们的邮箱地址: wanyakun@ppdai.com, 欢迎来信联系。
|
98
173
|
|
99
|
-
|
174
|
+
### 开源许可协议
|
100
175
|
|
101
|
-
|
176
|
+
Apache License 2.0
|
data/lib/ppdbiu.rb
CHANGED
@@ -1,7 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2018 ppdai.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# limitations under the License.
|
14
|
+
#
|
15
|
+
|
1
16
|
require "ppdbiu/version"
|
2
17
|
|
3
18
|
module Pod
|
4
19
|
class Podfile
|
20
|
+
|
21
|
+
# 从url获取依赖并进行依赖安装
|
22
|
+
#
|
23
|
+
# @param url 获取依赖配置的请求url
|
24
|
+
# @param params 获取依赖配置的请求参数
|
25
|
+
# @param method 获取依赖配置的请求方式
|
26
|
+
# @param ignores 依赖安装忽略列表,默认为空
|
27
|
+
#
|
5
28
|
def makeup_pods(url, params, method, ignores = [])
|
6
29
|
UI.title "makeup pods dependency from #{url}"
|
7
30
|
file = "dependency.json"
|
@@ -21,6 +44,13 @@ module Pod
|
|
21
44
|
end
|
22
45
|
end
|
23
46
|
|
47
|
+
# 安装依赖,在安装依赖的过程中判断是否在ignores中,
|
48
|
+
# 如果在ignores中则忽略不进行依赖安装,
|
49
|
+
# 如果不在ignores,判断是否有componentVersion,优先是用版本进行安装,否则进行url、tag、commit等配置进行安装依赖
|
50
|
+
#
|
51
|
+
# @param dependencies 依赖列表
|
52
|
+
# @param ignores 忽略列表
|
53
|
+
#
|
24
54
|
def ppd_pod(dependencies, ignores)
|
25
55
|
dependencies.each { |value|
|
26
56
|
componentName = value.fetch("dependencyName", nil)
|
@@ -62,6 +92,12 @@ module Pod
|
|
62
92
|
}
|
63
93
|
end
|
64
94
|
|
95
|
+
# 处理获取依赖的网络请求
|
96
|
+
#
|
97
|
+
# @param url 请求的url
|
98
|
+
# @param paras 请求的参数
|
99
|
+
# @param method 请求的方式
|
100
|
+
#
|
65
101
|
def peform_request(url, params, method)
|
66
102
|
require 'rest'
|
67
103
|
require 'json'
|
@@ -76,6 +112,22 @@ module Pod
|
|
76
112
|
end
|
77
113
|
end
|
78
114
|
|
115
|
+
# 处理网络请求返回来的内容
|
116
|
+
#
|
117
|
+
# @param response 应返回json数据结构,如下:
|
118
|
+
#
|
119
|
+
# {
|
120
|
+
# "result": 0,
|
121
|
+
# "codeMsg": "",
|
122
|
+
# "resultMessage": "响应成功",
|
123
|
+
# "content": [
|
124
|
+
# {
|
125
|
+
# "dependencyName": "AFNetworking",
|
126
|
+
# "componentVersion": "~> 3.2.0"
|
127
|
+
# }
|
128
|
+
# ]
|
129
|
+
# }
|
130
|
+
#
|
79
131
|
def handleResponse(url, response)
|
80
132
|
if response.ok?
|
81
133
|
body = JSON.parse(response.body)
|
data/lib/ppdbiu/version.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2018 ppdai.com
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# limitations under the License.
|
14
|
+
#
|
15
|
+
|
1
16
|
module Ppdbiu
|
2
|
-
VERSION = "0.2.
|
17
|
+
VERSION = "0.2.3"
|
3
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ppdbiu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wanyakun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- Gemfile
|
92
92
|
- Gemfile.lock
|
93
93
|
- LICENSE
|
94
|
-
- LICENSE.txt
|
95
94
|
- README.md
|
96
95
|
- Rakefile
|
97
96
|
- bin/console
|
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2017 wanyakun
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|