dev_suite 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +53 -0
  5. data/dev_suite.gemspec +0 -4
  6. data/lib/dev_suite/cli/commands/base.rb +0 -2
  7. data/lib/dev_suite/cli/commands/tree.rb +3 -3
  8. data/lib/dev_suite/cli/commands/version.rb +1 -1
  9. data/lib/dev_suite/cli/main.rb +1 -1
  10. data/lib/dev_suite/dev_suite.rb +12 -0
  11. data/lib/dev_suite/directory_tree/config/config.rb +11 -0
  12. data/lib/dev_suite/directory_tree/config/configuration.rb +21 -0
  13. data/lib/dev_suite/directory_tree/config.rb +2 -36
  14. data/lib/dev_suite/directory_tree/directory_tree.rb +0 -1
  15. data/lib/dev_suite/directory_tree/renderer/base.rb +0 -6
  16. data/lib/dev_suite/performance/analyzer.rb +1 -1
  17. data/lib/dev_suite/performance/config/config.rb +11 -0
  18. data/lib/dev_suite/performance/config/configuration.rb +30 -0
  19. data/lib/dev_suite/performance/config.rb +2 -30
  20. data/lib/dev_suite/performance/{reportor → reporter}/base.rb +1 -1
  21. data/lib/dev_suite/performance/{reportor → reporter}/helpers/stat_mappings.rb +1 -1
  22. data/lib/dev_suite/performance/{reportor → reporter}/helpers/table_builder.rb +1 -1
  23. data/lib/dev_suite/performance/{reportor → reporter}/helpers.rb +1 -1
  24. data/lib/dev_suite/performance/{reportor → reporter}/simple.rb +1 -1
  25. data/lib/dev_suite/performance/reporter.rb +22 -0
  26. data/lib/dev_suite/performance.rb +1 -1
  27. data/lib/dev_suite/request_logger/adapter/adapter.rb +27 -0
  28. data/lib/dev_suite/request_logger/adapter/base.rb +17 -0
  29. data/lib/dev_suite/request_logger/adapter/net_http.rb +42 -0
  30. data/lib/dev_suite/request_logger/adapter.rb +9 -0
  31. data/lib/dev_suite/request_logger/config/config.rb +11 -0
  32. data/lib/dev_suite/request_logger/config/configuration.rb +24 -0
  33. data/lib/dev_suite/request_logger/config.rb +9 -0
  34. data/lib/dev_suite/request_logger/logger.rb +93 -0
  35. data/lib/dev_suite/request_logger/request_logger.rb +29 -0
  36. data/lib/dev_suite/request_logger.rb +7 -0
  37. data/lib/dev_suite/utils/color/color.rb +12 -0
  38. data/lib/dev_suite/utils/color/config/config.rb +13 -0
  39. data/lib/dev_suite/utils/color/config/configuration.rb +31 -0
  40. data/lib/dev_suite/utils/color/config.rb +2 -31
  41. data/lib/dev_suite/utils/color/strategy/theme.rb +6 -7
  42. data/lib/dev_suite/utils/color/strategy.rb +2 -4
  43. data/lib/dev_suite/utils/color.rb +1 -4
  44. data/lib/dev_suite/utils/construct/config/attribute/attribute.rb +15 -0
  45. data/lib/dev_suite/utils/construct/config/attribute/manager.rb +63 -0
  46. data/lib/dev_suite/utils/construct/config/attribute/resolver.rb +31 -0
  47. data/lib/dev_suite/utils/construct/config/attribute/validator.rb +55 -0
  48. data/lib/dev_suite/utils/construct/config/attribute.rb +13 -0
  49. data/lib/dev_suite/utils/construct/config/base.rb +20 -0
  50. data/lib/dev_suite/utils/construct/config/config.rb +24 -0
  51. data/lib/dev_suite/utils/construct/config/configuration.rb +13 -0
  52. data/lib/dev_suite/utils/construct/config/hook/hook.rb +13 -0
  53. data/lib/dev_suite/utils/construct/config/hook/manager.rb +36 -0
  54. data/lib/dev_suite/utils/construct/config/hook.rb +13 -0
  55. data/lib/dev_suite/utils/construct/config/initializer.rb +21 -0
  56. data/lib/dev_suite/utils/construct/config/manager.rb +33 -0
  57. data/lib/dev_suite/utils/construct/config/settings/base.rb +59 -0
  58. data/lib/dev_suite/utils/construct/config/settings/manager.rb +38 -0
  59. data/lib/dev_suite/utils/construct/config/settings/settings.rb +14 -0
  60. data/lib/dev_suite/utils/construct/config/settings.rb +13 -0
  61. data/lib/dev_suite/utils/construct/config.rb +11 -0
  62. data/lib/dev_suite/utils/construct/construct.rb +9 -0
  63. data/lib/dev_suite/utils/construct.rb +16 -0
  64. data/lib/dev_suite/utils/emoji.rb +71 -0
  65. data/lib/dev_suite/utils/error_handler.rb +24 -0
  66. data/lib/dev_suite/utils/file_loader/config/config.rb +13 -0
  67. data/lib/dev_suite/utils/file_loader/config/configuration.rb +33 -0
  68. data/lib/dev_suite/utils/file_loader/config.rb +11 -0
  69. data/lib/dev_suite/utils/file_loader/file_loader.rb +23 -0
  70. data/lib/dev_suite/utils/file_loader/loader/base.rb +21 -0
  71. data/lib/dev_suite/utils/file_loader/loader/json.rb +21 -0
  72. data/lib/dev_suite/utils/file_loader/loader/text.rb +21 -0
  73. data/lib/dev_suite/utils/file_loader/loader/yaml.rb +38 -0
  74. data/lib/dev_suite/utils/file_loader/loader.rb +41 -0
  75. data/lib/dev_suite/utils/file_loader/loader_manager.rb +34 -0
  76. data/lib/dev_suite/utils/file_loader/loader_registry.rb +36 -0
  77. data/lib/dev_suite/utils/file_loader.rb +9 -0
  78. data/lib/dev_suite/utils/logger.rb +58 -0
  79. data/lib/dev_suite/utils/path_matcher/matcher.rb +31 -0
  80. data/lib/dev_suite/utils/path_matcher/path_matcher.rb +17 -0
  81. data/lib/dev_suite/utils/path_matcher/pattern.rb +35 -0
  82. data/lib/dev_suite/utils/path_matcher.rb +9 -0
  83. data/lib/dev_suite/utils/table/config/config.rb +13 -0
  84. data/lib/dev_suite/utils/table/config/configuration.rb +32 -0
  85. data/lib/dev_suite/utils/table/config.rb +2 -23
  86. data/lib/dev_suite/utils/table/renderer/base.rb +0 -6
  87. data/lib/dev_suite/utils/table/renderer/simple.rb +9 -5
  88. data/lib/dev_suite/utils/table/renderer.rb +2 -2
  89. data/lib/dev_suite/utils/table/table.rb +6 -0
  90. data/lib/dev_suite/utils/table.rb +0 -6
  91. data/lib/dev_suite/utils/utils.rb +14 -0
  92. data/lib/dev_suite/utils.rb +1 -3
  93. data/lib/dev_suite/version.rb +1 -1
  94. data/lib/dev_suite.rb +1 -10
  95. metadata +68 -44
  96. data/lib/dev_suite/directory_tree/settings.rb +0 -18
  97. data/lib/dev_suite/emoji.rb +0 -33
  98. data/lib/dev_suite/error_handler.rb +0 -22
  99. data/lib/dev_suite/logger.rb +0 -56
  100. data/lib/dev_suite/performance/reportor.rb +0 -22
  101. data/lib/dev_suite/utils/config_tools/configuration.rb +0 -134
  102. data/lib/dev_suite/utils/config_tools/settings.rb +0 -67
  103. data/lib/dev_suite/utils/config_tools.rb +0 -10
  104. data/lib/dev_suite/utils/table/settings.rb +0 -34
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module PathMatcher
6
+ class Pattern
7
+ def initialize(pattern)
8
+ @regex = convert_to_regex(pattern)
9
+ end
10
+
11
+ def match?(path)
12
+ !!(@regex =~ path)
13
+ end
14
+
15
+ private
16
+
17
+ def convert_to_regex(pattern)
18
+ # Escape all regex special characters except '*'
19
+ pattern = Regexp.escape(pattern).gsub('\*', "*")
20
+
21
+ # Convert glob patterns to regex:
22
+ # - '**/' matches any directory level
23
+ # - '*.txt' matches any .txt file in any directory
24
+ pattern = pattern.gsub("**", ".*") # ** -> .*
25
+ pattern = pattern.gsub("*", "[^/]*") # * -> [^/]*
26
+
27
+ # Allow '*.txt' to match any .txt file in any directory by prefixing with '.*'
28
+ pattern = ".*#{pattern}" unless pattern.start_with?(".*")
29
+
30
+ Regexp.new("^#{pattern}$")
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module PathMatcher
6
+ require_relative "path_matcher/path_matcher"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Table
6
+ module Config
7
+ include Construct::Config
8
+
9
+ require_relative "configuration"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Table
6
+ module Config
7
+ class Configuration < BaseConfiguration
8
+ set_default_settings(
9
+ colors: {
10
+ title: :cyan,
11
+ column: :yellow,
12
+ row: :default,
13
+ border: :blue,
14
+ },
15
+ # alignments: {
16
+ # column: :left,
17
+ # row: :left,
18
+ # },
19
+ )
20
+
21
+ config_attr :renderer, default_value: :simple, type: :symbol, resolver: :resolve_renderer
22
+
23
+ private
24
+
25
+ def resolve_renderer(value)
26
+ Renderer.create(value)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -3,29 +3,8 @@
3
3
  module DevSuite
