yk_command 0.4.4 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/yk_command.iml +20 -21
- data/Gemfile.lock +30 -32
- data/lib/yk_command/analyze/analyze.rb +153 -0
- data/lib/yk_command/{dependency_handler.rb → analyze/dependency_handler.rb} +0 -0
- data/lib/yk_command/analyze/dependency_result.rb +140 -0
- data/lib/yk_command/{request.rb → analyze/request.rb} +0 -0
- data/lib/yk_command/commands.rb +9 -284
- data/lib/yk_command/{template → module/template}/objc/CategoryHeader.h +0 -0
- data/lib/yk_command/{template → module/template}/objc/PrefixHeader.pch +0 -0
- data/lib/yk_command/{template → module/template}/objc/RouterDefine.h +0 -0
- data/lib/yk_command/{template → module/template}/objc/RouterRegister.h +0 -0
- data/lib/yk_command/{template → module/template}/objc/RouterRegister.m +0 -0
- data/lib/yk_command/{template → module/template}/objc/ServiceProtocol.h +0 -0
- data/lib/yk_command/{template → module/template}/objc/ServiceRegister.h +0 -0
- data/lib/yk_command/{template → module/template}/objc/ServiceRegister.m +0 -0
- data/lib/yk_command/{template → module/template}/objc/ToolsHeader.h +0 -0
- data/lib/yk_command/{template → module/template}/objc/VendorHeader.h +0 -0
- data/lib/yk_command/{template → module/template}/objc/demo/DemoViewController.h +0 -0
- data/lib/yk_command/{template → module/template}/objc/demo/DemoViewController.m +0 -0
- data/lib/yk_command/{template → module/template}/objc/demo/DemoViewModel.h +0 -0
- data/lib/yk_command/{template → module/template}/objc/demo/DemoViewModel.m +0 -0
- data/lib/yk_command/{template → module/template}/swift/RouterDefine.swift +0 -0
- data/lib/yk_command/module/yk_module.rb +226 -0
- data/lib/yk_command/version.rb +1 -1
- data/yk_command.gemspec +2 -3
- metadata +29 -42
- data/lib/yk_command/analyze.rb +0 -129
- data/lib/yk_command/yk_module.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4e0f782818c147f0402b8b7139842c8030065818391319fb53c0ae57d544c67
|
4
|
+
data.tar.gz: f5f010db87a2ba242658d18728cbb9575e3a9f0d027a21b9c67e3ac006eb1f09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cda7886d0ae837cab8f503bd3c58f1390c5cd96d4d62feeb94bb744c266e11674ae28740f27a95b0ff24253189428f6f2d42a1fdb1053f5b552c145341b302cd
|
7
|
+
data.tar.gz: 86533c9b168b527136667553289b170feaf23b049699ab7035f32b08e68b8186cb8ee1708f2982141b93e01eba897be11285c293fa76523e28b19a3069152eaf
|
data/.idea/yk_command.iml
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.2 [tom]" jdkType="RUBY_SDK" />
|
13
13
|
<orderEntry type="sourceFolder" forTests="false" />
|
14
14
|
<orderEntry type="library" scope="PROVIDED" name="CFPropertyList (v3.0.5, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
15
|
-
<orderEntry type="library" scope="PROVIDED" name="activesupport (
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v6.1.6, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
16
16
|
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
17
17
|
<orderEntry type="library" scope="PROVIDED" name="algoliasearch (v1.27.5, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
18
18
|
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<orderEntry type="library" scope="PROVIDED" name="cocoapods (v1.11.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
23
23
|
<orderEntry type="library" scope="PROVIDED" name="cocoapods-core (v1.11.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
24
24
|
<orderEntry type="library" scope="PROVIDED" name="cocoapods-deintegrate (v1.0.5, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="cocoapods-downloader (v1.6.
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-downloader (v1.6.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
26
26
|
<orderEntry type="library" scope="PROVIDED" name="cocoapods-plugins (v1.0.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
27
27
|
<orderEntry type="library" scope="PROVIDED" name="cocoapods-search (v1.0.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
28
28
|
<orderEntry type="library" scope="PROVIDED" name="cocoapods-trunk (v1.6.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
@@ -37,8 +37,7 @@
|
|
37
37
|
<orderEntry type="library" scope="PROVIDED" name="fourflusher (v2.3.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
38
38
|
<orderEntry type="library" scope="PROVIDED" name="fuzzy_match (v2.0.4, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
39
39
|
<orderEntry type="library" scope="PROVIDED" name="gh_inspector (v1.1.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
40
|
-
<orderEntry type="library" scope="PROVIDED" name="git (v1.
|
41
|
-
<orderEntry type="library" scope="PROVIDED" name="gitlab (v4.18.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="git (v1.11.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
42
41
|
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.20.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
43
42
|
<orderEntry type="library" scope="PROVIDED" name="httpclient (v2.8.3, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
44
43
|
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.10.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
@@ -51,50 +50,50 @@
|
|
51
50
|
<orderEntry type="library" scope="PROVIDED" name="nanaimo (v0.3.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
52
51
|
<orderEntry type="library" scope="PROVIDED" name="nap (v1.1.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
53
52
|
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
54
|
-
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.
|
55
|
-
<orderEntry type="library" scope="PROVIDED" name="parser (
|
56
|
-
<orderEntry type="library" scope="PROVIDED" name="pathname (v0.
|
57
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
58
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
59
|
-
<orderEntry type="library" scope="PROVIDED" name="rainbow (v2.2.2, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
54
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
55
|
+
<orderEntry type="library" scope="PROVIDED" name="pathname (v0.1.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.7, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
57
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
60
58
|
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
61
59
|
<orderEntry type="library" scope="PROVIDED" name="rchardet (v1.8.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
60
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.4.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
62
61
|
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
63
62
|
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
64
63
|
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
65
64
|
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
66
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.
|
65
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
67
66
|
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
68
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop (
|
67
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.29.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
68
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.17.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
69
69
|
<orderEntry type="library" scope="PROVIDED" name="ruby-macho (v2.5.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
70
70
|
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
71
|
-
<orderEntry type="library" scope="PROVIDED" name="terminal-table (v3.0.2, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
72
71
|
<orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
73
|
-
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
74
72
|
<orderEntry type="library" scope="PROVIDED" name="typhoeus (v1.4.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
75
|
-
<orderEntry type="library" scope="PROVIDED" name="tzinfo (
|
76
|
-
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (
|
73
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.4, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
74
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
77
75
|
<orderEntry type="library" scope="PROVIDED" name="xcodeproj (v1.21.0, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
76
|
+
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.5.4, RVM: ruby-2.7.2 [tom]) [gem]" level="application" />
|
78
77
|
</component>
|
79
78
|
<component name="RakeTasksCache">
|
80
79
|
<option name="myRootTask">
|
81
80
|
<RakeTaskImpl id="rake">
|
82
81
|
<subtasks>
|
83
|
-
<RakeTaskImpl description="Build yk_command-0.4.
|
82
|
+
<RakeTaskImpl description="Build yk_command-0.4.5.gem into the pkg directory" fullCommand="build" id="build" />
|
84
83
|
<RakeTaskImpl id="build">
|
85
84
|
<subtasks>
|
86
|
-
<RakeTaskImpl description="Generate SHA512 checksum if yk_command-0.4.
|
85
|
+
<RakeTaskImpl description="Generate SHA512 checksum if yk_command-0.4.5.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
87
86
|
</subtasks>
|
88
87
|
</RakeTaskImpl>
|
89
88
|
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
90
89
|
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
91
|
-
<RakeTaskImpl description="Build and install yk_command-0.4.
|
90
|
+
<RakeTaskImpl description="Build and install yk_command-0.4.5.gem into system gems" fullCommand="install" id="install" />
|
92
91
|
<RakeTaskImpl id="install">
|
93
92
|
<subtasks>
|
94
|
-
<RakeTaskImpl description="Build and install yk_command-0.4.
|
93
|
+
<RakeTaskImpl description="Build and install yk_command-0.4.5.gem into system gems without network access" fullCommand="install:local" id="local" />
|
95
94
|
</subtasks>
|
96
95
|
</RakeTaskImpl>
|
97
|
-
<RakeTaskImpl description="Create tag v0.4.
|
96
|
+
<RakeTaskImpl description="Create tag v0.4.5 and build and push yk_command-0.4.5.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
98
97
|
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
99
98
|
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
100
99
|
<RakeTaskImpl id="release">
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
yk_command (0.4.
|
4
|
+
yk_command (0.4.7)
|
5
5
|
bundler
|
6
6
|
colored
|
7
|
+
colored2
|
7
8
|
git
|
8
|
-
gitlab
|
9
9
|
httparty
|
10
|
-
pathname
|
10
|
+
pathname (= 0.1.0)
|
11
11
|
thor
|
12
12
|
xcodeproj
|
13
13
|
|
@@ -16,11 +16,12 @@ GEM
|
|
16
16
|
specs:
|
17
17
|
CFPropertyList (3.0.5)
|
18
18
|
rexml
|
19
|
-
activesupport (
|
19
|
+
activesupport (6.1.6)
|
20
20
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
|
-
i18n (>=
|
22
|
-
minitest (
|
23
|
-
tzinfo (~>
|
21
|
+
i18n (>= 1.6, < 2)
|
22
|
+
minitest (>= 5.1)
|
23
|
+
tzinfo (~> 2.0)
|
24
|
+
zeitwerk (~> 2.3)
|
24
25
|
addressable (2.8.0)
|
25
26
|
public_suffix (>= 2.0.2, < 5.0)
|
26
27
|
algoliasearch (1.27.5)
|
@@ -58,7 +59,7 @@ GEM
|
|
58
59
|
public_suffix (~> 4.0)
|
59
60
|
typhoeus (~> 1.0)
|
60
61
|
cocoapods-deintegrate (1.0.5)
|
61
|
-
cocoapods-downloader (1.6.
|
62
|
+
cocoapods-downloader (1.6.3)
|
62
63
|
cocoapods-plugins (1.0.0)
|
63
64
|
nap
|
64
65
|
cocoapods-search (1.0.1)
|
@@ -77,11 +78,8 @@ GEM
|
|
77
78
|
fourflusher (2.3.1)
|
78
79
|
fuzzy_match (2.0.4)
|
79
80
|
gh_inspector (1.1.3)
|
80
|
-
git (1.
|
81
|
+
git (1.11.0)
|
81
82
|
rchardet (~> 1.8)
|
82
|
-
gitlab (4.18.0)
|
83
|
-
httparty (~> 0.18)
|
84
|
-
terminal-table (>= 1.5.1)
|
85
83
|
httparty (0.20.0)
|
86
84
|
mime-types (~> 3.0)
|
87
85
|
multi_xml (>= 0.5.2)
|
@@ -98,16 +96,15 @@ GEM
|
|
98
96
|
nanaimo (0.3.0)
|
99
97
|
nap (1.1.0)
|
100
98
|
netrc (0.11.0)
|
101
|
-
parallel (1.
|
102
|
-
parser (
|
99
|
+
parallel (1.22.1)
|
100
|
+
parser (3.1.2.0)
|
103
101
|
ast (~> 2.4.1)
|
104
|
-
pathname (0.
|
105
|
-
|
106
|
-
|
107
|
-
rainbow (2.2.2)
|
108
|
-
rake
|
102
|
+
pathname (0.1.0)
|
103
|
+
public_suffix (4.0.7)
|
104
|
+
rainbow (3.1.1)
|
109
105
|
rake (13.0.6)
|
110
106
|
rchardet (1.8.0)
|
107
|
+
regexp_parser (2.4.0)
|
111
108
|
rexml (3.2.5)
|
112
109
|
rspec (3.11.0)
|
113
110
|
rspec-core (~> 3.11.0)
|
@@ -118,28 +115,29 @@ GEM
|
|
118
115
|
rspec-expectations (3.11.0)
|
119
116
|
diff-lcs (>= 1.2.0, < 2.0)
|
120
117
|
rspec-support (~> 3.11.0)
|
121
|
-
rspec-mocks (3.11.
|
118
|
+
rspec-mocks (3.11.1)
|
122
119
|
diff-lcs (>= 1.2.0, < 2.0)
|
123
120
|
rspec-support (~> 3.11.0)
|
124
121
|
rspec-support (3.11.0)
|
125
|
-
rubocop (
|
122
|
+
rubocop (1.29.1)
|
126
123
|
parallel (~> 1.10)
|
127
|
-
parser (>=
|
128
|
-
|
129
|
-
|
124
|
+
parser (>= 3.1.0.0)
|
125
|
+
rainbow (>= 2.2.2, < 4.0)
|
126
|
+
regexp_parser (>= 1.8, < 3.0)
|
127
|
+
rexml (>= 3.2.5, < 4.0)
|
128
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
130
129
|
ruby-progressbar (~> 1.7)
|
131
|
-
unicode-display_width (
|
130
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
131
|
+
rubocop-ast (1.17.0)
|
132
|
+
parser (>= 3.1.1.0)
|
132
133
|
ruby-macho (2.5.1)
|
133
134
|
ruby-progressbar (1.11.0)
|
134
|
-
terminal-table (3.0.2)
|
135
|
-
unicode-display_width (>= 1.1.1, < 3)
|
136
135
|
thor (1.2.1)
|
137
|
-
thread_safe (0.3.6)
|
138
136
|
typhoeus (1.4.0)
|
139
137
|
ethon (>= 0.9.0)
|
140
|
-
tzinfo (
|
141
|
-
|
142
|
-
unicode-display_width (1.
|
138
|
+
tzinfo (2.0.4)
|
139
|
+
concurrent-ruby (~> 1.0)
|
140
|
+
unicode-display_width (2.1.0)
|
143
141
|
xcodeproj (1.21.0)
|
144
142
|
CFPropertyList (>= 2.3.3, < 4.0)
|
145
143
|
atomos (~> 0.1.3)
|
@@ -147,6 +145,7 @@ GEM
|
|
147
145
|
colored2 (~> 3.1)
|
148
146
|
nanaimo (~> 0.3.0)
|
149
147
|
rexml (~> 3.2.4)
|
148
|
+
zeitwerk (2.5.4)
|
150
149
|
|
151
150
|
PLATFORMS
|
152
151
|
x86_64-darwin-21
|
@@ -157,7 +156,6 @@ DEPENDENCIES
|
|
157
156
|
cocoapods-core
|
158
157
|
colored
|
159
158
|
colored2
|
160
|
-
gitlab
|
161
159
|
httparty
|
162
160
|
rake (~> 13.0)
|
163
161
|
rspec (~> 3.2)
|
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'pathname'
|
3
|
+
require 'pp'
|
4
|
+
require 'tmpdir'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
require 'rainbow'
|
8
|
+
require 'yaml'
|
9
|
+
require 'git'
|
10
|
+
require 'yk_command/analyze/dependency_result'
|
11
|
+
|
12
|
+
module YkCommand
|
13
|
+
IGNORE_PROJECT_FILE = '.YKAnalyzeConfig.yml'.freeze
|
14
|
+
|
15
|
+
class Analyzer < Thor
|
16
|
+
no_commands do
|
17
|
+
|
18
|
+
def dependency(path = nil)
|
19
|
+
say "\ncurrent working folder: #{path}\n"
|
20
|
+
project_path = ''
|
21
|
+
project_name = ''
|
22
|
+
begin
|
23
|
+
g = Git.open(path)
|
24
|
+
project_path = Pathname.new(g.lib.git_work_dir)
|
25
|
+
project_name = g.config['remote.origin.url'].split('/').last.split('.')[0]
|
26
|
+
|
27
|
+
unless project_name.empty?
|
28
|
+
podfiles = Dir.glob("#{path}/**/Podfile")
|
29
|
+
if !podfiles.empty?
|
30
|
+
begin
|
31
|
+
project_path = podfiles[podfiles.length - 1]
|
32
|
+
podfile_dir = Pathname.new(project_path).dirname.to_s
|
33
|
+
say "start analyze... path contain [Podfile ,Pods/ ,Podfile.lock] is #{podfile_dir} \n ", :green
|
34
|
+
result = analyze(podfile_dir)
|
35
|
+
app_info = Request.new.get_project_info(project_name)
|
36
|
+
if app_info['id']
|
37
|
+
say "uploading dependencies for project #{project_name} ..."
|
38
|
+
upload_res = Request.new.upload_app_dependency(app_info['id'], result)
|
39
|
+
if upload_res['code'] == 0
|
40
|
+
result(0, project_name, 'uploaded , finished ', :green)
|
41
|
+
else
|
42
|
+
result(1, project_name, "Error :upload dependencies for project #{project_name} - #{app_info["id"]} failed ", :red)
|
43
|
+
end
|
44
|
+
else
|
45
|
+
result(1, project_name, "Error :Get App project ID failed , #{project_name}", :red)
|
46
|
+
end
|
47
|
+
|
48
|
+
rescue
|
49
|
+
say "Error : #{$!}", :red
|
50
|
+
say "Error : #{ $@}", :red
|
51
|
+
result(1, project_name, "Skip folder : #{podfile_dir} ", :red)
|
52
|
+
end
|
53
|
+
|
54
|
+
else
|
55
|
+
result(2, project_name, "No podfile find ,Skip folder : #{project_name} ", :yellow)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
rescue
|
61
|
+
result(2, '', "No .git folder find in #{path} ,skip folder ... ", :yellow)
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
def result(code, name, message, color)
|
68
|
+
say message, color
|
69
|
+
say "\n<--\n", color
|
70
|
+
{ 'code' => "#{code}", 'name' => "#{name}" }
|
71
|
+
end
|
72
|
+
|
73
|
+
def workspace_analyze(path = nil)
|
74
|
+
Dir.chdir(path)
|
75
|
+
subdir_list = Dir['*'].reject { |o| not File.directory?(o) }
|
76
|
+
say "Start in Workspace : #{path} ...", :yellow
|
77
|
+
subdir_list.each do |project_dir|
|
78
|
+
say "\n#{Pathname.new(project_dir).split[1]} ", :yellow
|
79
|
+
end
|
80
|
+
say "\n\n"
|
81
|
+
say "\n ... start scanning to analyze ...\n\n"
|
82
|
+
|
83
|
+
success_count = 0
|
84
|
+
success_name_list = []
|
85
|
+
failed_count = 0
|
86
|
+
failed_name_list = []
|
87
|
+
skip_count = 0
|
88
|
+
|
89
|
+
subdir_list.each { |project_dir|
|
90
|
+
project_path = "#{path}/#{project_dir}"
|
91
|
+
res = dependency project_path
|
92
|
+
if res['code'] == '0'
|
93
|
+
success_count += 1
|
94
|
+
success_name_list << res['name']
|
95
|
+
elsif res['code'] == '1'
|
96
|
+
failed_count += 1
|
97
|
+
failed_name_list << res['name']
|
98
|
+
else
|
99
|
+
skip_count += 1
|
100
|
+
end
|
101
|
+
}
|
102
|
+
|
103
|
+
say "\nworkspace analyze done ! ..."
|
104
|
+
say "success:#{success_count},#{success_name_list}", :green
|
105
|
+
say "failed :#{failed_count},#{failed_name_list}", :red
|
106
|
+
say "skip :#{skip_count}", :yellow
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
def ignore_file(path = nil)
|
111
|
+
ignore_file_path = "#{path}/#{IGNORE_PROJECT_FILE}"
|
112
|
+
ignore = File.exist?(ignore_file_path) ? YAML.load_file(ignore_file_path) : {}
|
113
|
+
ignore[:projects] = ["ShouYinTong", "ShouYinTongSaas"]
|
114
|
+
File.open(ignore_file_path, 'w') do |f|
|
115
|
+
f.write ignore.to_yaml
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def analyze(podfile_dir_path)
|
120
|
+
@path = Pathname.new(podfile_dir_path)
|
121
|
+
raise 'absolute path is needed' unless @path.absolute?
|
122
|
+
Pod::Config.instance.installation_root = @path
|
123
|
+
@podFile = Pod::Podfile.from_file(@path + 'Podfile')
|
124
|
+
@podLock = Pod::Lockfile.from_file(@path + 'Podfile.lock')
|
125
|
+
|
126
|
+
Dir.chdir(podfile_dir_path) do
|
127
|
+
analyze_with_podfile
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
def analyze_with_podfile
|
133
|
+
sandbox = Dir.pwd + '/Pods'
|
134
|
+
# if @path
|
135
|
+
# sandbox = Dir.mktmpdir
|
136
|
+
# else
|
137
|
+
# end
|
138
|
+
|
139
|
+
analyzer = Pod::Installer::Analyzer.new(
|
140
|
+
Pod::Sandbox.new(sandbox),
|
141
|
+
@podFile,
|
142
|
+
@podLock
|
143
|
+
)
|
144
|
+
|
145
|
+
specifications = analyzer.analyze(:outdated ).specifications.map(&:root).uniq
|
146
|
+
array = []
|
147
|
+
dependency_result = DependencyResult.new(specifications, @podLock)
|
148
|
+
dependency_result.result_json
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
File without changes
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'cocoapods-core/lockfile'
|
3
|
+
|
4
|
+
YK = 'yeah'+'ka'
|
5
|
+
|
6
|
+
COMPONENT_TYPE = ['基础组件', 'UI组件', '通用业务组件', '业务模块', '其它']
|
7
|
+
|
8
|
+
FOUNDATION_COMPONENT_NAMES = ['基础组件', 'UI组件', '通用业务组件', '业务模块', '其它']
|
9
|
+
|
10
|
+
UI_COMPONENT_NAMES = ['']
|
11
|
+
|
12
|
+
COMMON_BUSINESS_COMPONENT_NAMES = ['']
|
13
|
+
|
14
|
+
UNCATEGORIZE_COMPONENT_NAMES = ['']
|
15
|
+
|
16
|
+
SPECIFICATION_FILTER_KEYS = ['summary', 'homepage', 'authors', "source"]
|
17
|
+
|
18
|
+
module YkCommand
|
19
|
+
|
20
|
+
class DependencyResult
|
21
|
+
|
22
|
+
def initialize(specifications, pod_lock)
|
23
|
+
@specifications = specifications
|
24
|
+
@pod_lock = pod_lock
|
25
|
+
@result = []
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_info_in_lokfile
|
29
|
+
|
30
|
+
removed_subspecs_dep_list = []
|
31
|
+
@pod_lock.pod_names.each do |pn|
|
32
|
+
removed_subspecs_dep_list = removed_subspecs_dep_list.push(pn.split('/')[0]).uniq
|
33
|
+
end
|
34
|
+
|
35
|
+
#去重后的 依赖 名字 数组
|
36
|
+
removed_subspecs_dep_list.each do |pod_name|
|
37
|
+
map = {}
|
38
|
+
version = @pod_lock.version(pod_name).version
|
39
|
+
spec_repo_name = @pod_lock.spec_repo(pod_name)
|
40
|
+
is_local_dependency = is_pod_from_local pod_name
|
41
|
+
is_yk_dependency = is_yk_dependency pod_name
|
42
|
+
is_install_from_git_commit = !@pod_lock.checkout_options_for_pod_named(pod_name).nil?
|
43
|
+
dep_attribute_in_pod_file = find_info_in_specifications pod_name
|
44
|
+
pp "#{pod_name} #{spec_repo_name} #{version} local:#{is_local_dependency} ,yeahka:#{is_yk_dependency},git_commit: #{is_install_from_git_commit}"
|
45
|
+
map["name"] = pod_name
|
46
|
+
map["version"] = version
|
47
|
+
map["is_local_dependency"] = is_local_dependency
|
48
|
+
map["is_yk_dependency"] = is_yk_dependency
|
49
|
+
map["is_install_from_git_commit"] = is_install_from_git_commit.nil?
|
50
|
+
dep_attribute_in_pod_file.each do |k, v|
|
51
|
+
if SPECIFICATION_FILTER_KEYS.include?(k)
|
52
|
+
map[k] = v
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
@result.push map
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def result_json
|
63
|
+
find_info_in_lokfile
|
64
|
+
@result.to_json
|
65
|
+
end
|
66
|
+
|
67
|
+
def is_yk_dependency(name)
|
68
|
+
tag = false
|
69
|
+
|
70
|
+
@pod_lock.dependencies.each do |dep|
|
71
|
+
next unless dep.name == name && !dep.external_source.nil?
|
72
|
+
|
73
|
+
dep.external_source.each do |k, v|
|
74
|
+
tag = if dep.external_source.include?(:git)
|
75
|
+
dep.external_source[:git].include?(YK)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
tag
|
80
|
+
end
|
81
|
+
|
82
|
+
def is_pod_from_local(name)
|
83
|
+
tag = false
|
84
|
+
@pod_lock.dependencies.each do |dep|
|
85
|
+
next unless dep.name == name && !dep.external_source.nil?
|
86
|
+
tag = dep.external_source.include?(:path)
|
87
|
+
end
|
88
|
+
tag
|
89
|
+
end
|
90
|
+
|
91
|
+
def find_info_in_specifications(name)
|
92
|
+
map = {}
|
93
|
+
@specifications.each do |sp|
|
94
|
+
next unless sp.name == name
|
95
|
+
|
96
|
+
map = sp.attributes_hash
|
97
|
+
end
|
98
|
+
map
|
99
|
+
end
|
100
|
+
|
101
|
+
# def podfile_dependencies(podfile)
|
102
|
+
# res = []
|
103
|
+
# podfile.root_target_definitions.each do |td|
|
104
|
+
# children_definitions = td.recursive_children
|
105
|
+
# children_definitions.each do |cd|
|
106
|
+
# dependencies_hash_array = cd.send(:get_hash_value, 'dependencies')
|
107
|
+
# next if dependencies_hash_array.nil? || dependencies_hash_array.count.zero?
|
108
|
+
#
|
109
|
+
# dependencies_hash_array.each do |item|
|
110
|
+
# next if item.class.name != 'Hash'
|
111
|
+
#
|
112
|
+
# item.each do |name, _|
|
113
|
+
# res.push name
|
114
|
+
# end
|
115
|
+
# end
|
116
|
+
# end
|
117
|
+
# end
|
118
|
+
# res
|
119
|
+
# end
|
120
|
+
#
|
121
|
+
# def find_dependencies(name, map, res, dependencies_map, root_name)
|
122
|
+
# return unless map[name]
|
123
|
+
#
|
124
|
+
# map[name].each do |k|
|
125
|
+
# find_dependencies(k.name, map, res, dependencies_map, root_name)
|
126
|
+
# dependency = dependencies_map[k.name.split('/')[0]]
|
127
|
+
# res.push dependency.name if dependency && dependency.name != root_name
|
128
|
+
# end
|
129
|
+
# res
|
130
|
+
# end
|
131
|
+
#
|
132
|
+
# def subspecs_with_name(spec, subspecs_short_names)
|
133
|
+
# subspecs_short_names.map do |name|
|
134
|
+
# spec.subspecs.find { |ss| ss.name.include? name }
|
135
|
+
# end
|
136
|
+
# end
|
137
|
+
#
|
138
|
+
#
|
139
|
+
end
|
140
|
+
end
|
File without changes
|