dev_suite 0.2.4 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -5
- data/.vscode/extensions.json +8 -0
- data/.vscode/launch.json +39 -0
- data/.vscode/settings.json +28 -0
- data/Gemfile +6 -1
- data/Gemfile.lock +28 -2
- data/README.md +69 -8
- data/bin/rspec +27 -0
- data/dev_suite.gemspec +0 -4
- data/lib/dev_suite/cli/commands/base.rb +0 -2
- data/lib/dev_suite/cli/commands/tree.rb +3 -3
- data/lib/dev_suite/cli/commands/version.rb +1 -1
- data/lib/dev_suite/cli/main.rb +1 -1
- data/lib/dev_suite/dev_suite.rb +12 -0
- data/lib/dev_suite/directory_tree/builder/base.rb +1 -1
- data/lib/dev_suite/directory_tree/builder/builder.rb +13 -0
- data/lib/dev_suite/directory_tree/builder.rb +1 -12
- data/lib/dev_suite/directory_tree/config/config.rb +11 -0
- data/lib/dev_suite/directory_tree/config/configuration.rb +34 -0
- data/lib/dev_suite/directory_tree/config.rb +2 -36
- data/lib/dev_suite/directory_tree/directory_tree.rb +0 -3
- data/lib/dev_suite/directory_tree/node/node.rb +12 -0
- data/lib/dev_suite/directory_tree/node.rb +1 -4
- data/lib/dev_suite/directory_tree/renderer/base.rb +1 -7
- data/lib/dev_suite/directory_tree/renderer/renderer.rb +14 -0
- data/lib/dev_suite/directory_tree/renderer.rb +1 -13
- data/lib/dev_suite/directory_tree/visualizer/base.rb +1 -1
- data/lib/dev_suite/directory_tree/visualizer/visualizer.rb +16 -0
- data/lib/dev_suite/directory_tree/visualizer.rb +1 -15
- data/lib/dev_suite/performance/analyzer.rb +1 -1
- data/lib/dev_suite/performance/config/config.rb +11 -0
- data/lib/dev_suite/performance/config/configuration.rb +30 -0
- data/lib/dev_suite/performance/config.rb +2 -30
- data/lib/dev_suite/performance/data/data.rb +9 -0
- data/lib/dev_suite/performance/data.rb +1 -1
- data/lib/dev_suite/performance/profiler/base.rb +1 -1
- data/lib/dev_suite/performance/profiler/profiler.rb +16 -0
- data/lib/dev_suite/performance/profiler.rb +1 -20
- data/lib/dev_suite/performance/profiler_manager.rb +1 -0
- data/lib/dev_suite/performance/{reportor → reporter}/base.rb +2 -2
- data/lib/dev_suite/performance/{reportor → reporter}/helpers/stat_mappings.rb +1 -1
- data/lib/dev_suite/performance/{reportor → reporter}/helpers/table_builder.rb +1 -1
- data/lib/dev_suite/performance/{reportor → reporter}/helpers.rb +1 -1
- data/lib/dev_suite/performance/reporter/reporter.rb +15 -0
- data/lib/dev_suite/performance/{reportor → reporter}/simple.rb +1 -1
- data/lib/dev_suite/performance/reporter.rb +9 -0
- data/lib/dev_suite/performance.rb +1 -1
- data/lib/dev_suite/request_logger/adapter/adapter.rb +31 -0
- data/lib/dev_suite/request_logger/adapter/base.rb +17 -0
- data/lib/dev_suite/request_logger/adapter/faraday.rb +37 -0
- data/lib/dev_suite/request_logger/adapter/middleware/faraday.rb +22 -0
- data/lib/dev_suite/request_logger/adapter/net_http.rb +43 -0
- data/lib/dev_suite/request_logger/adapter.rb +9 -0
- data/lib/dev_suite/request_logger/config/config.rb +11 -0
- data/lib/dev_suite/request_logger/config/configuration.rb +24 -0
- data/lib/dev_suite/request_logger/config.rb +9 -0
- data/lib/dev_suite/request_logger/extractor/base.rb +17 -0
- data/lib/dev_suite/request_logger/extractor/extractor.rb +22 -0
- data/lib/dev_suite/request_logger/extractor/faraday.rb +37 -0
- data/lib/dev_suite/request_logger/extractor/net_http.rb +36 -0
- data/lib/dev_suite/request_logger/extractor.rb +9 -0
- data/lib/dev_suite/request_logger/logger.rb +87 -0
- data/lib/dev_suite/request_logger/request.rb +19 -0
- data/lib/dev_suite/request_logger/request_logger.rb +32 -0
- data/lib/dev_suite/request_logger/response.rb +28 -0
- data/lib/dev_suite/request_logger.rb +7 -0
- data/lib/dev_suite/utils/color/color.rb +12 -0
- data/lib/dev_suite/utils/color/config/config.rb +13 -0
- data/lib/dev_suite/utils/color/config/configuration.rb +31 -0
- data/lib/dev_suite/utils/color/config.rb +2 -31
- data/lib/dev_suite/utils/color/palette/base.rb +1 -14
- data/lib/dev_suite/utils/color/palette/palette.rb +16 -0
- data/lib/dev_suite/utils/color/palette.rb +1 -13
- data/lib/dev_suite/utils/color/strategy/base.rb +1 -1
- data/lib/dev_suite/utils/color/strategy/strategy.rb +20 -0
- data/lib/dev_suite/utils/color/strategy/theme.rb +6 -7
- data/lib/dev_suite/utils/color/strategy.rb +1 -21
- data/lib/dev_suite/utils/color.rb +1 -4
- data/lib/dev_suite/utils/construct/component/base.rb +30 -0
- data/lib/dev_suite/utils/construct/component/component.rb +12 -0
- data/lib/dev_suite/utils/construct/component/initializer.rb +28 -0
- data/lib/dev_suite/utils/construct/component/manager.rb +57 -0
- data/lib/dev_suite/utils/construct/component.rb +11 -0
- data/lib/dev_suite/utils/construct/config/attribute/attr_definition.rb +76 -0
- data/lib/dev_suite/utils/construct/config/attribute/attr_initialization.rb +22 -0
- data/lib/dev_suite/utils/construct/config/attribute/attr_resolving.rb +80 -0
- data/lib/dev_suite/utils/construct/config/attribute/attribute.rb +24 -0
- data/lib/dev_suite/utils/construct/config/attribute/validator.rb +55 -0
- data/lib/dev_suite/utils/construct/config/attribute.rb +13 -0
- data/lib/dev_suite/utils/construct/config/base.rb +25 -0
- data/lib/dev_suite/utils/construct/config/config.rb +16 -0
- data/lib/dev_suite/utils/construct/config/dependency_handler.rb +56 -0
- data/lib/dev_suite/utils/construct/config/hook/hook.rb +22 -0
- data/lib/dev_suite/utils/construct/config/hook/hook_registry.rb +24 -0
- data/lib/dev_suite/utils/construct/config/hook/hook_runner.rb +20 -0
- data/lib/dev_suite/utils/construct/config/hook/manager.rb +36 -0
- data/lib/dev_suite/utils/construct/config/hook.rb +13 -0
- data/lib/dev_suite/utils/construct/config/manager.rb +41 -0
- data/lib/dev_suite/utils/construct/config/settings/base.rb +59 -0
- data/lib/dev_suite/utils/construct/config/settings/manager.rb +38 -0
- data/lib/dev_suite/utils/construct/config/settings/settings.rb +14 -0
- data/lib/dev_suite/utils/construct/config/settings.rb +13 -0
- data/lib/dev_suite/utils/construct/config.rb +11 -0
- data/lib/dev_suite/utils/construct/construct.rb +10 -0
- data/lib/dev_suite/utils/construct.rb +16 -0
- data/lib/dev_suite/utils/dependency_loader.rb +71 -0
- data/lib/dev_suite/utils/emoji.rb +71 -0
- data/lib/dev_suite/utils/error_handler.rb +24 -0
- data/lib/dev_suite/utils/file_loader/config/config.rb +13 -0
- data/lib/dev_suite/utils/file_loader/config/configuration.rb +33 -0
- data/lib/dev_suite/utils/file_loader/config.rb +11 -0
- data/lib/dev_suite/utils/file_loader/file_loader.rb +23 -0
- data/lib/dev_suite/utils/file_loader/loader/base.rb +21 -0
- data/lib/dev_suite/utils/file_loader/loader/json.rb +21 -0
- data/lib/dev_suite/utils/file_loader/loader/loader.rb +41 -0
- data/lib/dev_suite/utils/file_loader/loader/text.rb +21 -0
- data/lib/dev_suite/utils/file_loader/loader/yaml.rb +38 -0
- data/lib/dev_suite/utils/file_loader/loader.rb +13 -0
- data/lib/dev_suite/utils/file_loader/loader_manager.rb +34 -0
- data/lib/dev_suite/utils/file_loader/loader_registry.rb +36 -0
- data/lib/dev_suite/utils/file_loader.rb +9 -0
- data/lib/dev_suite/utils/logger.rb +58 -0
- data/lib/dev_suite/utils/path_matcher/matcher.rb +31 -0
- data/lib/dev_suite/utils/path_matcher/path_matcher.rb +17 -0
- data/lib/dev_suite/utils/path_matcher/pattern.rb +35 -0
- data/lib/dev_suite/utils/path_matcher.rb +9 -0
- data/lib/dev_suite/utils/table/config/config.rb +13 -0
- data/lib/dev_suite/utils/table/config/configuration.rb +32 -0
- data/lib/dev_suite/utils/table/config.rb +2 -23
- data/lib/dev_suite/utils/table/formatter/formatter.rb +12 -0
- data/lib/dev_suite/utils/table/formatter.rb +1 -2
- data/lib/dev_suite/utils/table/renderer/base.rb +1 -7
- data/lib/dev_suite/utils/table/renderer/renderer.rb +16 -0
- data/lib/dev_suite/utils/table/renderer/simple.rb +9 -5
- data/lib/dev_suite/utils/table/renderer.rb +1 -13
- data/lib/dev_suite/utils/table/table.rb +6 -0
- data/lib/dev_suite/utils/table.rb +0 -6
- data/lib/dev_suite/utils/utils.rb +15 -0
- data/lib/dev_suite/utils.rb +1 -3
- data/lib/dev_suite/version.rb +3 -1
- data/lib/dev_suite.rb +1 -10
- metadata +101 -44
- data/lib/dev_suite/directory_tree/settings.rb +0 -18
- data/lib/dev_suite/emoji.rb +0 -33
- data/lib/dev_suite/error_handler.rb +0 -22
- data/lib/dev_suite/logger.rb +0 -56
- data/lib/dev_suite/performance/reportor.rb +0 -22
- data/lib/dev_suite/utils/config_tools/configuration.rb +0 -134
- data/lib/dev_suite/utils/config_tools/settings.rb +0 -67
- data/lib/dev_suite/utils/config_tools.rb +0 -10
- data/lib/dev_suite/utils/table/settings.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a7188e92386a13da83abc637b7446d68c485eff8e6e2198a53f88360ac13f02
|
4
|
+
data.tar.gz: f76c576284ba7b90bc671a389cd6e43065079f04ae19567b0e633a147e2b2276
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b565a159f2aee25115301ae629dcd2e44e844005586c2505e92cd18f75f9845a856c16f8db1c5a309eb249f645ba1e90b6c36ca4e0958f6106f39d0d86f7434a
|
7
|
+
data.tar.gz: 7a34933bf806f8e3fb09351b200698da8d6f5568fefc3054f7ba0591c939dc264b9962c77cd56b6f01e5304b2bb60e5301885f33f34b05bebd54858046cb1e73
|
data/.rubocop.yml
CHANGED
@@ -5,13 +5,12 @@ AllCops:
|
|
5
5
|
NewCops: enable
|
6
6
|
TargetRubyVersion: 2.7
|
7
7
|
Exclude:
|
8
|
+
- '.git/**/*'
|
8
9
|
- 'bin/**/*'
|
9
|
-
- 'db/schema.rb'
|
10
10
|
- 'node_modules/**/*'
|
11
|
-
- '
|
12
|
-
- '
|
13
|
-
- '
|
14
|
-
- 'lib/dev_suite/version.rb'
|
11
|
+
- 'coverage/**/*'
|
12
|
+
- 'tmp/**/*'
|
13
|
+
- 'log/**/*'
|
15
14
|
|
16
15
|
Metrics/LineLength:
|
17
16
|
Max: 120
|
data/.vscode/launch.json
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
{
|
2
|
+
"version": "0.2.0",
|
3
|
+
"configurations": [
|
4
|
+
{
|
5
|
+
"name": "Debug all tests",
|
6
|
+
"type": "rdbg",
|
7
|
+
"request": "launch",
|
8
|
+
"useBundler": true,
|
9
|
+
"script": "${workspaceFolder}/bin/rspec",
|
10
|
+
"args": [
|
11
|
+
"--color",
|
12
|
+
"--require",
|
13
|
+
"rspec",
|
14
|
+
"--format",
|
15
|
+
"progress",
|
16
|
+
"${workspaceFolder}/spec"
|
17
|
+
],
|
18
|
+
"useTerminal": false,
|
19
|
+
"env": { "DEBUG": "true" }
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"name": "Debug current line",
|
23
|
+
"type": "rdbg",
|
24
|
+
"request": "launch",
|
25
|
+
"useBundler": true,
|
26
|
+
"script": "${workspaceFolder}/bin/rspec",
|
27
|
+
"args": [
|
28
|
+
"--color",
|
29
|
+
"--require",
|
30
|
+
"rspec",
|
31
|
+
"--format",
|
32
|
+
"progress",
|
33
|
+
"${file}:${lineNumber}"
|
34
|
+
],
|
35
|
+
"useTerminal": false,
|
36
|
+
"env": { "DEBUG": "true" }
|
37
|
+
}
|
38
|
+
]
|
39
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"[ruby]": {
|
3
|
+
"editor.defaultFormatter": "Shopify.ruby-lsp", // Use the Ruby LSP as the default formatter
|
4
|
+
"editor.formatOnSave": true, // Format files automatically when saving
|
5
|
+
"editor.tabSize": 2, // Use 2 spaces for indentation
|
6
|
+
"editor.insertSpaces": true, // Use spaces and not tabs for indentation
|
7
|
+
"editor.semanticHighlighting.enabled": true, // Enable semantic highlighting
|
8
|
+
"editor.formatOnType": true // Enable formatting while typing
|
9
|
+
},
|
10
|
+
"rubyLsp.enabledFeatures": {
|
11
|
+
"codeActions": true,
|
12
|
+
"diagnostics": true,
|
13
|
+
"documentHighlights": true,
|
14
|
+
"documentLink": true,
|
15
|
+
"documentSymbols": true,
|
16
|
+
"foldingRanges": true,
|
17
|
+
"formatting": true,
|
18
|
+
"hover": true,
|
19
|
+
"inlayHint": true,
|
20
|
+
"onTypeFormatting": true,
|
21
|
+
"selectionRanges": true,
|
22
|
+
"semanticHighlighting": true,
|
23
|
+
"completion": true,
|
24
|
+
"codeLens": true
|
25
|
+
},
|
26
|
+
"rubyLsp.formatter": "rubocop", // Use RuboCop for formatting within Ruby LSP
|
27
|
+
"ruby.rubocop.configFilePath": ".rubocop.yml" // Use the .rubocop.yml file in the root of the project
|
28
|
+
}
|
data/Gemfile
CHANGED
@@ -5,13 +5,18 @@ source "https://rubygems.org"
|
|
5
5
|
# Use the gemspec method to include dependencies specified in the gemspec file
|
6
6
|
gemspec
|
7
7
|
|
8
|
+
# Additional runtime dependencies
|
9
|
+
gem "faraday", "~> 1.4"
|
10
|
+
|
8
11
|
# Additional development tools not required as part of the gem's runtime
|
9
12
|
group :development, :test do
|
13
|
+
gem "rspec", "~> 3.9"
|
14
|
+
gem "simplecov", "~> 0.21"
|
10
15
|
gem "rake", "~> 13.0"
|
11
|
-
gem "pry", "~> 0.14"
|
12
16
|
end
|
13
17
|
|
14
18
|
group :development do
|
19
|
+
gem "pry", "~> 0.14"
|
15
20
|
gem "rubocop", "~> 1.65", require: false
|
16
21
|
gem "rubocop-shopify", "~> 2.15", require: false
|
17
22
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dev_suite (0.2.
|
4
|
+
dev_suite (0.2.7)
|
5
5
|
benchmark (~> 0.1)
|
6
6
|
get_process_mem (~> 1.0)
|
7
7
|
thor (~> 1.1)
|
@@ -15,6 +15,29 @@ GEM
|
|
15
15
|
coderay (1.1.3)
|
16
16
|
diff-lcs (1.5.1)
|
17
17
|
docile (1.4.1)
|
18
|
+
faraday (1.10.3)
|
19
|
+
faraday-em_http (~> 1.0)
|
20
|
+
faraday-em_synchrony (~> 1.0)
|
21
|
+
faraday-excon (~> 1.1)
|
22
|
+
faraday-httpclient (~> 1.0)
|
23
|
+
faraday-multipart (~> 1.0)
|
24
|
+
faraday-net_http (~> 1.0)
|
25
|
+
faraday-net_http_persistent (~> 1.0)
|
26
|
+
faraday-patron (~> 1.0)
|
27
|
+
faraday-rack (~> 1.0)
|
28
|
+
faraday-retry (~> 1.0)
|
29
|
+
ruby2_keywords (>= 0.0.4)
|
30
|
+
faraday-em_http (1.0.0)
|
31
|
+
faraday-em_synchrony (1.0.0)
|
32
|
+
faraday-excon (1.1.0)
|
33
|
+
faraday-httpclient (1.0.1)
|
34
|
+
faraday-multipart (1.0.4)
|
35
|
+
multipart-post (~> 2)
|
36
|
+
faraday-net_http (1.0.2)
|
37
|
+
faraday-net_http_persistent (1.2.0)
|
38
|
+
faraday-patron (1.0.0)
|
39
|
+
faraday-rack (1.0.0)
|
40
|
+
faraday-retry (1.0.3)
|
18
41
|
ffi (1.17.0)
|
19
42
|
ffi (1.17.0-aarch64-linux-gnu)
|
20
43
|
ffi (1.17.0-aarch64-linux-musl)
|
@@ -32,6 +55,7 @@ GEM
|
|
32
55
|
json (2.7.2)
|
33
56
|
language_server-protocol (3.17.0.3)
|
34
57
|
method_source (1.1.0)
|
58
|
+
multipart-post (2.4.1)
|
35
59
|
parallel (1.25.1)
|
36
60
|
parser (3.3.4.1)
|
37
61
|
ast (~> 2.4.1)
|
@@ -43,7 +67,7 @@ GEM
|
|
43
67
|
rainbow (3.1.1)
|
44
68
|
rake (13.2.1)
|
45
69
|
regexp_parser (2.9.2)
|
46
|
-
rexml (3.3.
|
70
|
+
rexml (3.3.6)
|
47
71
|
strscan
|
48
72
|
rspec (3.13.0)
|
49
73
|
rspec-core (~> 3.13.0)
|
@@ -74,6 +98,7 @@ GEM
|
|
74
98
|
rubocop-shopify (2.15.1)
|
75
99
|
rubocop (~> 1.51)
|
76
100
|
ruby-progressbar (1.13.0)
|
101
|
+
ruby2_keywords (0.0.5)
|
77
102
|
simplecov (0.22.0)
|
78
103
|
docile (~> 1.1)
|
79
104
|
simplecov-html (~> 0.11)
|
@@ -99,6 +124,7 @@ PLATFORMS
|
|
99
124
|
|
100
125
|
DEPENDENCIES
|
101
126
|
dev_suite!
|
127
|
+
faraday (~> 1.4)
|
102
128
|
pry (~> 0.14)
|
103
129
|
rake (~> 13.0)
|
104
130
|
rspec (~> 3.9)
|
data/README.md
CHANGED
@@ -57,15 +57,13 @@ DevSuite also provides a command-line interface for various utilities. Below are
|
|
57
57
|
## Features Overview
|
58
58
|
|
59
59
|
### Performance Analysis
|
60
|
+
Analyze the performance of Ruby code blocks, capturing metrics like execution time and memory usage.
|
61
|
+
|
60
62
|
<details>
|
61
63
|
<summary>Show more</summary>
|
62
64
|
|
63
|
-
**Purpose**: Quickly analyze the performance of Ruby code blocks, capturing metrics like execution time and memory usage.
|
64
|
-
|
65
65
|
**How to Use**:
|
66
66
|
```ruby
|
67
|
-
require 'dev_suite'
|
68
|
-
|
69
67
|
DevSuite::Performance.analyze(description: "Example Analysis") do
|
70
68
|
sum = 0
|
71
69
|
1_000_000.times { |i| sum += i }
|
@@ -88,15 +86,13 @@ DevSuite also provides a command-line interface for various utilities. Below are
|
|
88
86
|
</details>
|
89
87
|
|
90
88
|
### Directory Tree Visualization
|
89
|
+
Visualize the file structure of directories and subdirectories to better understand project organization.
|
90
|
+
|
91
91
|
<details>
|
92
92
|
<summary>Show more</summary>
|
93
93
|
|
94
|
-
**Purpose**: Visualize the file structure of directories and subdirectories to better understand project organization.
|
95
|
-
|
96
94
|
**How to Use**:
|
97
95
|
```ruby
|
98
|
-
require 'dev_suite'
|
99
|
-
|
100
96
|
# Define the directory path
|
101
97
|
base_path = "/path/to/your/directory"
|
102
98
|
|
@@ -153,6 +149,71 @@ DevSuite also provides a command-line interface for various utilities. Below are
|
|
153
149
|
```
|
154
150
|
</details>
|
155
151
|
|
152
|
+
### Request Logging
|
153
|
+
Log detailed HTTP requests and responses across different adapters like Net::HTTP and Faraday for debugging and monitoring
|
154
|
+
|
155
|
+
<details>
|
156
|
+
<summary>Show more</summary>
|
157
|
+
|
158
|
+
**How to Use**:
|
159
|
+
```ruby
|
160
|
+
DevSuite::RequestLogger.with_logging do
|
161
|
+
# Make an HTTP request using Net::HTTP
|
162
|
+
uri = URI('https://jsonplaceholder.typicode.com/posts')
|
163
|
+
response = Net::HTTP.get(uri)
|
164
|
+
end
|
165
|
+
```
|
166
|
+
|
167
|
+
**Configuration Guide**:
|
168
|
+
Customize the request logging behavior by setting configuration options:
|
169
|
+
```ruby
|
170
|
+
DevSuite::RequestLogger::Config.configure do |config|
|
171
|
+
config.adapters = [:net_http]
|
172
|
+
config.settings.set(:log_level, :debug)
|
173
|
+
config.settings.set(:log_headers, true)
|
174
|
+
config.settings.set(:log_cookies, true)
|
175
|
+
config.settings.set(:log_body, true)
|
176
|
+
end
|
177
|
+
```
|
178
|
+
|
179
|
+
**Configuration Options**:
|
180
|
+
|
181
|
+
Below is a table describing the general configuration options available:
|
182
|
+
|
183
|
+
| Setting | Description | Default Value | Example Values |
|
184
|
+
|----------------|-------------------------------------------------------|---------------|------------------------------------|
|
185
|
+
| `:adapters` | List of adapters for which logging is enabled. | `[:net_http]` | `[:net_http, :faraday]` |
|
186
|
+
|
187
|
+
**Settings Options**:
|
188
|
+
|
189
|
+
The `settings` key allows you to customize various logging behaviors. Below is a table describing these settings:
|
190
|
+
|
191
|
+
| Setting | Description | Default Value | Example Values |
|
192
|
+
|----------------|-------------------------------------------------------|---------------|------------------------------------|
|
193
|
+
| `:log_level` | Set the logging level. | `:debug` | `:info`, `:debug`, `:warn`, `:error` |
|
194
|
+
| `:log_headers` | Enable or disable logging of HTTP headers. | `true` | `true`, `false` |
|
195
|
+
| `:log_cookies` | Enable or disable logging of cookies. | `true` | `true`, `false` |
|
196
|
+
| `:log_body` | Enable or disable logging of HTTP bodies. | `true` | `true`, `false` |
|
197
|
+
|
198
|
+
**Sample Output**:
|
199
|
+
```bash
|
200
|
+
[DEBUG] 🚀 Net::HTTP Request: GET https://jsonplaceholder.typicode.com/posts
|
201
|
+
[DEBUG] 📄 Headers: {"accept-encoding"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "accept"=>"*/*", "user-agent"=>"Ruby", "host"=>"jsonplaceholder.typicode.com"}
|
202
|
+
[DEBUG] 🍪 Cookies: None
|
203
|
+
[DEBUG] ✅ Net::HTTP Response: 200 OK
|
204
|
+
[DEBUG] 📄 Headers: {"date"=>"Wed, 21 Aug 2024 10:33:59 GMT", "content-type"=>"application/json; charset=utf-8", "transfer-encoding"=>"chunked", "connection"=>"keep-alive", "report-to"=>"{\"group\":\"heroku-nel\",\"max_age\":3600,\"endpoints\":[{\"url\":\"https://nel.heroku.com/reports?ts=1723379558&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&s=LYnyHXQQqBH310%2FAbzjH0MN%2BaFoA6Ntqh94a3%2F5J54E%3D\"}]}", "reporting-endpoints"=>"heroku-nel=https://nel.heroku.com/reports?ts=1723379558&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&s=LYnyHXQQqBH310%2FAbzjH0MN%2BaFoA6Ntqh94a3%2F5J54E%3D", "nel"=>"{\"report_to\":\"heroku-nel\",\"max_age\":3600,\"success_fraction\":0.005,\"failure_fraction\":0.05,\"response_headers\":[\"Via\"]}", "x-powered-by"=>"Express", "x-ratelimit-limit"=>"1000", "x-ratelimit-remaining"=>"999", "x-ratelimit-reset"=>"1723379596", "vary"=>"Origin, Accept-Encoding", "access-control-allow-credentials"=>"true", "cache-control"=>"max-age=43200", "pragma"=>"no-cache", "expires"=>"-1", "x-content-type-options"=>"nosniff", "etag"=>"W/\"6b80-Ybsq/K6GwwqrYkAsFxqDXGC7DoM\"", "via"=>"1.1 vegur", "cf-cache-status"=>"HIT", "age"=>"4620", "server"=>"cloudflare", "cf-ray"=>"8b69f7d4ad941fa4-HKG", "alt-svc"=>"h3=\":443\"; ma=86400"}
|
205
|
+
[DEBUG] 💻 Response Body: [
|
206
|
+
{
|
207
|
+
"userId": 1,
|
208
|
+
"id": 1,
|
209
|
+
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
|
210
|
+
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
|
211
|
+
},
|
212
|
+
...
|
213
|
+
]
|
214
|
+
```
|
215
|
+
</details>
|
216
|
+
|
156
217
|
## Development
|
157
218
|
|
158
219
|
After checking out the repo, run `bin/setup`for an interactive prompt that will allow you to experiment.
|
data/bin/rspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require "rubygems"
|
25
|
+
require "bundler/setup"
|
26
|
+
|
27
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/dev_suite.gemspec
CHANGED
@@ -33,8 +33,4 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_dependency("benchmark", "~> 0.1")
|
34
34
|
spec.add_dependency("get_process_mem", "~> 1.0")
|
35
35
|
spec.add_dependency("thor", "~> 1.1")
|
36
|
-
|
37
|
-
# Development dependencies
|
38
|
-
spec.add_development_dependency("rspec", "~> 3.9")
|
39
|
-
spec.add_development_dependency("simplecov", "~> 0.21")
|
40
36
|
end
|
@@ -6,14 +6,14 @@ module DevSuite
|
|
6
6
|
class Tree < Base
|
7
7
|
desc "visualize PATH", "Visualize the directory structure at given PATH"
|
8
8
|
def execute(path, options: {})
|
9
|
-
Logger.log("Starting visualization for: #{path}", emoji: :start)
|
9
|
+
Utils::Logger.log("Starting visualization for: #{path}", emoji: :start)
|
10
10
|
|
11
11
|
apply_configure(options)
|
12
12
|
visualize(path)
|
13
13
|
|
14
|
-
Logger.log("Visualization complete!", emoji: :success)
|
14
|
+
Utils::Logger.log("Visualization complete!", emoji: :success)
|
15
15
|
rescue StandardError => e
|
16
|
-
ErrorHandler.handle_error(e)
|
16
|
+
Utils::ErrorHandler.handle_error(e)
|
17
17
|
end
|
18
18
|
|
19
19
|
private
|
data/lib/dev_suite/cli/main.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DevSuite
|
4
|
+
require_relative "version"
|
5
|
+
require_relative "utils"
|
6
|
+
require_relative "cli"
|
7
|
+
require_relative "performance"
|
8
|
+
require_relative "directory_tree"
|
9
|
+
require_relative "request_logger"
|
10
|
+
|
11
|
+
class Error < StandardError; end
|
12
|
+
end
|
@@ -3,18 +3,7 @@
|
|
3
3
|
module DevSuite
|
4
4
|
module DirectoryTree
|
5
5
|
module Builder
|
6
|
-
require_relative "builder/
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def create(type)
|
10
|
-
case type
|
11
|
-
when :base
|
12
|
-
Base.new
|
13
|
-
else
|
14
|
-
raise ArgumentError, "Unknown renderer type: #{type}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
6
|
+
require_relative "builder/builder"
|
18
7
|
end
|
19
8
|
end
|
20
9
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DevSuite
|
4
|
+
module DirectoryTree
|
5
|
+
module Config
|
6
|
+
class Configuration < Utils::Construct::Config::Base
|
7
|
+
set_default_settings(
|
8
|
+
skip_hidden: false,
|
9
|
+
skip_types: [],
|
10
|
+
max_depth: nil,
|
11
|
+
max_size: 100 * 1024 * 1024, # 100 MB
|
12
|
+
)
|
13
|
+
|
14
|
+
config_attr :builder, default_value: :base, type: :symbol, resolver: :resolve_builder
|
15
|
+
config_attr :renderer, default_value: :simple, type: :symbol, resolver: :resolve_renderer
|
16
|
+
config_attr :visualizer, default_value: :tree, type: :symbol, resolver: :resolve_visualizer
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def resolve_builder(value)
|
21
|
+
Builder.build_component(value)
|
22
|
+
end
|
23
|
+
|
24
|
+
def resolve_renderer(value)
|
25
|
+
Renderer.build_component(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
def resolve_visualizer(value)
|
29
|
+
Visualizer.build_component(value)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -2,42 +2,8 @@
|
|
2
2
|
|
3
3
|
module DevSuite
|
4
4
|
module DirectoryTree
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# Define configuration attributes
|
9
|
-
config_attr :settings, default_value: {}
|
10
|
-
config_attr :builder, default_value: :base
|
11
|
-
config_attr :renderer, default_value: :simple
|
12
|
-
config_attr :visualizer, default_value: :tree
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def validate_attr!(attr, value)
|
17
|
-
case attr
|
18
|
-
when :settings
|
19
|
-
validate_hash!(attr, value)
|
20
|
-
when :builder, :renderer, :visualizer
|
21
|
-
validate_symbol!(attr, value)
|
22
|
-
else
|
23
|
-
raise ArgumentError, "Invalid attribute: #{attr}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def resolve_attr(attr, value)
|
28
|
-
case attr
|
29
|
-
when :settings
|
30
|
-
Settings.new(value)
|
31
|
-
when :builder
|
32
|
-
Builder.create(value)
|
33
|
-
when :renderer
|
34
|
-
Renderer.create(value)
|
35
|
-
when :visualizer
|
36
|
-
Visualizer.create(value)
|
37
|
-
else
|
38
|
-
super # Return the value directly if no special resolution is needed
|
39
|
-
end
|
40
|
-
end
|
5
|
+
module Config
|
6
|
+
require_relative "config/config"
|
41
7
|
end
|
42
8
|
end
|
43
9
|
end
|
@@ -3,13 +3,7 @@
|
|
3
3
|
module DevSuite
|
4
4
|
module DirectoryTree
|
5
5
|
module Renderer
|
6
|
-
class Base
|
7
|
-
attr_reader :settings
|
8
|
-
|
9
|
-
def initialize(settings: Settings.new)
|
10
|
-
@settings = settings
|
11
|
-
end
|
12
|
-
|
6
|
+
class Base < Utils::Construct::Component::Base
|
13
7
|
def render
|
14
8
|
raise NotImplementedError
|
15
9
|
end
|
@@ -3,19 +3,7 @@
|
|
3
3
|
module DevSuite
|
4
4
|
module DirectoryTree
|
5
5
|
module Renderer
|
6
|
-
require_relative "renderer/
|
7
|
-
require_relative "renderer/simple"
|
8
|
-
|
9
|
-
class << self
|
10
|
-
def create(type)
|
11
|
-
case type
|
12
|
-
when :simple
|
13
|
-
Simple.new
|
14
|
-
else
|
15
|
-
raise ArgumentError, "Unknown renderer type: #{type}"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
6
|
+
require_relative "renderer/renderer"
|
19
7
|
end
|
20
8
|
end
|
21
9
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DevSuite
|
4
|
+
module DirectoryTree
|
5
|
+
module Visualizer
|
6
|
+
include Utils::Construct::Component::Manager
|
7
|
+
|
8
|
+
require "pathname"
|
9
|
+
|
10
|
+
require_relative "base"
|
11
|
+
require_relative "tree"
|
12
|
+
|
13
|
+
register_component(Tree)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|