4
4
  module Utils
5
5
  module Table
6
- class Config
7
- include ConfigTools::Configuration
8
-
9
- DEFAULT_SETTING = {
10
- colors: {
11
- title: :cyan,
12
- column: :yellow,
13
- row: :default,
14
- border: :blue,
15
- },
16
- alignments: {
17
- column: :left,
18
- row: :left,
19
- },
20
- }.freeze
21
-
22
- attr_reader :settings, :renderer
23
-
24
- def initialize(settings: {}, renderer: :simple)
25
- @settings = Settings.new(settings)
26
- @renderer = Renderer.create(renderer, settings: @settings)
27
- freeze
28
- end
6
+ module Config
7
+ require_relative "config/config"
29
8
  end
30
9
  end
31
10
  end
@@ -5,12 +5,6 @@ module DevSuite
5
5
  module Table
6
6
  module Renderer
7
7
  class Base
8
- attr_reader :settings
9
-
10
- def initialize(settings: Settings.new)
11
- @settings = settings
12
- end
13
-
14
8
  def render(table)
15
9
  raise NotImplementedError, "Render method must be implemented in subclasses"
16
10
  end
@@ -19,6 +19,10 @@ module DevSuite
19
19
 
20
20
  private
21
21
 
22
+ def settings
23
+ Config.configuration.settings
24
+ end
25
+
22
26
  #
