podsorz 0.0.2 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -13
- data/lib/podsorz.rb +12 -2
- data/lib/podsorz/command/binary.rb +150 -0
- data/lib/podsorz/command/commit.rb +2 -2
- data/lib/podsorz/command/install.rb +9 -3
- data/lib/podsorz/command/publish.rb +7 -3
- data/lib/podsorz/command/setup.rb +1 -1
- data/lib/podsorz/command/switch.rb +2 -2
- data/lib/podsorz/command/sync.rb +2 -2
- data/lib/podsorz/core/Binary/binary_builder.rb +312 -0
- data/lib/podsorz/core/Binary/binary_manager.rb +173 -0
- data/lib/podsorz/core/Binary/binary_repo.rb +178 -0
- data/lib/podsorz/core/Binary/binary_server.rb +21 -0
- data/lib/podsorz/core/Config/orz_config_templet.rb +31 -0
- data/lib/podsorz/core/{orz_env_detector.rb → Config/orz_env_detector.rb} +1 -1
- data/lib/podsorz/core/{pod_orzconfig_parse.rb → Config/pod_orzconfig_parse.rb} +15 -1
- data/lib/podsorz/core/{podfile_io.rb → PodFile/podfile_io.rb} +143 -4
- data/lib/podsorz/core/{podfile_model.rb → PodFile/podfile_model.rb} +26 -1
- data/lib/podsorz/core/{pods_detector.rb → PodsOrz/pods_detector.rb} +1 -1
- data/lib/podsorz/core/{pods_git_manager.rb → PodsOrz/pods_git_manager.rb} +22 -12
- data/lib/podsorz/core/{pods_git_operator.rb → PodsOrz/pods_git_operator.rb} +134 -37
- data/lib/podsorz/core/{pods_repo.rb → PodsOrz/pods_repo.rb} +44 -11
- data/lib/podsorz/core/{pods_version.rb → PodsOrz/pods_version.rb} +4 -1
- data/lib/podsorz/core/Specs/podspec_model.rb +45 -0
- data/lib/podsorz/util/git_operator.rb +47 -0
- data/lib/podsorz/version.rb +1 -1
- data/podsorz.gemspec +11 -1
- metadata +35 -15
- data/Note +0 -3
- data/lib/podsorz/core/orz_config_templet.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a44111361a02ff1c1a71d7085d25bc8ac4ae3835085913ac796c09a86cda8f9
|
4
|
+
data.tar.gz: e130cd226bdb7072e8db2ee84ca2fad1a09d0d5cbb6b56a7b23e5ed2c206e190
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 021efcba84b814774fb105bb019d81053ffbaa727f469ca1c679a55f2ee65a1749ebc4aa15a9c684292899a2ab6930543812b0c825a9ee440b0cc5a2cf2381e3
|
7
|
+
data.tar.gz: b936d7f1b824146c954767ffd987127ebf09d474e127dae7b9f16e16cf494b959bd1003855c73997d5c5252b11665e25e7bfc2be32175a6b4d62505cc27a589d
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
podsorz (0.0.
|
4
|
+
podsorz (0.0.5)
|
5
5
|
cocoapods
|
6
|
+
cocoapods-packager
|
6
7
|
colorize
|
7
8
|
gli (~> 2.16)
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
|
-
CFPropertyList (3.0.
|
13
|
-
activesupport (5.2.4.
|
13
|
+
CFPropertyList (3.0.3)
|
14
|
+
activesupport (5.2.4.5)
|
14
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
16
|
i18n (>= 0.7, < 2)
|
16
17
|
minitest (~> 5.1)
|
@@ -22,10 +23,10 @@ GEM
|
|
22
23
|
json (>= 1.5.1)
|
23
24
|
atomos (0.1.3)
|
24
25
|
claide (1.0.3)
|
25
|
-
cocoapods (1.10.
|
26
|
+
cocoapods (1.10.1)
|
26
27
|
addressable (~> 2.6)
|
27
28
|
claide (>= 1.0.2, < 2.0)
|
28
|
-
cocoapods-core (= 1.10.
|
29
|
+
cocoapods-core (= 1.10.1)
|
29
30
|
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
30
31
|
cocoapods-downloader (>= 1.4.0, < 2.0)
|
31
32
|
cocoapods-plugins (>= 1.0.0, < 2.0)
|
@@ -40,7 +41,7 @@ GEM
|
|
40
41
|
nap (~> 1.0)
|
41
42
|
ruby-macho (~> 1.4)
|
42
43
|
xcodeproj (>= 1.19.0, < 2.0)
|
43
|
-
cocoapods-core (1.10.
|
44
|
+
cocoapods-core (1.10.1)
|
44
45
|
activesupport (> 5.0, < 6)
|
45
46
|
addressable (~> 2.6)
|
46
47
|
algoliasearch (~> 1.0)
|
@@ -52,6 +53,8 @@ GEM
|
|
52
53
|
typhoeus (~> 1.0)
|
53
54
|
cocoapods-deintegrate (1.0.4)
|
54
55
|
cocoapods-downloader (1.4.0)
|
56
|
+
cocoapods-packager (1.5.0)
|
57
|
+
cocoapods (>= 1.7.3, < 2.0)
|
55
58
|
cocoapods-plugins (1.0.0)
|
56
59
|
nap
|
57
60
|
cocoapods-search (1.0.0)
|
@@ -61,20 +64,20 @@ GEM
|
|
61
64
|
cocoapods-try (1.2.0)
|
62
65
|
colored2 (3.1.2)
|
63
66
|
colorize (0.8.1)
|
64
|
-
concurrent-ruby (1.1.
|
67
|
+
concurrent-ruby (1.1.8)
|
65
68
|
escape (0.0.4)
|
66
69
|
ethon (0.12.0)
|
67
70
|
ffi (>= 1.3.0)
|
68
|
-
ffi (1.
|
71
|
+
ffi (1.14.2)
|
69
72
|
fourflusher (2.3.1)
|
70
73
|
fuzzy_match (2.0.4)
|
71
74
|
gh_inspector (1.1.3)
|
72
|
-
gli (2.
|
75
|
+
gli (2.20.0)
|
73
76
|
httpclient (2.8.3)
|
74
|
-
i18n (1.8.
|
77
|
+
i18n (1.8.9)
|
75
78
|
concurrent-ruby (~> 1.0)
|
76
|
-
json (2.
|
77
|
-
minitest (5.14.
|
79
|
+
json (2.5.1)
|
80
|
+
minitest (5.14.4)
|
78
81
|
molinillo (0.6.6)
|
79
82
|
nanaimo (0.3.0)
|
80
83
|
nap (1.1.0)
|
@@ -84,7 +87,7 @@ GEM
|
|
84
87
|
thread_safe (0.3.6)
|
85
88
|
typhoeus (1.4.0)
|
86
89
|
ethon (>= 0.9.0)
|
87
|
-
tzinfo (1.2.
|
90
|
+
tzinfo (1.2.9)
|
88
91
|
thread_safe (~> 0.1)
|
89
92
|
xcodeproj (1.19.0)
|
90
93
|
CFPropertyList (>= 2.3.3, < 4.0)
|
data/lib/podsorz.rb
CHANGED
@@ -5,15 +5,24 @@ require "podsorz/command/setup"
|
|
5
5
|
require "podsorz/command/switch"
|
6
6
|
require "podsorz/command/commit"
|
7
7
|
require "podsorz/command/publish"
|
8
|
-
require "podsorz/command/install"
|
9
8
|
require "podsorz/command/sync"
|
9
|
+
require "podsorz/command/binary"
|
10
|
+
require "podsorz/command/install"
|
10
11
|
|
11
12
|
require 'gli'
|
12
13
|
|
13
14
|
include GLI::App
|
14
15
|
|
15
16
|
module PodsOrz
|
16
|
-
program_desc %{iOS application modulize into pods, improvement for develop modules.
|
17
|
+
program_desc %{iOS application modulize into pods, improvement for develop modules.
|
18
|
+
CMD:
|
19
|
+
1.git-flow
|
20
|
+
2.auto publish code
|
21
|
+
3.auto push repo
|
22
|
+
4.auto rewrite podfile
|
23
|
+
5.sync other branch commit
|
24
|
+
6.binary static libary
|
25
|
+
}
|
17
26
|
|
18
27
|
current_exec_path = Dir.pwd()
|
19
28
|
|
@@ -30,6 +39,7 @@ module PodsOrz
|
|
30
39
|
publish_command()
|
31
40
|
install_command()
|
32
41
|
sync_command()
|
42
|
+
binary_command()
|
33
43
|
|
34
44
|
desc "Show podsorz version"
|
35
45
|
command :version do |version|
|
@@ -0,0 +1,150 @@
|
|
1
|
+
require "podsorz/core/PodsOrz/pods_repo"
|
2
|
+
require "podsorz/core/Binary/binary_manager"
|
3
|
+
require "podsorz/core/PodsOrz/pods_git_manager"
|
4
|
+
|
5
|
+
|
6
|
+
module PodsOrz
|
7
|
+
def self.binary_command
|
8
|
+
desc "Binary command, static library related command"
|
9
|
+
command :binary do |binary|
|
10
|
+
binary.desc "package pods(which in PodsOrzConfig) into static libraries"
|
11
|
+
binary.command :package do |package|
|
12
|
+
package.action do |global_options,options,args|
|
13
|
+
dir_path = global_options[:path]
|
14
|
+
prepare_work(dir_path)
|
15
|
+
|
16
|
+
git_manager = PodsOrz::PodsGitManager.new(dir_path)
|
17
|
+
result_hash = filter_binary_pods_list(git_manager, :package)
|
18
|
+
package_list = result_hash[:package]
|
19
|
+
|
20
|
+
binary_manager = PodsOrz::BinaryManager.new(dir_path)
|
21
|
+
binary_manager.package(package_list)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
binary.desc "show whether remote exist static libraries on current version"
|
29
|
+
binary.command :show do |show|
|
30
|
+
show.action do |global_options,options,args|
|
31
|
+
dir_path = global_options[:path]
|
32
|
+
prepare_work(dir_path)
|
33
|
+
|
34
|
+
git_manager = PodsOrz::PodsGitManager.new(dir_path)
|
35
|
+
filter_binary_pods_list(git_manager, :show)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
binary.desc "publish binary repo"
|
42
|
+
binary.command :publish do |publish|
|
43
|
+
publish.action do |global_options,options,args|
|
44
|
+
dir_path = global_options[:path]
|
45
|
+
prepare_work(dir_path)
|
46
|
+
|
47
|
+
git_manager = PodsOrz::PodsGitManager.new(dir_path)
|
48
|
+
result_hash = filter_binary_pods_list(git_manager, :package)
|
49
|
+
package_list = result_hash[:package]
|
50
|
+
|
51
|
+
binary_manager = PodsOrz::BinaryManager.new(dir_path)
|
52
|
+
binary_manager.publish(package_list)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
binary.default_command :show
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.prepare_work(dir_path)
|
62
|
+
pods_repo = PodsOrz::PodsRepo.new()
|
63
|
+
pods_repo.check_repo_exist()
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
def self.filter_binary_pods_list(git_manager, cmd_type)
|
68
|
+
result_hash = {
|
69
|
+
:binary => [],
|
70
|
+
:package => []
|
71
|
+
}
|
72
|
+
|
73
|
+
#1.获取静态库加载配置表
|
74
|
+
is_all_binary = git_manager.orzconfig_parse.is_all_binary
|
75
|
+
|
76
|
+
origin_binary_list = []
|
77
|
+
|
78
|
+
unless cmd_type == :show
|
79
|
+
if is_all_binary
|
80
|
+
totoal_model_list = git_manager.podfile_io.filter_binary_pod_models()
|
81
|
+
totoal_model_list.each do |model|
|
82
|
+
origin_binary_list << model.name.to_s
|
83
|
+
end
|
84
|
+
else
|
85
|
+
origin_binary_list = git_manager.orzconfig_parse.static_lib_list if cmd_type == :binary
|
86
|
+
origin_binary_list = git_manager.orzconfig_parse.will_package_list if cmd_type == :package
|
87
|
+
end
|
88
|
+
|
89
|
+
else
|
90
|
+
totoal_model_list = git_manager.podfile_io.total_pod_models
|
91
|
+
totoal_model_list.each do |model|
|
92
|
+
origin_binary_list << model.name.to_s
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
return result_hash if origin_binary_list.empty?
|
98
|
+
|
99
|
+
|
100
|
+
empty_binary_list = []
|
101
|
+
exist_binary_list = []
|
102
|
+
|
103
|
+
has_binary_list = []
|
104
|
+
can_package_list = []
|
105
|
+
|
106
|
+
#2.查询Podfile_orz是否为已发版本状态
|
107
|
+
binary_repo = PodsOrz::BinaryRepo.new()
|
108
|
+
binary_repo.check_binary_repo_exist()
|
109
|
+
|
110
|
+
origin_binary_list.each do |pod|
|
111
|
+
pod_version = git_manager.podfile_io.get_podfile_pod_version(pod)
|
112
|
+
|
113
|
+
if pod_version.empty?
|
114
|
+
branch = git_manager.podfile_io.get_podfile_pod_branch(pod)
|
115
|
+
unless branch.empty?
|
116
|
+
empty_binary_list << "#{pod} no source-code version, :branch => #{branch}"
|
117
|
+
else
|
118
|
+
empty_binary_list << "#{pod} no source-code version, :branch => 'master'"
|
119
|
+
end
|
120
|
+
|
121
|
+
next
|
122
|
+
end
|
123
|
+
|
124
|
+
has_remote = binary_repo.check_binary_pod_exist(pod, pod_version)
|
125
|
+
unless has_remote
|
126
|
+
empty_binary_list << "#{pod} no binary version:(#{pod_version})"
|
127
|
+
else
|
128
|
+
exist_binary_list << "#{pod}:(#{pod_version})"
|
129
|
+
has_binary_list << pod
|
130
|
+
end
|
131
|
+
|
132
|
+
if !pod_version.empty? && !has_remote
|
133
|
+
can_package_list << pod
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
Logger.highlight("[cmd:#{cmd_type}] Exist static library pods : \n #{exist_binary_list.inspect}")
|
138
|
+
Logger.separator
|
139
|
+
Logger.warning("[cmd:#{cmd_type}] Not exist static library pods: \n #{empty_binary_list.inspect}")
|
140
|
+
|
141
|
+
|
142
|
+
result_hash[:binary] = has_binary_list
|
143
|
+
result_hash[:package] = can_package_list
|
144
|
+
|
145
|
+
|
146
|
+
result_hash
|
147
|
+
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
|
-
require "podsorz/core/pods_detector"
|
2
|
-
require "podsorz/core/pods_git_manager"
|
1
|
+
require "podsorz/core/PodsOrz/pods_detector"
|
2
|
+
require "podsorz/core/PodsOrz/pods_git_manager"
|
3
|
+
require "podsorz/command/binary"
|
3
4
|
|
4
5
|
module PodsOrz
|
5
6
|
def self.install_command
|
@@ -16,8 +17,13 @@ module PodsOrz
|
|
16
17
|
is_same = git_manager.ensure_pods_branch()
|
17
18
|
exit() unless is_same
|
18
19
|
|
19
|
-
|
20
|
+
#获取binary 列表
|
21
|
+
list_hash = PodsOrz.filter_binary_pods_list(git_manager, :binary)
|
22
|
+
|
23
|
+
git_manager.install_pod(dir_path, list_hash[:binary])
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
27
|
+
|
28
|
+
|
23
29
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require "podsorz/core/pods_detector"
|
2
|
-
require "podsorz/core/pods_git_manager"
|
1
|
+
require "podsorz/core/PodsOrz/pods_detector"
|
2
|
+
require "podsorz/core/PodsOrz/pods_git_manager"
|
3
3
|
require "podsorz/util/logger"
|
4
4
|
|
5
5
|
module PodsOrz
|
@@ -17,6 +17,9 @@ module PodsOrz
|
|
17
17
|
8.更改远端 Podfile_orz.rb, 同步对应 pod 到最新的 version\n
|
18
18
|
}
|
19
19
|
command :publish do |publish|
|
20
|
+
publish.switch :swift, :negatable => false, :desc => "Publish Swift Pod"
|
21
|
+
publish.example "podsorz publish --swift", desc:"Single Publish Action,Publish Only One ’Swift‘ Pod"
|
22
|
+
|
20
23
|
publish.action do |global_options, options, args|
|
21
24
|
dir_path = global_options[:path]
|
22
25
|
detector = PodsOrz::PodsDetector.new(dir_path)
|
@@ -33,7 +36,8 @@ module PodsOrz
|
|
33
36
|
exit()
|
34
37
|
end
|
35
38
|
|
36
|
-
|
39
|
+
is_swift = options[:swift]
|
40
|
+
git_manager.start_repo_publish(is_swift)
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
data/lib/podsorz/command/sync.rb
CHANGED
@@ -0,0 +1,312 @@
|
|
1
|
+
require "podsorz/util/logger"
|
2
|
+
require "podsorz/core/PodFile/podfile_io"
|
3
|
+
require "podsorz/core/Specs/podspec_model"
|
4
|
+
require "podsorz/util/logger"
|
5
|
+
require "open3"
|
6
|
+
|
7
|
+
module PodsOrz
|
8
|
+
class BinaryBuilder
|
9
|
+
attr_accessor :main_path, :kx_binary_path, :podfile_io, :pod_repo, :http_host
|
10
|
+
|
11
|
+
def initialize(main_path, podfile_io)
|
12
|
+
@main_path = main_path
|
13
|
+
@kx_binary_path = File.expand_path("../kx_binary", main_path)
|
14
|
+
|
15
|
+
@podfile_io = podfile_io
|
16
|
+
@pod_repo = PodsOrz::PodsRepo.new()
|
17
|
+
|
18
|
+
@http_host = "http://192.168.6.23:8080"
|
19
|
+
end
|
20
|
+
|
21
|
+
def start_package_pod(pod)
|
22
|
+
is_package_success = true
|
23
|
+
|
24
|
+
#1.创建kx_binary
|
25
|
+
detect_kx_binary()
|
26
|
+
|
27
|
+
#2.创建Pod文件夹
|
28
|
+
detect_pod_directory(pod)
|
29
|
+
|
30
|
+
#3.创建version文件夹
|
31
|
+
pod_version = @podfile_io.get_podfile_pod_version(pod)
|
32
|
+
detect_version_directory(pod, pod_version)
|
33
|
+
|
34
|
+
#4.copy kuxiu_specs中对应的podspec
|
35
|
+
copy_podspec(pod)
|
36
|
+
|
37
|
+
#5.build static library
|
38
|
+
is_build_success = build_static_library(pod)
|
39
|
+
unless is_build_success
|
40
|
+
Logger.error("【#{pod}】build version:#{pod_version} static library failure!")
|
41
|
+
is_package_success = false
|
42
|
+
return is_package_success
|
43
|
+
end
|
44
|
+
|
45
|
+
#6.zip framework
|
46
|
+
is_zip_success = zip_framework(pod)
|
47
|
+
unless is_zip_success
|
48
|
+
Logger.error("【#{pod}】zip framework failure!")
|
49
|
+
is_package_success = false
|
50
|
+
return is_package_success
|
51
|
+
end
|
52
|
+
|
53
|
+
#7.mv framework
|
54
|
+
is_mv_success = mv_embedded_framework(pod)
|
55
|
+
unless is_mv_success
|
56
|
+
Logger.error("【#{pod} mv #{pod}.framework.zip failure!")
|
57
|
+
is_package_success = false
|
58
|
+
return is_package_success
|
59
|
+
end
|
60
|
+
|
61
|
+
#8.override .podspec
|
62
|
+
is_override_success = override_podspec(pod)
|
63
|
+
unless is_override_success
|
64
|
+
Logger.error("【#{pod} mv #{pod}.podspec failure!")
|
65
|
+
is_package_success = false
|
66
|
+
return is_package_success
|
67
|
+
end
|
68
|
+
|
69
|
+
#9.delete build files
|
70
|
+
delete_build_files(pod)
|
71
|
+
|
72
|
+
|
73
|
+
is_package_success
|
74
|
+
end
|
75
|
+
|
76
|
+
#detect
|
77
|
+
def detect_kx_binary()
|
78
|
+
|
79
|
+
result = check_directory()
|
80
|
+
|
81
|
+
if result
|
82
|
+
binary_result = File.directory?(@kx_binary_path)
|
83
|
+
unless binary_result
|
84
|
+
Logger.warning("kx_binary directory not exist, generate default 'kx_binary' directory")
|
85
|
+
Dir.mkdir(@kx_pods_path)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def check_directory()
|
91
|
+
is_directory = File.directory?(@main_path)
|
92
|
+
Logger.error("Detect failure, it is not a directory path: #{@main_path}") unless is_directory
|
93
|
+
|
94
|
+
is_directory
|
95
|
+
end
|
96
|
+
|
97
|
+
def detect_pod_directory(pod)
|
98
|
+
pod_path = File.expand_path("#{pod}", @kx_binary_path)
|
99
|
+
pod_result = File.directory?(pod_path)
|
100
|
+
unless pod_result
|
101
|
+
Logger.warning("#{pod_path} directory not exist, generate default '#{pod_path}' directory")
|
102
|
+
Dir.mkdir(pod_path)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def detect_version_directory(pod, pod_version)
|
107
|
+
pod_version_path = File.expand_path("#{pod}/#{pod_version}", @kx_binary_path)
|
108
|
+
pod_version_result = File.directory?(pod_version_path)
|
109
|
+
unless pod_version_result
|
110
|
+
Logger.warning("#{pod_version_path} directory not exist, generate default '#{pod_version_path}' directory")
|
111
|
+
Dir.mkdir(pod_version_path)
|
112
|
+
end
|
113
|
+
|
114
|
+
pod_version_path
|
115
|
+
end
|
116
|
+
|
117
|
+
#copy
|
118
|
+
def copy_podspec(pod)
|
119
|
+
command = Thread.new do
|
120
|
+
pod_version = @podfile_io.get_podfile_pod_version(pod)
|
121
|
+
source_podspec_dir = @pod_repo.directory_pod_version(pod, pod_version)
|
122
|
+
source_file_path = File.expand_path("#{pod}.podspec", source_podspec_dir)
|
123
|
+
|
124
|
+
dest_dir = detect_version_directory(pod, pod_version)
|
125
|
+
dest_file_path = File.expand_path("#{pod}.podspec", dest_dir)
|
126
|
+
|
127
|
+
`cp -f #{source_file_path} #{dest_file_path}`
|
128
|
+
|
129
|
+
Logger.highlight("Copy file Success.\n Source file path:#{source_file_path} \n dest_file_path:#{dest_file_path}")
|
130
|
+
end
|
131
|
+
command.join
|
132
|
+
end
|
133
|
+
|
134
|
+
def build_static_library(pod)
|
135
|
+
is_build_success = true
|
136
|
+
command = Thread.new do
|
137
|
+
pod_version = @podfile_io.get_podfile_pod_version(pod)
|
138
|
+
|
139
|
+
dest_dir = detect_version_directory(pod, pod_version)
|
140
|
+
dest_file_path = File.expand_path("#{pod}.podspec", dest_dir)
|
141
|
+
|
142
|
+
cmd_list = []
|
143
|
+
cmd_list << "cd #{dest_dir}"
|
144
|
+
cmd_list << "pod package #{pod}.podspec --exclude-deps --no-mangle --force --embedded --spec-sources=git@gitlab.91banban.com:ios_pods/Specs.git"
|
145
|
+
|
146
|
+
Open3.popen3(cmd_list.join(";")) do |stdin , stdout , stderr, wait_thr|
|
147
|
+
while line = stdout.gets
|
148
|
+
puts line
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
command.join
|
153
|
+
|
154
|
+
is_build_success
|
155
|
+
end
|
156
|
+
|
157
|
+
def zip_framework(pod)
|
158
|
+
is_zip_success = true
|
159
|
+
|
160
|
+
command = Thread.new do
|
161
|
+
pod_version = @podfile_io.get_podfile_pod_version(pod)
|
162
|
+
|
163
|
+
origin_spec_dir = detect_version_directory(pod, pod_version)
|
164
|
+
package_dir = File.expand_path("#{pod}-#{pod_version}", origin_spec_dir)
|
165
|
+
embedded_framework_dir = File.expand_path("ios/#{pod}.embeddedframework", package_dir)
|
166
|
+
|
167
|
+
cmd_list = []
|
168
|
+
cmd_list << "cd #{embedded_framework_dir}"
|
169
|
+
cmd_list << "zip -q -r -y -o #{pod}.framework.zip #{pod}.framework"
|
170
|
+
|
171
|
+
IO.popen(cmd_list.join(";")) do |io|
|
172
|
+
io_lines = io.readlines
|
173
|
+
io_lines.each do |line|
|
174
|
+
puts line
|
175
|
+
is_zip_success = false if line.include? "zip error"
|
176
|
+
end
|
177
|
+
io.close
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
command.join
|
182
|
+
|
183
|
+
is_zip_success
|
184
|
+
end
|
185
|
+
|
186
|
+
def mv_embedded_framework(pod)
|
187
|
+
is_mv_success = true
|
188
|
+
|
189
|
+
command = Thread.new do
|
190
|
+
pod_version = @podfile_io.get_podfile_pod_version(pod)
|
191
|
+
|
192
|
+
origin_spec_dir = detect_version_directory(pod, pod_version)
|
193
|
+
package_dir = File.expand_path("#{pod}-#{pod_version}", origin_spec_dir)
|
194
|
+
embedded_framework_dir = File.expand_path("ios/#{pod}.embeddedframework", package_dir)
|
195
|
+
|
196
|
+
cmd_list = []
|
197
|
+
cmd_list << "cd #{embedded_framework_dir}"
|
198
|
+
cmd_list << "mv -f #{pod}.framework.zip #{origin_spec_dir}"
|
199
|
+
|
200
|
+
IO.popen(cmd_list.join(";")) do |io|
|
201
|
+
io_lines = io.readlines
|
202
|
+
io_lines.each do |line|
|
203
|
+
puts line
|
204
|
+
is_mv_success = false if line.include? "mv:"
|
205
|
+
end
|
206
|
+
io.close
|
207
|
+
end
|
208
|
+
end
|
209
|
+
command.join
|
210
|
+
|
211
|
+
is_mv_success
|
212
|
+
end
|
213
|
+
|
214
|
+
def override_podspec(pod)
|
215
|
+
is_override_success = true
|
216
|
+
|
217
|
+
command = Thread.new do
|
218
|
+
pod_version = @podfile_io.get_podfile_pod_version(pod)
|
219
|
+
|
220
|
+
origin_spec_dir = detect_version_directory(pod, pod_version)
|
221
|
+
origin_spec_file_path = File.expand_path("#{pod}.podspec", origin_spec_dir)
|
222
|
+
origin_podspec_model = PodsOrz::PodspecModel.new(origin_spec_file_path)
|
223
|
+
|
224
|
+
|
225
|
+
package_dir = File.expand_path("#{pod}-#{pod_version}", origin_spec_dir)
|
226
|
+
static_pod_spec_path = File.expand_path("#{pod}.podspec", package_dir)
|
227
|
+
|
228
|
+
static_podspec_totoal_sentences = []
|
229
|
+
File.open(static_pod_spec_path, "r") {|io|
|
230
|
+
static_podspec_totoal_sentences = io.readlines
|
231
|
+
}
|
232
|
+
|
233
|
+
File.open(static_pod_spec_path, "w+") {|io|
|
234
|
+
static_podspec_totoal_sentences.each do |sentence|
|
235
|
+
sentence_content = sentence.strip.chomp.to_s
|
236
|
+
|
237
|
+
is_sentence_content_empty = sentence_content.empty?
|
238
|
+
is_sentence_content_size_zero = sentence_content.size.zero?
|
239
|
+
|
240
|
+
unless is_sentence_content_empty || is_sentence_content_size_zero
|
241
|
+
unless sentence_content.start_with?("#")
|
242
|
+
mt = /.*s.source = /.match(sentence)
|
243
|
+
unless mt.nil?
|
244
|
+
sentence = mt[0] + "{:http => \'#{http_host}/#{pod}/#{pod_version}/#{pod}.framework.zip\'}"
|
245
|
+
end
|
246
|
+
|
247
|
+
mt = /.*s.ios.vendored_framework = /.match(sentence)
|
248
|
+
#behind vendored_framework add extra lines
|
249
|
+
unless mt.nil?
|
250
|
+
sentence = mt[0] + "\'#{pod}.framework\'" + "\n"
|
251
|
+
|
252
|
+
#add Resource
|
253
|
+
if origin_podspec_model.have_resources
|
254
|
+
sentence += " " + "s.resources = \'#{pod}.framework/Versions/A/Resources/*.{png,bundle,xib}\'" + "\n\n"
|
255
|
+
end
|
256
|
+
|
257
|
+
#add dependency
|
258
|
+
origin_podspec_model.dependency_list.each do |d|
|
259
|
+
sentence += " " + "s.dependency " + "#{d}" + "\n"
|
260
|
+
end
|
261
|
+
|
262
|
+
sentence += "\n"
|
263
|
+
|
264
|
+
end
|
265
|
+
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
io.write(sentence.chomp + "\n")
|
270
|
+
end
|
271
|
+
}
|
272
|
+
|
273
|
+
cmd_list = []
|
274
|
+
cmd_list << "cd #{package_dir}"
|
275
|
+
cmd_list << "mv -f #{pod}.podspec #{origin_spec_dir}"
|
276
|
+
|
277
|
+
IO.popen(cmd_list.join(";")) do |io|
|
278
|
+
io_lines = io.readlines
|
279
|
+
io_lines.each do |line|
|
280
|
+
puts line
|
281
|
+
is_override_success = false if line.include? "mv:"
|
282
|
+
end
|
283
|
+
io.close
|
284
|
+
end
|
285
|
+
end
|
286
|
+
command.join
|
287
|
+
|
288
|
+
is_override_success
|
289
|
+
end
|
290
|
+
|
291
|
+
def delete_build_files(pod)
|
292
|
+
command = Thread.new do
|
293
|
+
pod_version = @podfile_io.get_podfile_pod_version(pod)
|
294
|
+
|
295
|
+
origin_spec_dir = detect_version_directory(pod, pod_version)
|
296
|
+
package_dir_name = "#{pod}-#{pod_version}"
|
297
|
+
|
298
|
+
cmd_list = []
|
299
|
+
cmd_list << "cd #{origin_spec_dir}"
|
300
|
+
cmd_list << "rm -f -r #{package_dir_name}"
|
301
|
+
|
302
|
+
IO.popen(cmd_list.join(";")) do |io|
|
303
|
+
io.close
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
command.join
|
308
|
+
end
|
309
|
+
|
310
|
+
#class end
|
311
|
+
end
|
312
|
+
end
|