dep_check 0.1.0 → 0.2.0

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: b4ca40a4559da05ca3d360b7086bbb736d7fa739
4
- data.tar.gz: bbb084ba4e7f24567dd2a3f68a6fa811e43160f6
3
+ metadata.gz: 2dfae36246fb3711d7b53c99280fd6917b923244
4
+ data.tar.gz: 2029685901f3de4e2950c7230864e34e459d54a2
5
5
  SHA512:
6
- metadata.gz: 327601748f93d1726d9ab698db95ae49ca23e55d602f61675413682178f7c58ef2167f13a7442027994f23882b826d420b2f931b507665fead107875ea9d9a42
7
- data.tar.gz: d66c2185ab1b869d40d6c31f5bbd44f7724f8e186d0e96c2b74581ae032d8886adfd15d0c1dded1bc91b195f90e85658ab2fad5937b99009995c1a6d82a1d01d
6
+ metadata.gz: a1333b140a1b0dd1bd7928eee5c87311f4c158c74cea5edb76d49d7d9075c82b5aa65586697bb2ad85ed0fae29c1f89a287d2622a4e2af702e19b0146cd56f11
7
+ data.tar.gz: f280257f0ad8aca6dfbc7de321b6dde620c491d6751962841defcfd947bda99ef81e46d18ddbfb09349b3b60780d859495ff2302396f1214fba6df35e65ae923
data/bin/depcheck CHANGED
@@ -3,5 +3,4 @@
3
3
  require "bundler/setup"
4
4
  require "dep_check"
5
5
 
6
- DepCheck::DepChecker.run(ARGV)
7
-
6
+ DepCheck::DepChecker.run(ARGV)
@@ -10,7 +10,7 @@
10
10
  module DepCheck
11
11
  class DepChecker < CLAide::Command
12
12
 
13
- self.abstract_command = true
13
+ self.abstract_command = false
14
14
 
15
15
  self.description = <<-DESC
16
16
  cocoapods依赖关系校验. 查找循环依赖路径/构建模块依赖关系图.
@@ -21,7 +21,6 @@ module DepCheck
21
21
 
22
22
  def self.options
23
23
  [
24
- ['--repo=[master|other_repo_name]', 'Use a cocoapods spec repo to run the check, defaults to master'],
25
24
  ['--repo-update', 'Fetch external podspecs and run `pod repo update` before calculating the dependency graph'],
26
25
  ['--graphviz', 'Outputs the dependency graph in Graphviz format to <podspec name>.gv or Podfile.gv'],
27
26
  ['--image', 'Outputs the dependency graph as an image to <podsepc name>.png or Podfile.png'],
@@ -30,45 +29,54 @@ module DepCheck
30
29
 
31
30
  def self.arguments
32
31
  [
33
- CLAide::Argument.new('PODSPEC', false)
32
+ CLAide::Argument.new('PODSPEC_NAME', true),
33
+ CLAide::Argument.new('REPO_NAME', false)
34
34
  ].concat(super)
35
35
  end
36
36
 
37
37
  def initialize(argv)
38
+ puts "initialize in checker"
38
39
  @podspec_name = argv.shift_argument
39
- @repo_name = argv.option('repo', 'master')
40
+ @repo_name = argv.shift_argument
40
41
  @repo_update = argv.flag?('repo-update', false)
41
42
  @produce_graphviz_output = argv.flag?('graphviz', false)
42
43
  @produce_image_output = argv.flag?('image', false)
44
+ if @repo_name
45
+ @repo = Pod::SourcesManager.sources([@repo_name]).first
46
+ else
47
+ @repo = Pod::SourcesManager.sources(['master']).first
48
+ end
43
49
  super
44
50
  end
45
51
 
46
52
  def validate!
47
- super
53
+ super
48
54
  if @podspec_name
49
55
  require 'pathname'
50
56
  path = Pathname.new(@podspec_name)
51
57
  if path.exist?
52
- @podspec = Specification.from_file(path)
58
+ @podspec = Pod::Specification.from_file(path)
53
59
  else
54
- @podspec = SourcesManager.
55
- search(Dependency.new(@podspec_name)).
56
- specification.
57
- subspec_by_name(@podspec_name)
60
+ @podspec = Pod::SourcesManager.search(Pod::Dependency.new(@podspec_name)).specification.subspec_by_name(@podspec_name)
58
61
  end
62
+ Pod::UI.puts "Analyzing #{@podspec} (in repo #{@repo})..."
63
+ else
64
+ raise 'Nothing to check. '
59
65
  end
60
- if (@produce_image_output || @produce_graphviz_output) && Executable.which('dot').nil?
66
+ if (@produce_image_output || @produce_graphviz_output) && Pod::Executable.which('dot').nil?
61
67
  raise Informative, 'GraphViz must be installed and `dot` must be in ' \
62
68
  '$PATH to produce image or graphviz output.'
63
69
  end
70
+
64
71
  end
65
72
 
66
73
 
67
74
  def run
75
+ puts "run in checker"
68
76
  builded = []
69
77
  Pod::UI.puts "1. Buiding dependency graph for #{@podspec_name}... \n ".green
70
78
  Pod::UI.puts "All dependencies : \n".blue
71
- dep_graph_build(@repo_name,@podspec_name,builded,[])
79
+ Pod::UI.puts dep_graph_build(@repo,@podspec,builded,[])
72
80
  Pod::UI.puts "Done! \n".blue
73
81
 
74
82
 
@@ -88,9 +96,9 @@ module DepCheck
88
96
  if @produce_image_output || @produce_graphviz_output
89
97
  Pod::UI.puts "3. Visualizing graph for #{@podspec_name}... \n".green
90
98
  end
91
- graphviz_image_output(graphviz_data(builded,@podspec_name),@podspec_name) if @produce_image_output
99
+ graph_image_out(graphviz_data(builded,@podspec_name),@podspec_name) if @produce_image_output
92
100
  graph_dot_output(graphviz_data(builded,@podspec_name),@podspec_name) if @produce_graphviz_output
93
-
101
+ Pod::UI.puts "Done. \n".blue
94
102
  end
95
103
 
96
104
 
@@ -188,16 +196,18 @@ module DepCheck
188
196
  # 以.png格式输出一个依赖关系图
189
197
  def graph_image_out(graph, output_file_basename)
190
198
  graph.output( :png => "#{output_file_basename}.png")
199
+ Pod::UI.puts "Graph file: #{output_file_basename}.png... \n"
191
200
  end
192
201
 
193
202
 
194
203
  # 以.gv格式输出一个依赖关系图
195
204
  def graph_dot_output(graph, output_file_basename)
196
205
  graph.output( :dot => "#{output_file_basename}.gv")
206
+ Pod::UI.puts "Graph file: #{output_file_basename}.gv... \n"
197
207
  end
198
208
 
199
209
  end
200
210
  end
201
211
 
202
-
212
+ # DepCheck::DepChecker.run(['APShareKit','alipay'])
203
213
 
@@ -1,3 +1,3 @@
1
1
  module DepCheck
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dep_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 卡迩
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-08 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler