js_dependency 0.3.10 → 0.3.11

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
  SHA256:
3
- metadata.gz: 153a609f4227a43182ed6e6a469bcfe466ffe130c5f6d8033771545ca13b4198
4
- data.tar.gz: 32cd8dd2ec33e8906b0bad39c8a4a6378e4909285486f52b6c93915891bed8bb
3
+ metadata.gz: a61cec11e64fc475a0fb7838b11abf8ab6a1a0d8cfab0929e475eff2fcbef6c0
4
+ data.tar.gz: 461e0b8503aec5ab25f7b3508ae420af41f72022e39a4e1388a8ae8217858ac1
5
5
  SHA512:
6
- metadata.gz: 63e3437906da40a60ed9e129dc8b2a3157221a61d34982bce433dfb8f8b3c7ee198cba9c85b6f230079db5a3a08fe9bb1c103d38763ce139a5aed81ecf5c9e10
7
- data.tar.gz: cf47aa344e700868b2dd76c67ad4323acc2a47e9f0e4d9736d0ae30a981715bb639c52b4d9322b243122879abaf892b314479d39a3c29e4dba56df848cfbe0a0
6
+ metadata.gz: c2e5483e130e608b4a21741ffccf44db1f812a6096b9f4c5df419cb97029f340c9c8ba770542133d528a213720f924282e9cd72bfd6cc135606904a594c20ed1
7
+ data.tar.gz: ae67a36c93fdb56ddc5a59c6244d78b7c58f08399d72a725a6d655e945f518c2a14f517c6253dde5cf26516c1cf30a5834ac77cc752e0a67a51301c13d2576e2
@@ -1,5 +1,8 @@
1
1
  src_path: ./src
2
2
  target_path: ./src/App.vue
3
+ target_paths:
4
+ - ./src/App1.vue
5
+ - ./src/App2.vue
3
6
  child_analyze_level: 2
4
7
  parent_analyze_level: 2
5
8
  name_level: 1
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-08-13 03:35:35 UTC using RuboCop version 1.34.1.
3
+ # on 2022-08-13 05:13:43 UTC using RuboCop version 1.34.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -9,12 +9,12 @@
9
9
  # Offense count: 3
10
10
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
11
11
  Metrics/AbcSize:
12
- Max: 33
12
+ Max: 29
13
13
 
14
14
  # Offense count: 3
15
15
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
16
16
  Metrics/CyclomaticComplexity:
17
- Max: 19
17
+ Max: 15
18
18
 
19
19
  # Offense count: 8
20
20
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
@@ -29,14 +29,14 @@ Metrics/ParameterLists:
29
29
  # Offense count: 3
30
30
  # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
31
31
  Metrics/PerceivedComplexity:
32
- Max: 20
32
+ Max: 15
33
33
 
34
34
  # Offense count: 1
35
35
  Style/MultilineBlockChain:
36
36
  Exclude:
37
37
  - 'lib/js_dependency/mermaid/root.rb'
38
38
 
39
- # Offense count: 9
39
+ # Offense count: 8
40
40
  # This cop supports safe autocorrection (--autocorrect).
41
41
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
42
42
  # URISchemes: http, https
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.11] - 2022-08-13
4
+
5
+ - Add target_paths options in configuration file to use array.
6
+
3
7
  ## [0.3.10] - 2022-08-13
4
8
 
5
9
  - Add file_config options to specify configuration yaml which user like.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- js_dependency (0.3.10)
4
+ js_dependency (0.3.11)
5
5
  pathname
6
6
  thor
7
7
  yaml
data/README.md CHANGED
@@ -35,6 +35,9 @@ Configuration file is `./.js_dependency.yml`. This file includes parameters for
35
35
  ```yaml
36
36
  src_path: ./src # Root folder
37
37
  target_path: ./src/App.vue # Target file tha you want to analyze
38
+ target_paths: # Target files tha you want to analyze
39
+ - ./src/App1.vue
40
+ - ./src/App2.vue
38
41
  child_analyze_level: 2 # Output level of child analyze
39
42
  parent_analyze_level: 2 # Output level of parent analyze
40
43
  name_level: 1 # Output name level
@@ -10,18 +10,82 @@ module JsDependency
10
10
  # @param [Hash] args
11
11
  def initialize(options, args)
12
12
  @src_path = options[:src_path] || args[:src_path]
13
- @target_paths = options[:target_paths] || (args[:target_path].is_a?(String) ? [args[:target_path]] : args[:target_path])
14
- @target_path = options[:target_path] || args[:target_path]
13
+ @target_paths = calc_target_paths(options[:target_path], options[:target_paths], args[:target_path],
14
+ args[:target_paths])
15
+ @target_path = calc_target_path(options[:target_path], options[:target_paths], args[:target_path],
16
+ args[:target_paths])
15
17
  @child_analyze_level = options[:child_analyze_level] || args[:child_analyze_level] || 2
16
18
  @parent_analyze_level = options[:parent_analyze_level] || args[:parent_analyze_level] || 2
17
19
  @output_path = options[:output_path] || args[:output_path] || nil
18
20
  @alias_paths = options[:alias_paths] || args[:alias_paths] || {}
19
21
  @name_level = options[:name_level] || args[:name_level] || 1
20
- @excludes = if options[:excludes]&.length&.positive?
21
- options[:excludes]
22
- elsif args[:excludes]
23
- args[:excludes]
24
- end
22
+ @excludes = calc_excludes(options[:excludes], args[:excludes])
23
+ end
24
+
25
+ private
26
+
27
+ # @param [String, Array, nil] option_target_path
28
+ # @param [String, Array, nil] option_target_paths
29
+ # @param [String, Array, nil] args_target_path
30
+ # @param [String, Array, nil] args_target_paths
31
+ # @return [nil, Array]
32
+ def calc_target_paths(option_target_path, option_target_paths, args_target_path, args_target_paths)
33
+ [option_target_paths, option_target_path, args_target_paths, args_target_path].each do |obj|
34
+ return as_array(obj) if present?(obj)
35
+ end
36
+
37
+ nil
38
+ end
39
+
40
+ # @param [String, Array, nil] option_target_path
41
+ # @param [String, Array, nil] option_target_paths
42
+ # @param [String, Array, nil] args_target_path
43
+ # @param [String, Array, nil] args_target_paths
44
+ # @return [nil, String]
45
+ def calc_target_path(option_target_path, option_target_paths, args_target_path, args_target_paths)
46
+ [option_target_path, option_target_paths, args_target_path, args_target_paths].each do |obj|
47
+ return as_string_or_first(obj) if present?(obj)
48
+ end
49
+
50
+ nil
51
+ end
52
+
53
+ # @param [Object] option_excludes
54
+ # @param [Object] args_excludes
55
+ # @return [nil, Array]
56
+ def calc_excludes(option_excludes, args_excludes)
57
+ [option_excludes, args_excludes].each do |obj|
58
+ return as_array(obj) if present?(obj)
59
+ end
60
+
61
+ nil
62
+ end
63
+
64
+ # @param [Array, String, nil] obj
65
+ # @return [TrueClass, FalseClass]
66
+ def present?(obj)
67
+ return false if obj.nil?
68
+ return false if obj.empty?
69
+
70
+ true
71
+ end
72
+
73
+ # @param [Array, String, nil] obj
74
+ # @return [Array, nil]
75
+ def as_array(obj)
76
+ return nil if obj.nil?
77
+ return obj if obj.is_a?(Array)
78
+
79
+ [obj]
80
+ end
81
+
82
+ # @param [Array, String, nil] obj
83
+ # @return [String, nil]
84
+ def as_string_or_first(obj)
85
+ return nil if obj.nil?
86
+ return obj if obj.is_a?(String)
87
+
88
+ return obj.first if obj.is_a?(Array)
25
89
  end
26
90
  end
27
91
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsDependency
4
- VERSION = "0.3.10"
4
+ VERSION = "0.3.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js_dependency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - junara