23
27
  # Calculates the widths of the columns
24
28
  #
@@ -45,7 +49,7 @@ module DevSuite
45
49
 
46
50
  total_width = column_widths.sum + column_widths.size * 3 - 1
47
51
  title_str = "| #{table.title.center(total_width - 2)} |"
48
- colorize(title_str, settings.color_for(:title))
52
+ colorize(title_str, settings.get("colors.title"))
49
53
  end
50
54
 
51
55
  def render_header(table, column_widths)
@@ -55,13 +59,13 @@ module DevSuite
55
59
  text_align(column.name, column_widths[index])
56
60
  end
57
61
  header_str = "| #{header.join(" | ")} |"
58
- colorize(header_str, settings.color_for(:column))
62
+ colorize(header_str, settings.get("colors.column"))
59
63
  end
60
64
 
61
65
  def render_separator(column_widths)
62
66
  separator = column_widths.map { |width| "-" * width }.join("-+-")
63
67
  separator_str = "+-#{separator}-+"
64
- colorize(separator_str, settings.color_for(:border))
68
+ colorize(separator_str, settings.get("colors.border"))
65
69
  end
66
70
 
67
71
  def render_rows(table, column_widths)
@@ -69,7 +73,7 @@ module DevSuite
69
73
  render_row(row, column_widths)
