depcheck 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/depcheck.rb +12 -0
- data/lib/depcheck/command/analyze_command.rb +1 -8
- data/lib/depcheck/command/graph_command.rb +3 -9
- data/lib/depcheck/command/usage_command.rb +1 -8
- data/lib/depcheck/finder.rb +4 -2
- data/lib/depcheck/output/graph_output.rb +7 -5
- data/lib/depcheck/version.rb +1 -1
- data/spec/finder_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c558e2904326c13fd7718ecd80cd37175758ce54
|
4
|
+
data.tar.gz: 572d6f5de9aa9c05ad1e29f692a5ac97dabacbd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c0f4d9824285f6c3142caea66c8567f7200c55c814e127082173d11d56ff621ee40b06caa48cfbd958695d81e3c6a7e0363c2daeec3f023cbd0311579d190cc
|
7
|
+
data.tar.gz: fb7bd2bd10a28215cc2408acc00db37c9162350352a3ce4e68c5f49863d16988b37873b9dba1a8c163409417e8986aa4ae566354c8f9a6979ed11c2971e51490
|
data/Gemfile.lock
CHANGED
data/lib/depcheck.rb
CHANGED
@@ -3,8 +3,20 @@ require 'depcheck/analyzer'
|
|
3
3
|
require 'depcheck/dependency_info'
|
4
4
|
require 'depcheck/output/simple_output'
|
5
5
|
require 'depcheck/output/graph_output'
|
6
|
+
require 'depcheck/version'
|
6
7
|
|
7
8
|
module Depcheck
|
8
9
|
Encoding.default_external = 'utf-8'
|
9
10
|
|
11
|
+
def self.run(project, workspace, scheme)
|
12
|
+
|
13
|
+
unless project || (workspace && scheme)
|
14
|
+
raise StandardError, 'Must provide project path or workspace path with scheme.'
|
15
|
+
end
|
16
|
+
|
17
|
+
swiftdeps = Depcheck::Finder.find_swiftdeps(project, workspace, scheme)
|
18
|
+
analyzer = Depcheck::Analyzer.new
|
19
|
+
results = analyzer.generate_dependencies(swiftdeps)
|
20
|
+
end
|
21
|
+
|
10
22
|
end
|
@@ -5,14 +5,7 @@ class AnalyzeCommand < Clamp::Command
|
|
5
5
|
option ["--verbose", "-v"], :flag, "Enable verbose mode"
|
6
6
|
|
7
7
|
def execute
|
8
|
-
|
9
|
-
unless project || (workspace && scheme)
|
10
|
-
raise StandardError, 'Must provide project path or workspace path with scheme.'
|
11
|
-
end
|
12
|
-
|
13
|
-
swiftdeps = Depcheck::Finder.find_swiftdeps(project, workspace, scheme)
|
14
|
-
analyzer = Depcheck::Analyzer.new
|
15
|
-
results = analyzer.generate_dependencies(swiftdeps)
|
8
|
+
results = Depcheck.run(project, workspace, scheme)
|
16
9
|
Depcheck::SimpleOutput.post(results, verbose?)
|
17
10
|
end
|
18
11
|
|
@@ -3,18 +3,12 @@ class GraphCommand < Clamp::Command
|
|
3
3
|
option ['--scheme'], 'SCHEME', 'The scheme that the project was built in'
|
4
4
|
option ['--workspace'], 'WORKSPACE', 'Path to the workspace'
|
5
5
|
option ["--include"], "INCLUDE", "Regexp of classes that will be shown on graph"
|
6
|
+
option ["--dot", "-d"], :flag, "Export dot file"
|
6
7
|
|
7
8
|
def execute
|
8
|
-
|
9
|
-
unless project || (workspace && scheme)
|
10
|
-
raise StandardError, 'Must provide project path or workspace path with scheme.'
|
11
|
-
end
|
12
|
-
|
13
|
-
swiftdeps = Depcheck::Finder.find_swiftdeps(project, workspace, scheme)
|
14
|
-
analyzer = Depcheck::Analyzer.new
|
15
|
-
results = analyzer.generate_dependencies(swiftdeps)
|
9
|
+
results = Depcheck.run(project, workspace, scheme)
|
16
10
|
output = Depcheck::GraphOutput.new
|
17
|
-
output.post(results, include)
|
11
|
+
output.post(results, include, dot?)
|
18
12
|
end
|
19
13
|
|
20
14
|
end
|
@@ -4,14 +4,7 @@ class UsageCommand < Clamp::Command
|
|
4
4
|
option ['--workspace'], 'WORKSPACE', 'Path to the workspace'
|
5
5
|
|
6
6
|
def execute
|
7
|
-
|
8
|
-
unless project || (workspace && scheme)
|
9
|
-
raise StandardError, 'Must provide project path or workspace path with scheme.'
|
10
|
-
end
|
11
|
-
|
12
|
-
swiftdeps = Depcheck::Finder.find_swiftdeps(project, workspace, scheme)
|
13
|
-
analyzer = Depcheck::Analyzer.new
|
14
|
-
results = analyzer.generate_dependencies(swiftdeps)
|
7
|
+
results = Depcheck.run(project, workspace, scheme)
|
15
8
|
Depcheck::SimpleOutput.post_usage(results)
|
16
9
|
end
|
17
10
|
|
data/lib/depcheck/finder.rb
CHANGED
@@ -5,9 +5,11 @@ module Depcheck
|
|
5
5
|
arg = if project
|
6
6
|
"-project \"#{project}\""
|
7
7
|
else
|
8
|
-
"-workspace \"#{workspace}\"
|
8
|
+
"-workspace \"#{workspace}\""
|
9
9
|
end
|
10
10
|
|
11
|
+
arg+= " -scheme \"#{scheme}\"" if scheme
|
12
|
+
|
11
13
|
build_settings = `xcodebuild #{arg} -showBuildSettings build CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO`
|
12
14
|
raise StandardError until $?.success?
|
13
15
|
|
@@ -15,7 +17,7 @@ module Depcheck
|
|
15
17
|
project_name = build_settings.match(/ PROJECT_NAME = (.+)/)[1]
|
16
18
|
target_name = build_settings.match(/ TARGET_NAME = (.+)/)[1]
|
17
19
|
|
18
|
-
"#{derived_data_path}/#{project_name}.build/**/#{target_name}
|
20
|
+
"#{derived_data_path}/#{project_name}.build/**/#{target_name}*.build"
|
19
21
|
end
|
20
22
|
|
21
23
|
def self.find_swiftdeps(project, workspace, scheme)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Depcheck
|
2
2
|
class GraphOutput
|
3
3
|
|
4
|
-
def post(objs, include)
|
4
|
+
def post(objs, include, dot)
|
5
5
|
|
6
6
|
# installs graphviz if needed
|
7
7
|
system 'brew install graphviz' unless graphviz_installed?
|
@@ -21,10 +21,12 @@ module Depcheck
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# run dot command
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
if dot
|
25
|
+
`dot -T png #{file_name}.dot`
|
26
|
+
elsif
|
27
|
+
`dot -T png #{file_name}.dot > #{file_name}.png && open #{file_name}.png`
|
28
|
+
File.delete("#{file_name}.dot")
|
29
|
+
end
|
28
30
|
end
|
29
31
|
|
30
32
|
def generate_graph_description(objs, include)
|
data/lib/depcheck/version.rb
CHANGED
data/spec/finder_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: depcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wojciech Lukaszuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|