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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 931b0aa1d777842d8b1b92f97ab9e03e13fdb0b9
4
- data.tar.gz: b19e7d76509d680c1edd90423dcf5af05791a0ff
3
+ metadata.gz: 46d4480b1f29047d2da3b5df66388319bc39c0c5
4
+ data.tar.gz: 94b75c5b49164cf35818e74cfc2466f01bb88be3
5
5
  SHA512:
6
- metadata.gz: f4caa08393f8ffefaea97e3847204c9cd19471120b26340e73348964657db8b6b022ad915d9c62bcfb963b60e2a5705fbe147a5e66533e2d44cbf82719d23156
7
- data.tar.gz: 224759b1d0d5d15881193fed02cefbf4ee7d5f1e3f573f47845e85659acc983971e3de5993a20e793c4cb0fc1f87ba33a10ea822a835b42848f1453c3be97b0e
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 our 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.
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
 
@@ -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
@@ -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 2>&1`
11
+ build_settings = `xcodebuild #{arg} -showBuildSettings build CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO`
12
+ raise StandardError until $?.success?
12
13
 
13
- if build_settings
14
- derived_data_path = build_settings.match(/ OBJROOT = (.+)/)
15
- derived_data_path = derived_data_path[1] if derived_data_path
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
- puts "#{index + 1}. #{obj.name} - #{obj.dependencies.size} \n"
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
 
@@ -1,3 +1,3 @@
1
1
  module Depcheck
2
- VERSION = '0.1.0' unless defined?(Depcheck::VERSION)
2
+ VERSION = '0.2.0'.freeze
3
3
  end
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.1.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-16 00:00:00.000000000 Z
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.4.6
132
+ rubygems_version: 2.6.6
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Dependency analyzer tool for Swift projects