70
74
  end
71
75
  cells_str = cells.join("\n")
72
- colorize(cells_str, settings.color_for(:row))
76
+ colorize(cells_str, settings.get("colors.row"))
73
77
  end
74
78
 
75
79
  def render_row(row, column_widths)
@@ -77,7 +81,7 @@ module DevSuite
77
81
  text_align(cell.to_s, column_widths[index])
78
82
  end
79
83
  cell_str = "| #{cell.join(" | ")} |"
80
- colorize(cell_str, settings.color_for(:row))
84
+ colorize(cell_str, settings.get("colors.row"))
81
85
  end
82
86
  end
83
87
  end
@@ -8,10 +8,10 @@ module DevSuite
8
8
  require_relative "renderer/simple"
9
9
 
10
10
  class << self
11
- def create(type, settings: Settings.new)
11
+ def create(type)
12
12
  case type
13
13
  when :simple
14
- Simple.new(settings: settings)
14
+ Simple.new
15
15
  else
16
16
  raise ArgumentError, "Unknown renderer type: #{type}"
17
17
  end
@@ -3,6 +3,12 @@
3
3
  module DevSuite
4
4
  module Utils
5
5
  module Table
6
+ require_relative "column"
7
+ require_relative "row"
8
+ require_relative "config"
9
+ require_relative "formatter"
10
+ require_relative "renderer"
11
+
6
12
  class Table
7
13
  attr_accessor :title
8
14
  attr_reader :columns, :rows
@@ -4,12 +4,6 @@ module DevSuite
4
4
  module Utils
5
5
  module Table
6
6
  require_relative "table/table"
7
- require_relative "table/column"
8
- require_relative "table/row"
9
- require_relative "table/config"
10
- require_relative "table/settings"
11
- require_relative "table/formatter"
12
- require_relative "table/renderer"
13
7
  end
14
8
  end
15
9
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ require_relative "emoji"
6
+ require_relative "logger"
7
+ require_relative "error_handler"
8
+ require_relative "construct"
9
+ require_relative "color"
10
+ require_relative "table"
11
+ require_relative "file_loader"
12
+ require_relative "path_matcher"
13
+ end
14
+ end
@@ -2,8 +2,6 @@
2
2
 
3
3
  module DevSuite
4
4
  module Utils
5
- require_relative "utils/config_tools"
6
- require_relative "utils/color"
7
- require_relative "utils/table"
5
+ require_relative "utils/utils"
8
6
  end
9
7
  end
@@ -1,3 +1,3 @@
1
1
  module DevSuite
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
data/lib/dev_suite.rb CHANGED
@@ -1,14 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DevSuite
4
- require_relative "dev_suite/version"
5
- require_relative "dev_suite/emoji"
6
- require_relative "dev_suite/logger"
7
- require_relative "dev_suite/error_handler"
8
- require_relative "dev_suite/utils"
9
- require_relative "dev_suite/cli"
10
- require_relative "dev_suite/performance"
11
- require_relative "dev_suite/directory_tree"
12
-
13
- class Error < StandardError; end
4
+ require_relative "dev_suite/dev_suite"
14
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_suite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huy Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-15 00:00:00.000000000 Z
11
+ date: 2024-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark
@@ -52,34 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.1'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.9'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.9'
69
- - !ruby/object:Gem::Dependency
70
- name: simplecov
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.21'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '0.21'
83
55
  description: This gem provides a suite of utilities for developers to enhance their
84
56
  productivity.
85
57
  email:
@@ -112,10 +84,13 @@ files:
112
84
  - lib/dev_suite/cli/commands/tree.rb
113
85
  - lib/dev_suite/cli/commands/version.rb
114
86
  - lib/dev_suite/cli/main.rb
87
+ - lib/dev_suite/dev_suite.rb
115
88
  - lib/dev_suite/directory_tree.rb
116
89
  - lib/dev_suite/directory_tree/builder.rb
