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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c387f537205b5615de2b49140a40c36612943a56
4
- data.tar.gz: 1ba94f6285e6705da93dc38b2ed9d6d27a5d290e
3
+ metadata.gz: c558e2904326c13fd7718ecd80cd37175758ce54
4
+ data.tar.gz: 572d6f5de9aa9c05ad1e29f692a5ac97dabacbd0
5
5
  SHA512:
6
- metadata.gz: cbbae78fa7fa9d1d0769606cf10601f71d81806aef4beed4b10c7e4498bc36dc98d54f89af00a1d4d671afa13b4c37b6a14fb093df79b3a0cfea231037c7596d
7
- data.tar.gz: eaaf27fb7ea04e25862019e6b44eae7b50490c128da4da991fbfa7ee8e02c5fe553e35790b00527bf28ae97da12bed60ddccca4b0bdb0c8d5d43510c48e1d7a0
6
+ metadata.gz: 4c0f4d9824285f6c3142caea66c8567f7200c55c814e127082173d11d56ff621ee40b06caa48cfbd958695d81e3c6a7e0363c2daeec3f023cbd0311579d190cc
7
+ data.tar.gz: fb7bd2bd10a28215cc2408acc00db37c9162350352a3ce4e68c5f49863d16988b37873b9dba1a8c163409417e8986aa4ae566354c8f9a6979ed11c2971e51490
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- depcheck (0.3.0)
4
+ depcheck (0.5.0)
5
5
  clamp (~> 0.6)
6
6
 
7
7
  GEM
@@ -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
 
@@ -5,9 +5,11 @@ module Depcheck
5
5
  arg = if project
6
6
  "-project \"#{project}\""
7
7
  else
8
- "-workspace \"#{workspace}\" -scheme \"#{scheme}\""
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}.build"
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
- `dot -T png #{file_name}.dot > #{file_name}.png && open #{file_name}.png`
25
-
26
- # remove temporary file
27
- File.delete("#{file_name}.dot")
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)
@@ -1,3 +1,3 @@
1
1
  module Depcheck
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
@@ -10,7 +10,7 @@ module Depcheck
10
10
  end
11
11
 
12
12
  it 'finds derived data path' do
13
- expected = "D/D/P.build/**/T.build"
13
+ expected = "D/D/P.build/**/T*.build"
14
14
  expect(Finder.find_derived_data_path("Test", nil, nil)).to eq expected
15
15
  end
16
16
  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.4.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 00:00:00.000000000 Z
11
+ date: 2016-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler