dev_suite 0.2.3 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +37 -0
  3. data/Gemfile +13 -6
  4. data/Gemfile.lock +9 -1
  5. data/README.md +66 -2
  6. data/dev_suite.gemspec +1 -0
  7. data/lib/dev_suite/cli/commands/base.rb +0 -30
  8. data/lib/dev_suite/cli/commands/tree.rb +29 -8
  9. data/lib/dev_suite/cli/commands/version.rb +1 -1
  10. data/lib/dev_suite/cli/main.rb +12 -9
  11. data/lib/dev_suite/dev_suite.rb +12 -0
  12. data/lib/dev_suite/directory_tree/config/config.rb +11 -0
  13. data/lib/dev_suite/directory_tree/config/configuration.rb +21 -0
  14. data/lib/dev_suite/directory_tree/config.rb +2 -11
  15. data/lib/dev_suite/directory_tree/directory_tree.rb +20 -0
  16. data/lib/dev_suite/directory_tree/renderer/base.rb +0 -6
  17. data/lib/dev_suite/directory_tree/renderer/simple.rb +3 -3
  18. data/lib/dev_suite/directory_tree/visualizer/base.rb +13 -0
  19. data/lib/dev_suite/directory_tree/visualizer/tree.rb +50 -0
  20. data/lib/dev_suite/directory_tree/visualizer.rb +14 -13
  21. data/lib/dev_suite/directory_tree.rb +1 -8
  22. data/lib/dev_suite/performance/analyzer.rb +1 -1
  23. data/lib/dev_suite/performance/config/config.rb +11 -0
  24. data/lib/dev_suite/performance/config/configuration.rb +30 -0
  25. data/lib/dev_suite/performance/config.rb +2 -10
  26. data/lib/dev_suite/performance/{reportor → reporter}/base.rb +1 -1
  27. data/lib/dev_suite/performance/{reportor → reporter}/helpers/stat_mappings.rb +1 -1
  28. data/lib/dev_suite/performance/{reportor → reporter}/helpers/table_builder.rb +1 -1
  29. data/lib/dev_suite/performance/{reportor → reporter}/helpers.rb +1 -1
  30. data/lib/dev_suite/performance/{reportor → reporter}/simple.rb +1 -1
  31. data/lib/dev_suite/performance/reporter.rb +22 -0
  32. data/lib/dev_suite/performance.rb +1 -1
  33. data/lib/dev_suite/request_logger/adapter/adapter.rb +27 -0
  34. data/lib/dev_suite/request_logger/adapter/base.rb +17 -0
  35. data/lib/dev_suite/request_logger/adapter/net_http.rb +42 -0
  36. data/lib/dev_suite/request_logger/adapter.rb +9 -0
  37. data/lib/dev_suite/request_logger/config/config.rb +11 -0
  38. data/lib/dev_suite/request_logger/config/configuration.rb +24 -0
  39. data/lib/dev_suite/request_logger/config.rb +9 -0
  40. data/lib/dev_suite/request_logger/logger.rb +93 -0
  41. data/lib/dev_suite/request_logger/request_logger.rb +29 -0
  42. data/lib/dev_suite/request_logger.rb +7 -0
  43. data/lib/dev_suite/utils/color/color.rb +12 -0
  44. data/lib/dev_suite/utils/color/config/config.rb +13 -0
  45. data/lib/dev_suite/utils/color/config/configuration.rb +31 -0
  46. data/lib/dev_suite/utils/color/config.rb +2 -31
  47. data/lib/dev_suite/utils/color/strategy/theme.rb +6 -7
  48. data/lib/dev_suite/utils/color/strategy.rb +2 -4
  49. data/lib/dev_suite/utils/color.rb +1 -4
  50. data/lib/dev_suite/utils/construct/config/attribute/attribute.rb +15 -0
  51. data/lib/dev_suite/utils/construct/config/attribute/manager.rb +63 -0
  52. data/lib/dev_suite/utils/construct/config/attribute/resolver.rb +31 -0
  53. data/lib/dev_suite/utils/construct/config/attribute/validator.rb +55 -0
  54. data/lib/dev_suite/utils/construct/config/attribute.rb +13 -0
  55. data/lib/dev_suite/utils/construct/config/base.rb +20 -0
  56. data/lib/dev_suite/utils/construct/config/config.rb +24 -0
  57. data/lib/dev_suite/utils/construct/config/configuration.rb +13 -0
  58. data/lib/dev_suite/utils/construct/config/hook/hook.rb +13 -0
  59. data/lib/dev_suite/utils/construct/config/hook/manager.rb +36 -0
  60. data/lib/dev_suite/utils/construct/config/hook.rb +13 -0
  61. data/lib/dev_suite/utils/construct/config/initializer.rb +21 -0
  62. data/lib/dev_suite/utils/construct/config/manager.rb +33 -0
  63. data/lib/dev_suite/utils/construct/config/settings/base.rb +59 -0
  64. data/lib/dev_suite/utils/construct/config/settings/manager.rb +38 -0
  65. data/lib/dev_suite/utils/construct/config/settings/settings.rb +14 -0
  66. data/lib/dev_suite/utils/construct/config/settings.rb +13 -0
  67. data/lib/dev_suite/utils/construct/config.rb +11 -0
  68. data/lib/dev_suite/utils/construct/construct.rb +9 -0
  69. data/lib/dev_suite/utils/construct.rb +16 -0
  70. data/lib/dev_suite/utils/emoji.rb +71 -0
  71. data/lib/dev_suite/utils/error_handler.rb +24 -0
  72. data/lib/dev_suite/utils/file_loader/config/config.rb +13 -0
  73. data/lib/dev_suite/utils/file_loader/config/configuration.rb +33 -0
  74. data/lib/dev_suite/utils/file_loader/config.rb +11 -0
  75. data/lib/dev_suite/utils/file_loader/file_loader.rb +23 -0
  76. data/lib/dev_suite/utils/file_loader/loader/base.rb +21 -0
  77. data/lib/dev_suite/utils/file_loader/loader/json.rb +21 -0
  78. data/lib/dev_suite/utils/file_loader/loader/text.rb +21 -0
  79. data/lib/dev_suite/utils/file_loader/loader/yaml.rb +38 -0
  80. data/lib/dev_suite/utils/file_loader/loader.rb +41 -0
  81. data/lib/dev_suite/utils/file_loader/loader_manager.rb +34 -0
  82. data/lib/dev_suite/utils/file_loader/loader_registry.rb +36 -0
  83. data/lib/dev_suite/utils/file_loader.rb +9 -0
  84. data/lib/dev_suite/utils/logger.rb +58 -0
  85. data/lib/dev_suite/utils/path_matcher/matcher.rb +31 -0
  86. data/lib/dev_suite/utils/path_matcher/path_matcher.rb +17 -0
  87. data/lib/dev_suite/utils/path_matcher/pattern.rb +35 -0
  88. data/lib/dev_suite/utils/path_matcher.rb +9 -0
  89. data/lib/dev_suite/utils/table/config/config.rb +13 -0
  90. data/lib/dev_suite/utils/table/config/configuration.rb +32 -0
  91. data/lib/dev_suite/utils/table/config.rb +2 -23
  92. data/lib/dev_suite/utils/table/renderer/base.rb +0 -6
  93. data/lib/dev_suite/utils/table/renderer/simple.rb +9 -5
  94. data/lib/dev_suite/utils/table/renderer.rb +2 -2
  95. data/lib/dev_suite/utils/table/table.rb +6 -0
  96. data/lib/dev_suite/utils/table.rb +0 -6
  97. data/lib/dev_suite/utils/utils.rb +14 -0
  98. data/lib/dev_suite/utils.rb +1 -3
  99. data/lib/dev_suite/version.rb +1 -1
  100. data/lib/dev_suite.rb +1 -8
  101. metadata +72 -13
  102. data/lib/dev_suite/directory_tree/settings.rb +0 -29
  103. data/lib/dev_suite/performance/reportor.rb +0 -22
  104. data/lib/dev_suite/utils/config_tools/configuration.rb +0 -41
  105. data/lib/dev_suite/utils/config_tools/settings.rb +0 -75
  106. data/lib/dev_suite/utils/config_tools.rb +0 -10
  107. data/lib/dev_suite/utils/table/settings.rb +0 -34
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module DirectoryTree
5
- class Settings
6
- include Utils::ConfigTools::Settings
7
-
8
- def default_settings
9
- {
10
- skip_hidden: false,
11
- skip_types: [],
12
- max_depth: nil,
13
- }
14
- end
15
-
16
- def skip_hidden?
17
- get(:skip_hidden)
18
- end
19
-
20
- def skip_types
21
- get(:skip_types)
22
- end
23
-
24
- def max_depth
25
- get(:max_depth)
26
- end
27
- end
28
- end
29
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module Performance
5
- module Reportor
6
- require_relative "reportor/base"
7
- require_relative "reportor/simple"
8
- require_relative "reportor/helpers"
9
-
10
- class << self
11
- def create(reportor)
12
- case reportor
13
- when :simple
14
- Simple.new
15
- else
16
- raise ArgumentError, "Invalid reportor: #{reportor}"
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module Utils
5
- module ConfigTools
6
- module Configuration
7
- # Module for global configuration
8
- class << self
9
- def included(base)
10
- base.extend(ClassMethods)
11
- end
12
- end
13
-
14
- module ClassMethods
15
- #
16
- # Provide global access to a single instance of Config
17
- #
18
- def configuration
19
- @configuration ||= new
20
- end
21
-
22
- #
23
- # Allow block-based configuration
24
- #
25
- def configure
26
- yield(configuration)
27
- rescue StandardError => e
28
- handle_configuration_error(e)
29
- raise
30
- end
31
-
32
- private
33
-
34
- def handle_configuration_error(error)
35
- puts "Configuration error: #{error.message}"
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module Utils
5
- module ConfigTools
6
- # Module for managing instance settings
7
- module Settings
8
- class << self
9
- def included(base)
10
- base.include(InstanceMethods)
11
- end
12
- end
13
-
14
- module InstanceMethods
15
- def initialize(settings = {})
16
- @settings = merge_settings(default_settings, settings)
17
- end
18
-
19
- def set(*keys, value)
20
- key_path = normalize_keys(keys)
21
- last_key = key_path.pop
22
- target = key_path.each_with_object(@settings) do |key, nested|
23
- nested[key] ||= {}
24
- end
25
- target[last_key] = value
26
- end
27
-
28
- def get(*keys)
29
- key_path = normalize_keys(keys)
30
- key_path.reduce(@settings) do |nested, key|
31
- nested.is_a?(Hash) ? nested[key] : nil
32
- end
33
- end
34
-
35
- def apply
36
- #
37
- # Implement logic to apply settings in the including class
38
- # TODO: need to review this method
39
- #
40
- raise NotImplementedError, "#{self.class} must implement the #apply method"
41
- end
42
-
43
- def reset!
44
- @settings = default_settings
45
- end
46
-
47
- def default_settings
48
- raise NotImplementedError, "#{self.class} must implement the #default_settings method"
49
- end
50
-
51
- private
52
-
53
- def normalize_keys(keys)
54
- key_path = keys.flatten
55
- if key_path.size == 1 && key_path.first.is_a?(String)
56
- key_path.first.to_s.split(".").map(&:to_sym)
57
- else
58
- key_path.map(&:to_sym)
59
- end
60
- end
61
-
62
- def merge_settings(defaults, overrides)
63
- defaults.merge(overrides) do |_key, oldval, newval|
64
- if oldval.is_a?(Hash) && newval.is_a?(Hash)
65
- merge_settings(oldval, newval)
66
- else
67
- newval
68
- end
69
- end
70
- end
71
- end
72
- end
73
- end
74
- end
75
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module Utils
5
- module ConfigTools
6
- require_relative "config_tools/configuration"
7
- require_relative "config_tools/settings"
8
- end
9
- end
10
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module Utils
5
- module Table
6
- class Settings
7
- include ConfigTools::Settings
8
-
9
- def default_settings
10
- {
11
- colors: {
12
- title: :cyan,
13
- column: :yellow,
14
- row: :default,
15
- border: :blue,
16
- },
17
- alignments: {
18
- column: :left,
19
- row: :left,
20
- },
21
- }
22
- end
23
-
24
- def color_for(key)
25
- get(:colors, key)
26
- end
27
-
28
- def alignment_for(key)
29
- get(:alignments, key)
30
- end
31
- end
32
- end
33
- end
34
- end