117
90
  - lib/dev_suite/directory_tree/builder/base.rb
118
91
  - lib/dev_suite/directory_tree/config.rb
92
+ - lib/dev_suite/directory_tree/config/config.rb
93
+ - lib/dev_suite/directory_tree/config/configuration.rb
119
94
  - lib/dev_suite/directory_tree/directory_tree.rb
120
95
  - lib/dev_suite/directory_tree/node.rb
121
96
  - lib/dev_suite/directory_tree/node/base.rb
@@ -125,16 +100,14 @@ files:
125
100
  - lib/dev_suite/directory_tree/renderer.rb
126
101
  - lib/dev_suite/directory_tree/renderer/base.rb
127
102
  - lib/dev_suite/directory_tree/renderer/simple.rb
128
- - lib/dev_suite/directory_tree/settings.rb
129
103
  - lib/dev_suite/directory_tree/visualizer.rb
130
104
  - lib/dev_suite/directory_tree/visualizer/base.rb
131
105
  - lib/dev_suite/directory_tree/visualizer/tree.rb
132
- - lib/dev_suite/emoji.rb
133
- - lib/dev_suite/error_handler.rb
134
- - lib/dev_suite/logger.rb
135
106
  - lib/dev_suite/performance.rb
136
107
  - lib/dev_suite/performance/analyzer.rb
137
108
  - lib/dev_suite/performance/config.rb
109
+ - lib/dev_suite/performance/config/config.rb
110
+ - lib/dev_suite/performance/config/configuration.rb
138
111
  - lib/dev_suite/performance/data.rb
139
112
  - lib/dev_suite/performance/data/memory_usage.rb
140
113
  - lib/dev_suite/performance/profiler.rb
@@ -142,16 +115,29 @@ files:
142
115
  - lib/dev_suite/performance/profiler/execution_time.rb
143
116
  - lib/dev_suite/performance/profiler/memory.rb
144
117
  - lib/dev_suite/performance/profiler_manager.rb
145
- - lib/dev_suite/performance/reportor.rb
146
- - lib/dev_suite/performance/reportor/base.rb
147
- - lib/dev_suite/performance/reportor/helpers.rb
148
- - lib/dev_suite/performance/reportor/helpers/stat_mappings.rb
149
- - lib/dev_suite/performance/reportor/helpers/table_builder.rb
150
- - lib/dev_suite/performance/reportor/simple.rb
118
+ - lib/dev_suite/performance/reporter.rb
119
+ - lib/dev_suite/performance/reporter/base.rb
120
+ - lib/dev_suite/performance/reporter/helpers.rb
121
+ - lib/dev_suite/performance/reporter/helpers/stat_mappings.rb
122
+ - lib/dev_suite/performance/reporter/helpers/table_builder.rb
123
+ - lib/dev_suite/performance/reporter/simple.rb
124
+ - lib/dev_suite/request_logger.rb
125
+ - lib/dev_suite/request_logger/adapter.rb
126
+ - lib/dev_suite/request_logger/adapter/adapter.rb
127
+ - lib/dev_suite/request_logger/adapter/base.rb
128
+ - lib/dev_suite/request_logger/adapter/net_http.rb
129
+ - lib/dev_suite/request_logger/config.rb
130
+ - lib/dev_suite/request_logger/config/config.rb
131
+ - lib/dev_suite/request_logger/config/configuration.rb
132
+ - lib/dev_suite/request_logger/logger.rb
133
+ - lib/dev_suite/request_logger/request_logger.rb
151
134
  - lib/dev_suite/utils.rb
152
135
  - lib/dev_suite/utils/color.rb
136
+ - lib/dev_suite/utils/color/color.rb
153
137
  - lib/dev_suite/utils/color/colorizer.rb
154
138
  - lib/dev_suite/utils/color/config.rb
139
+ - lib/dev_suite/utils/color/config/config.rb
140
+ - lib/dev_suite/utils/color/config/configuration.rb
155
141
  - lib/dev_suite/utils/color/palette.rb
156
142
  - lib/dev_suite/utils/color/palette/base.rb
157
143
  - lib/dev_suite/utils/color/palette/default.rb
