cocoapods-graph 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d00b5c1eced22d283334372175b45d6a166c71261dcada2731d9581a86facc9
4
- data.tar.gz: 6c11214289c0328e13214292758d3757bcafa6f70367b9f84effa7b17e7b038b
3
+ metadata.gz: e3efceebe8a3046faf8bec4eb90849ada93dad01d072cf0bc0c2fc367c9b584d
4
+ data.tar.gz: 05cdef5ef7c751165a1f01e3b523a38f642e94c885902d6a1eca4cf61342d9f0
5
5
  SHA512:
6
- metadata.gz: 1477ae702985ad56ff75ad3c134b41fdc85a216d0616399cdd4660b64613f84b588f30c0e56f0e2d1496bbee637f39687da166045d352ed927e02f46d2b205b9
7
- data.tar.gz: edc4c0d543bd6ee201d84496041e0476c95b89a50db097a5746eb4efa2d5964f98fc734ddb2ad7467aa60f82cf32d9deec338b8fe47bf04cf12e54c8c872ab84
6
+ metadata.gz: 67a69893c6e966eab14c1276bd4ae8feca035c20c6d3533a86d8be0f71ddbb053e9149d27c06fdb4f66cea0222fc86bfc66dc29a3bca3fb6b98d2a43caedc53a
7
+ data.tar.gz: '0825ab124cd0971cb346efb8afb404cfa3b43ca050feb90d6217d170bfa8003ba9ed9b4292fb1070c1bd85f3ff30412ec0f8102597c3b672ec22700bd26a925d'
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  end
32
32
 
33
33
  spec.bindir = "exe"
34
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
+ spec.executables = ["cocoapods-graph"]
35
35
  spec.require_paths = ["lib"]
36
36
 
37
37
  # Runtime dependencies
data/exe/cocoapods-graph CHANGED
@@ -1,26 +1,36 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ # Print version immediately if requested
4
+ if ARGV.include?("-v") || ARGV.include?("--version")
5
+ require_relative '../lib/cocoapods_graph/version'
6
+ puts CocoaPodsGraph::VERSION
7
+ exit
8
+ end
2
9
  # frozen_string_literal: true
3
10
 
4
11
  require 'optparse'
5
- require_relative '../lib/cocoapods_graph'
12
+ $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
13
+ require 'cocoapods_graph'
6
14
 
7
15
  module CocoaPodsGraph
8
16
  class CLI
9
17
  VERSION = CocoaPodsGraph::VERSION
10
18
 
11
19
  def self.run
12
- options = {}
20
+ options = {}
13
21
 
22
+ # Print version immediately if requested
23
+ if ARGV.include?('-v') || ARGV.include?('--version')
24
+ puts VERSION
25
+ exit
26
+ end
27
+
14
28
  parser = OptionParser.new do |parser|
15
29
  parser.banner = 'Usage: cocoapods-graph [options]'
16
30
  parser.on('-f', '--file FILE', 'Specify Podfile.lock file path') { |f| options[:file] = f }
17
31
  parser.on('--show', 'Print dependencies on console') { options[:show] = true }
18
32
  parser.on('--json', 'Save dependencies to JSON file') { options[:json] = true }
19
33
  parser.on('--html', 'Save dependencies to interactive HTML wheel graph') { options[:html] = true }
20
- parser.on('-v', '--version', 'Show version') do
21
- puts VERSION
22
- exit
23
- end
24
34
  parser.on('-h', '--help', 'Show this help message') do
25
35
  puts parser
26
36
  puts "\nExamples:"
@@ -48,11 +58,6 @@ module CocoaPodsGraph
48
58
  end
49
59
 
50
60
  if options[:file] && !options[:file].empty?
51
- unless options[:show] || options[:json] || options[:html]
52
- puts 'You must select an output option (--show | --json | --html)'
53
- exit(1)
54
- end
55
-
56
61
  # Add .lock extension if not present
57
62
  options[:file] += '.lock' unless options[:file].include?('.lock')
58
63
 
@@ -61,24 +66,32 @@ module CocoaPodsGraph
61
66
  exit(1)
62
67
  end
63
68
 
64
- result = CocoaPodsGraph::Generator.parse_lock_file(options[:file])
69
+ result = CocoaPodsGraph::Generator.parse_lock_file(options[:file])
65
70
 
71
+ any_output = false
66
72
  if options[:show]
67
73
  puts 'Printing dependencies...'
68
74
  result.each(&:print_object)
75
+ any_output = true
69
76
  end
70
77
 
71
78
  if options[:json]
72
79
  puts 'Saving JSON file...'
73
80
  CocoaPodsGraph::Generator.save_json_file(result, options[:file])
81
+ any_output = true
74
82
  end
75
83
 
76
84
  if options[:html]
77
85
  puts 'Saving HTML file...'
78
86
  CocoaPodsGraph::Generator.save_html_wheel_file(result, options[:file])
87
+ any_output = true
79
88
  end
80
89
 
81
- puts 'Done!'
90
+ if any_output
91
+ else
92
+ puts 'You must select an output option (--show | --json | --html)'
93
+ exit(1)
94
+ end
82
95
  else
83
96
  puts 'Error: Please specify a Podfile.lock file with -f option'
84
97
  exit(1)
@@ -87,4 +100,4 @@ module CocoaPodsGraph
87
100
  end
88
101
  end
89
102
 
90
- CocoaPodsGraph::CLI.run if __FILE__ == $PROGRAM_NAME
103
+ CocoaPodsGraph::CLI.run
@@ -1,3 +1,3 @@
1
1
  module CocoaPodsGraph
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-graph
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erick Jung