depcheck 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 +4 -4
- data/README.md +3 -1
- data/lib/depcheck/analyzer.rb +2 -2
- data/lib/depcheck/command/analyze_command.rb +2 -1
- data/lib/depcheck/finder.rb +6 -6
- data/lib/depcheck/output/simple_output.rb +4 -2
- data/lib/depcheck/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46d4480b1f29047d2da3b5df66388319bc39c0c5
|
4
|
+
data.tar.gz: 94b75c5b49164cf35818e74cfc2466f01bb88be3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c184b21af1c41f81e998eb3673f147271718f73de9cb29ad79b4bcb2a5fe1ac97a470acb0c17dffc54c098c6ad4d932c85fc710271d924ceb45db98c81d27ff0
|
7
|
+
data.tar.gz: 013d9eec20b9708ab45c505a3dcc4f3ecd96cef718d3e0235cc0ce0980acd9adebb0263d358ea562987dda62d55b8715f85db6deb68d93ff482cf8952f4d1345
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
`Depcheck` is a dependency analyzer tool for Swift projects. `Depcheck` reports dependencies per class, allowing you to easily detect classes that have too many dependencies. `Depcheck` can also report how many dependants a class have. Therefore you can spot the most used and unused classes.
|
4
4
|
|
5
|
+
<img src="https://github.com/wojteklu/depcheck/blob/master/example/analyze.png?raw=true">
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -41,7 +43,7 @@ $ depcheck analyze --workspace path/to/workspace.xcworkspace --scheme YourXcodeS
|
|
41
43
|
|
42
44
|
## Contributing
|
43
45
|
|
44
|
-
I’d love to see your ideas for improving this library! The best way to contribute is by submitting a pull request. I’ll do
|
46
|
+
I’d love to see your ideas for improving this library! The best way to contribute is by submitting a pull request. I’ll do my best to respond to your patch as soon as possible. You can also submit a [new GitHub issue](https://github.com/wojteklu/depcheck/issues/new) if you find bugs or have questions.
|
45
47
|
|
46
48
|
## License
|
47
49
|
|
data/lib/depcheck/analyzer.rb
CHANGED
@@ -16,8 +16,8 @@ module Depcheck
|
|
16
16
|
|
17
17
|
provides = dependencies['provides-top-level']
|
18
18
|
nominals = dependencies['provides-nominal']
|
19
|
-
depends = dependencies['depends-top-level']
|
20
|
-
depends_member = dependencies['depends-member']
|
19
|
+
depends = dependencies['depends-top-level'] || []
|
20
|
+
depends_member = dependencies['depends-member'] || []
|
21
21
|
|
22
22
|
if provides.nil? || nominals.nil? || provides.count != nominals.count
|
23
23
|
next
|
@@ -2,6 +2,7 @@ class AnalyzeCommand < Clamp::Command
|
|
2
2
|
option ['--project'], 'PROJECT', 'Path to the xcodeproj'
|
3
3
|
option ['--scheme'], 'SCHEME', 'The scheme that the project was built in'
|
4
4
|
option ['--workspace'], 'WORKSPACE', 'Path to the workspace'
|
5
|
+
option ["--verbose", "-v"], :flag, "Enable verbose mode"
|
5
6
|
|
6
7
|
def execute
|
7
8
|
|
@@ -11,7 +12,7 @@ class AnalyzeCommand < Clamp::Command
|
|
11
12
|
|
12
13
|
swiftdeps = Depcheck::Finder.find_swiftdeps(project, workspace, scheme)
|
13
14
|
results = Depcheck::Analyzer.generate_dependencies(swiftdeps)
|
14
|
-
Depcheck::SimpleOutput.post(results)
|
15
|
+
Depcheck::SimpleOutput.post(results, verbose?)
|
15
16
|
end
|
16
17
|
|
17
18
|
end
|
data/lib/depcheck/finder.rb
CHANGED
@@ -8,14 +8,14 @@ module Depcheck
|
|
8
8
|
"-workspace \"#{workspace}\" -scheme \"#{scheme}\""
|
9
9
|
end
|
10
10
|
|
11
|
-
build_settings = `xcodebuild #{arg} -showBuildSettings build CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO
|
11
|
+
build_settings = `xcodebuild #{arg} -showBuildSettings build CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO`
|
12
|
+
raise StandardError until $?.success?
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
14
|
+
derived_data_path = build_settings.match(/ OBJROOT = (.+)/)[1]
|
15
|
+
project_name = build_settings.match(/ PROJECT_NAME = (.+)/)[1]
|
16
|
+
target_name = build_settings.match(/ TARGET_NAME = (.+)/)[1]
|
17
17
|
|
18
|
-
derived_data_path
|
18
|
+
"#{derived_data_path}/#{project_name}.build/**/#{target_name}.build"
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.find_swiftdeps(project, workspace, scheme)
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module Depcheck
|
2
2
|
module SimpleOutput
|
3
3
|
|
4
|
-
def self.post(objs)
|
4
|
+
def self.post(objs, verbose)
|
5
5
|
objs = objs.sort_by { |obj| obj.dependencies.size }.reverse
|
6
6
|
|
7
7
|
objs.each_with_index do |obj, index|
|
8
|
-
|
8
|
+
print "#{index + 1}. #{obj.name} - #{obj.dependencies.size}"
|
9
|
+
print " - [#{obj.dependencies.join(', ')}]" if verbose
|
10
|
+
print "\n"
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
data/lib/depcheck/version.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.2.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-08-
|
11
|
+
date: 2016-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.6.6
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: Dependency analyzer tool for Swift projects
|