@@ -160,12 +146,50 @@ files:
160
146
  - lib/dev_suite/utils/color/strategy/basic.rb
161
147
  - lib/dev_suite/utils/color/strategy/rgb.rb
162
148
  - lib/dev_suite/utils/color/strategy/theme.rb
163
- - lib/dev_suite/utils/config_tools.rb
164
- - lib/dev_suite/utils/config_tools/configuration.rb
165
- - lib/dev_suite/utils/config_tools/settings.rb
149
+ - lib/dev_suite/utils/construct.rb
150
+ - lib/dev_suite/utils/construct/config.rb
151
+ - lib/dev_suite/utils/construct/config/attribute.rb
152
+ - lib/dev_suite/utils/construct/config/attribute/attribute.rb
153
+ - lib/dev_suite/utils/construct/config/attribute/manager.rb
154
+ - lib/dev_suite/utils/construct/config/attribute/resolver.rb
155
+ - lib/dev_suite/utils/construct/config/attribute/validator.rb
156
+ - lib/dev_suite/utils/construct/config/base.rb
157
+ - lib/dev_suite/utils/construct/config/config.rb
158
+ - lib/dev_suite/utils/construct/config/configuration.rb
159
+ - lib/dev_suite/utils/construct/config/hook.rb
160
+ - lib/dev_suite/utils/construct/config/hook/hook.rb
161
+ - lib/dev_suite/utils/construct/config/hook/manager.rb
162
+ - lib/dev_suite/utils/construct/config/initializer.rb
163
+ - lib/dev_suite/utils/construct/config/manager.rb
164
+ - lib/dev_suite/utils/construct/config/settings.rb
165
+ - lib/dev_suite/utils/construct/config/settings/base.rb
166
+ - lib/dev_suite/utils/construct/config/settings/manager.rb
167
+ - lib/dev_suite/utils/construct/config/settings/settings.rb
168
+ - lib/dev_suite/utils/construct/construct.rb
169
+ - lib/dev_suite/utils/emoji.rb
170
+ - lib/dev_suite/utils/error_handler.rb
171
+ - lib/dev_suite/utils/file_loader.rb
172
+ - lib/dev_suite/utils/file_loader/config.rb
173
+ - lib/dev_suite/utils/file_loader/config/config.rb
174
+ - lib/dev_suite/utils/file_loader/config/configuration.rb
175
+ - lib/dev_suite/utils/file_loader/file_loader.rb
176
+ - lib/dev_suite/utils/file_loader/loader.rb
177
+ - lib/dev_suite/utils/file_loader/loader/base.rb
178
+ - lib/dev_suite/utils/file_loader/loader/json.rb
179
+ - lib/dev_suite/utils/file_loader/loader/text.rb
180
+ - lib/dev_suite/utils/file_loader/loader/yaml.rb
181
+ - lib/dev_suite/utils/file_loader/loader_manager.rb
182
+ - lib/dev_suite/utils/file_loader/loader_registry.rb
183
+ - lib/dev_suite/utils/logger.rb
184
+ - lib/dev_suite/utils/path_matcher.rb
185
+ - lib/dev_suite/utils/path_matcher/matcher.rb
186
+ - lib/dev_suite/utils/path_matcher/path_matcher.rb
187
+ - lib/dev_suite/utils/path_matcher/pattern.rb
166
188
  - lib/dev_suite/utils/table.rb
167
189
  - lib/dev_suite/utils/table/column.rb
168
190
  - lib/dev_suite/utils/table/config.rb
191
+ - lib/dev_suite/utils/table/config/config.rb
192
+ - lib/dev_suite/utils/table/config/configuration.rb
169
193
  - lib/dev_suite/utils/table/formatter.rb
170
194
  - lib/dev_suite/utils/table/formatter/column_width_calculator.rb
171
195
  - lib/dev_suite/utils/table/formatter/text_aligner.rb
@@ -173,8 +197,8 @@ files:
173
197
  - lib/dev_suite/utils/table/renderer/base.rb
174
198
  - lib/dev_suite/utils/table/renderer/simple.rb
175
199
  - lib/dev_suite/utils/table/row.rb
