jmpod 0.2.4 → 0.2.5
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/Gemfile.lock +1 -1
- data/bin/jmpod +0 -1
- data/lib/jmpod/command/analyze.rb +59 -85
- data/lib/jmpod/command/dependency.rb +33 -0
- data/lib/jmpod/command.rb +1 -1
- data/lib/jmpod/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6459c9d7ddb429cda4c2d449c79f80e46151649a2863c6951a7b8e4c6d97dd73
|
4
|
+
data.tar.gz: c41b842e850b3df388afdd81cd63f8a6b37c0258ba0bf5abe79d96749390a8a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a4ae079a3999310e502397af86968e9738b2f32fa0e0bf714745b41d4025bac88581a632e5665eaae2bd1a9bd4e8cf4f9e2340b90ad733501bb6737d2c72ec8
|
7
|
+
data.tar.gz: dcf57dbb0dd9ab6ce55ae1b4550b028b9cb222fde327ca7ec9d2f444bcd9928e6145cea0f092b8e11b489ec9250646646be9fc32e47c738da0209dd997985095
|
data/Gemfile.lock
CHANGED
data/bin/jmpod
CHANGED
@@ -3,106 +3,80 @@ require 'pathname'
|
|
3
3
|
require 'tmpdir'
|
4
4
|
|
5
5
|
module Jmpod
|
6
|
-
class
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
puts 'analyze starting ......'.green
|
15
|
-
@podfile_dir_path = argv.shift_argument
|
16
|
-
super
|
17
|
-
end
|
6
|
+
class Analyze
|
7
|
+
def podfile_dependencies(podfile)
|
8
|
+
res = []
|
9
|
+
podfile.root_target_definitions.each do |td|
|
10
|
+
children_definitions = td.recursive_children
|
11
|
+
children_definitions.each do |cd|
|
12
|
+
dependencies_hash_array = cd.send(:get_hash_value, 'dependencies')
|
13
|
+
next if dependencies_hash_array.nil? || dependencies_hash_array.count.zero?
|
18
14
|
|
15
|
+
dependencies_hash_array.each do |item|
|
16
|
+
next if item.class.name != 'Hash'
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
podfile.root_target_definitions.each do |td|
|
23
|
-
children_definitions = td.recursive_children
|
24
|
-
children_definitions.each do |cd|
|
25
|
-
dependencies_hash_array = cd.send(:get_hash_value, 'dependencies')
|
26
|
-
next if dependencies_hash_array.nil? || dependencies_hash_array.count.zero?
|
27
|
-
|
28
|
-
dependencies_hash_array.each do |item|
|
29
|
-
next if item.class.name != 'Hash'
|
30
|
-
|
31
|
-
item.each do |name, _|
|
32
|
-
res.push name
|
33
|
-
end
|
18
|
+
item.each do |name, _|
|
19
|
+
res.push name
|
34
20
|
end
|
35
21
|
end
|
36
22
|
end
|
37
|
-
res
|
38
23
|
end
|
24
|
+
res
|
25
|
+
end
|
39
26
|
|
40
|
-
|
41
|
-
|
27
|
+
def analyze_with_podfile(_podfile_dir_path, podfile, lockfile = nil)
|
28
|
+
if _podfile_dir_path
|
29
|
+
sandbox = Dir.mktmpdir
|
30
|
+
else
|
31
|
+
sandbox = Dir.pwd + '/Pods'
|
42
32
|
end
|
33
|
+
p 'sandbox === '
|
34
|
+
pp sandbox
|
35
|
+
an = Pod::Installer::Analyzer.new(Pod::Sandbox.new(sandbox), podfile)
|
36
|
+
pp an
|
37
|
+
# analyzer = Pod::Installer::Analyzer.new(
|
38
|
+
# Pod::Sandbox.new(sandbox),
|
39
|
+
# podfile,
|
40
|
+
# lockfile
|
41
|
+
# )
|
43
42
|
|
44
|
-
|
45
|
-
super
|
46
|
-
end
|
43
|
+
# specifications = analyzer.analyze.specifications.map(&:root).uniq
|
47
44
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
# new_map = generate_pods_data(specifications)
|
46
|
+
# p "new_map === "
|
47
|
+
# pp new_map
|
48
|
+
# new_map
|
49
|
+
end
|
50
|
+
|
51
|
+
def generate_pods_data(specs)
|
52
|
+
pods_and_deps_merged = specs.reduce({}) do |result, spec|
|
53
|
+
name = spec.to_s
|
54
|
+
result[name] ||= []
|
55
|
+
result[name].concat(spec.all_dependencies.map(&:to_s))
|
56
|
+
result
|
52
57
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
sandbox = Dir.mktmpdir
|
57
|
-
else
|
58
|
-
sandbox = Dir.pwd + '/Pods'
|
59
|
-
end
|
60
|
-
p 'sandbox === '
|
61
|
-
pp sandbox
|
62
|
-
analyzer = Pod::Installer::Analyzer.new(
|
63
|
-
Pod::Sandbox.new(sandbox),
|
64
|
-
podfile,
|
65
|
-
lockfile
|
66
|
-
)
|
67
|
-
|
68
|
-
specifications = analyzer.analyze.specifications.map(&:root).uniq
|
69
|
-
|
70
|
-
new_map = generate_pods_data(specifications)
|
71
|
-
p "new_map === "
|
72
|
-
pp new_map
|
73
|
-
new_map
|
58
|
+
|
59
|
+
pod_and_deps = pods_and_deps_merged.map do |name, deps|
|
60
|
+
deps.empty? ? name : { name => YAMLHelper.sorted_array(deps.uniq) }
|
74
61
|
end
|
62
|
+
YAMLHelper.sorted_array(pod_and_deps)
|
63
|
+
end
|
75
64
|
|
76
|
-
|
77
|
-
|
78
|
-
name = spec.to_s
|
79
|
-
result[name] ||= []
|
80
|
-
result[name].concat(spec.all_dependencies.map(&:to_s))
|
81
|
-
result
|
82
|
-
end
|
65
|
+
def self.find_dependencies(name, map, res, dependencies_map, root_name)
|
66
|
+
return unless map[name]
|
83
67
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
def self.find_dependencies(name, map, res, dependencies_map, root_name)
|
91
|
-
return unless map[name]
|
92
|
-
|
93
|
-
map[name].each do |k|
|
94
|
-
find_dependencies(k.name, map, res, dependencies_map, root_name)
|
95
|
-
dependency = dependencies_map[k.name.split('/')[0]]
|
96
|
-
res.push dependency.name if dependency && dependency.name != root_name
|
97
|
-
end
|
98
|
-
res
|
68
|
+
map[name].each do |k|
|
69
|
+
find_dependencies(k.name, map, res, dependencies_map, root_name)
|
70
|
+
dependency = dependencies_map[k.name.split('/')[0]]
|
71
|
+
res.push dependency.name if dependency && dependency.name != root_name
|
99
72
|
end
|
100
|
-
|
101
|
-
def self.subspecs_with_name(spec, subspecs_short_names)
|
102
|
-
subspecs_short_names.map do |name|
|
103
|
-
spec.subspecs.find { |ss| ss.name.include? name }
|
104
|
-
end
|
105
|
-
end
|
73
|
+
res
|
106
74
|
end
|
75
|
+
|
76
|
+
def self.subspecs_with_name(spec, subspecs_short_names)
|
77
|
+
subspecs_short_names.map do |name|
|
78
|
+
spec.subspecs.find { |ss| ss.name.include? name }
|
79
|
+
end
|
80
|
+
end
|
107
81
|
end
|
108
82
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'pp'
|
2
|
+
require 'tmpdir'
|
3
|
+
require 'jmpod/command/analyze'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Dependency < Command
|
8
|
+
self.summary = '分析podfile完整依赖链'
|
9
|
+
self.description = <<-DESC
|
10
|
+
分析podfile完整依赖链,并输出json文件.
|
11
|
+
DESC
|
12
|
+
|
13
|
+
def initialize(argv)
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.options
|
18
|
+
[
|
19
|
+
].concat(super)
|
20
|
+
end
|
21
|
+
|
22
|
+
def validate!
|
23
|
+
super
|
24
|
+
verify_podfile_exists!
|
25
|
+
end
|
26
|
+
|
27
|
+
def run
|
28
|
+
analyze_result = Jmpod::Analyzer.analyze_with_podfile(nil, config.podfile)
|
29
|
+
pp analyze_result
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/jmpod/command.rb
CHANGED
data/lib/jmpod/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jmpod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jieming
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/jmpod/command/create/oc.rb
|
128
128
|
- lib/jmpod/command/create/swift.rb
|
129
129
|
- lib/jmpod/command/create/third.rb
|
130
|
+
- lib/jmpod/command/dependency.rb
|
130
131
|
- lib/jmpod/command/init.rb
|
131
132
|
- lib/jmpod/command/init/ci.rb
|
132
133
|
- lib/jmpod/command/init/unit.rb
|