176
- - lib/dev_suite/utils/table/settings.rb
177
200
  - lib/dev_suite/utils/table/table.rb
201
+ - lib/dev_suite/utils/utils.rb
178
202
  - lib/dev_suite/version.rb
179
203
  homepage: https://patrick204nqh.github.io
180
204
  licenses:
@@ -1,18 +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
- max_size: 100 * 1024 * 1024, # 100 MB
14
- }
15
- end
16
- end
17
- end
18
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module Emoji
5
- # A frozen hash that contains all the emojis used in the application.
6
- EMOJIS = {
7
- start: "🚀",
8
- success: "✅",
9
- error: "🚨❌",
10
- retry: "💥",
11
- info: "ℹ️",
12
- warning: "⚠️",
13
- note: "📝", # For notes or annotations
14
- tip: "💡", # For tips or helpful hints
15
- important: "❗", # For important information
16
- caution: "⚠️", # For warnings or cautions
17
- document: "📄", # For representing documents or files
18
- code: "💻", # For code or technical content
19
- update: "🔄", # For updates or changes
20
- bug: "🐞", # For bugs or issues
21
- fix: "🔧", # For fixes or repairs
22
- }.freeze
23
-
24
- class << self
25
- # Returns the emoji corresponding to the given key.
26
- # @param key [Symbol] the key to look up the emoji
27
- # @return [String] the corresponding emoji or an empty string if not found
28
- def get(key)
29
- EMOJIS[key] || ""
30
- end
31
- end
32
- end
33
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module ErrorHandler
5
- extend self # This makes all instance methods behave like class methods
6
-
7
- def handle_error(error)
8
- Logger.log(
9
- "Oops! An error occurred: #{error.message}",
10
- level: :error,
11
- emoji: :error,
12
- )
13
- Logger.log(
14
- "For more information, please refer to the README: " \
15
- "https://github.com/patrick204nqh/dev_suite",
16
- level: :error,
17
- emoji: :document,
18
- )
19
- # exit(1)
20
- end
21
- end
22
- end
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module Logger
5
- LOG_DETAILS = {
6
- info: { prefix: "[INFO]", color: :green },
7
- warn: { prefix: "[WARNING]", color: :yellow },
8
- error: { prefix: "[ERROR]", color: :red },
9
- debug: { prefix: "[DEBUG]", color: :blue },
10
- }.freeze
11
-
12
- class << self
13
- # Logs a message with an optional emoji and specified log level.
14
- #
15
- # @param message [String] The message to log.
16
- # @param level [Symbol] The log level (:info, :warn, :error, :debug).
17
- # @param emoji [String, Symbol] Optional emoji to prepend to the message.
18
- def log(message, level: :info, emoji: nil)
19
- emoji_icon = resolve_emoji(emoji)
20
- formatted_message = format_message("#{emoji_icon} #{message}", level)
21
- output_log(formatted_message)
22
- end
23
-
24
- private
25
-
26
- # Resolves the emoji, either from a symbol or directly as a string.
27
- #
28
- # @param emoji [String, Symbol, nil] The emoji or its symbol key.
29
- # @return [String] The resolved emoji or an empty string if none is provided.
30
- def resolve_emoji(emoji)
31
- return "" unless emoji
32
-
33
- emoji.is_a?(Symbol) ? Emoji.get(emoji) : emoji
34
- end
35
-
36
- # Formats the log message with the appropriate prefix and color.
37
- #
38
- # @param message [String] The message to format.
39
- # @param level [Symbol] The log level (:info, :warn, :error, :debug).
40
- # @return [String] The formatted log message.
41
- def format_message(message, level)
42
- details = LOG_DETAILS[level]
43
- raise ArgumentError, "Invalid log level: #{level}" unless details
44
-
45
- Utils::Color.colorize("#{details[:prefix]} #{message}", color: details[:color])
46
- end
47
-
48
- # Outputs the formatted log message to the console.
49
- #
50
- # @param formatted_message [String] The message to output.
51
- def output_log(formatted_message)
52
- puts formatted_message if formatted_message
53
- end
54
- end
55
- end
56
- 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