dev_suite 0.1.0 → 0.1.1

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: 368efd66d4aa6229bbb00ceac32f7c505f35543e2ba5834dc9dd3509f27e4c55
4
- data.tar.gz: c2af717b31f413ea03ebdcbdc0b47f70b895c29d66e82f12e685d1b1f7e75657
3
+ metadata.gz: 18cb4bab59f55347094ab11c9772b132446789b2c5a12cdb0a596b9ccd57ab0b
4
+ data.tar.gz: 212866e22087fa628633af141c349e9831f0d0ad060018aed0f0cd6742cbfb9e
5
5
  SHA512:
6
- metadata.gz: eb257b7bc6c8436de804fe32510380319d77d30656259739767fa2739885867df47e0c1a5d6cc1b6111214e272863b1ff0c235c053ff9b71056c622bc8324032
7
- data.tar.gz: 4b568c9210885a684b4edfad0d07ddd4a7daab5f4dbcdb959fc4e30870b190e2d9f867fc4dc503b6264f59c4dd877bb1af1dd884f5776a7cbfeec1ef7bdd5076
6
+ metadata.gz: 29b881d2e2f34f10aced28ff856a56ca75da39c4000c8cd17194d2bd535c7b595799919ba164bf2a55ac61b4e0f3d9833f9e11c028e3fcc51c0b1017ba307aca
7
+ data.tar.gz: d136f946ff59f6db1d5ac5d14447d302ed6f85df55e1c4b64af2f0cc5a54efa2a48ec4aaffa2a520cb455195af4300aeb0c3ae606da6c4b7aba19ca66a5a6e32
data/Gemfile CHANGED
@@ -7,6 +7,6 @@ gemspec
7
7
 
8
8
  gem "rake", "~> 13.0"
9
9
  gem "rspec", "~> 3.9"
10
- gem "rubocop", "~> 1.65"
11
- gem "rubocop-shopify", "~> 2.15"
10
+ gem "rubocop", "~> 1.65", require: false
11
+ gem "rubocop-shopify", "~> 2.15", require: false
12
12
  gem "pry", "~> 0.14"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dev_suite (0.1.0)
4
+ dev_suite (0.1.1)
5
5
  benchmark (~> 0.1)
6
6
  get_process_mem (~> 0.2)
7
7
 
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # DevSuite
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/dev_suite.svg)](https://badge.fury.io/rb/dev_suite)
4
+ [![Code Climate](https://codeclimate.com/github/patrick204nqh/dev_suite/badges/gpa.svg)](https://codeclimate.com/github/patrick204nqh/dev_suite)
5
+
3
6
  Welcome to DevSuite! This gem provides a suite of utilities for developers to enhance their productivity.
4
7
 
5
8
  ## Installation
@@ -40,7 +43,7 @@ DevSuite::SomeUtility.do_something
40
43
  ## Features
41
44
 
42
45
  <details>
43
- <summary><strong>Performance Analysis with DevSuite::Performance::Analyzer</strong></summary>
46
+ <summary><strong>Performance Analysis</strong></summary>
44
47
 
45
48
  Analyze the performance of your code blocks with detailed benchmark and memory usage reports.
46
49
 
@@ -49,10 +52,34 @@ DevSuite::SomeUtility.do_something
49
52
  require 'dev_suite'
50
53
 
51
54
  DevSuite::Performance::Analyzer.analyze(description: "My Code Block") do
52
- # Your code here
55
+ sum = 0
56
+ 1_000_000.times do |i|
57
+ sum += i
58
+ end
59
+ sum
53
60
  end
54
61
  ```
55
- </detail>
62
+
63
+ **Example output**
64
+ ```
65
+ | Performance Analysis |
66
+ +----------------------------+---------------+
67
+ | Metric | Value |
68
+ +----------------------------+---------------+
69
+ | Description | My Code Block |
70
+ | Total Time (s) | 0.056238 |
71
+ | User CPU Time (s) | 0.055662 |
72
+ | System CPU Time (s) | 0.000097 |
73
+ | User + System CPU Time (s) | 0.055759 |
74
+ | Memory Before (MB) | 25.39 |
75
+ | Memory After (MB) | 25.42 |
76
+ | Memory Used (MB) | 0.03 |
77
+ | Max Memory Used (MB) | 25.41 |
78
+ | Min Memory Used (MB) | 25.41 |
79
+ | Avg Memory Used (MB) | 25.41 |
80
+ ```
81
+ </details>
82
+
56
83
 
57
84
  ## Development
58
85
 
@@ -84,4 +111,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
84
111
 
85
112
  ## Code of Conduct
86
113
 
87
- Everyone interacting in the DevSuite project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/patrick204nqh/dev_suite/blob/master/CODE_OF_CONDUCT.md).
114
+ Everyone interacting in the DevSuite project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/patrick204nqh/dev_suite/blob/master/CODE_OF_CONDUCT.md).
data/dev_suite.gemspec CHANGED
@@ -9,8 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["patrick204nqh@gmail.com"]
10
10
 
11
11
  spec.summary = "A suite of development tools."
12
- spec.description = "Provides tools for performance analysis, folder structure visualization, " \
13
- "and custom curl command generation."
12
+ spec.description = "This gem provides a suite of utilities for developers to enhance their productivity."
14
13
  spec.homepage = "https://patrick204nqh.github.io"
15
14
  spec.license = "MIT"
16
15
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "reporting/report_generator"
4
- require_relative "profiling/benchmark_profiler"
5
- require_relative "profiling/memory_profiler"
3
+ require_relative "reportor"
4
+ require_relative "profiler"
6
5
 
7
6
  module DevSuite
8
7
  module Performance
@@ -21,8 +20,8 @@ module DevSuite
21
20
 
22
21
  def initialize(description: "Block")
23
22
  @description = description
24
- @benchmark_profiler = Profiling::BenchmarkProfiler.new
25
- @memory_profiler = Profiling::MemoryProfiler.new
23
+ @benchmark_profiler = Profiler::Benchmark.new
24
+ @memory_profiler = Profiler::Memory.new
26
25
  @memory_usage = Data::MemoryUsage.new
27
26
  end
28
27
 
@@ -54,12 +53,12 @@ module DevSuite
54
53
  # @param benchmark_result [Benchmark::Tms] The benchmark result
55
54
  # @param memory_stats [Hash] The memory statistics
56
55
  def generate_report(benchmark_result, memory_stats)
57
- report_generator = Reporting::ReportGenerator.new(
56
+ reportor = Reportor::Simple.new(
58
57
  @description,
59
58
  benchmark_result,
60
59
  memory_stats,
61
60
  )
62
- report_generator.generate
61
+ reportor.generate
63
62
  end
64
63
  end
65
64
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Performance
5
+ module Data
6
+ require_relative "data/memory_usage"
7
+ end
8
+ end
9
+ end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module DevSuite
4
4
  module Performance
5
- module Profiling
6
- class BaseProfiler
5
+ module Profiler
6
+ class Base
7
7
  def run(&block)
8
8
  raise NotImplementedError, "Subclasses must implement the run method"
9
9
  end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "benchmark"
4
- require_relative "base_profiler"
4
+ require_relative "base"
5
5
 
6
6
  module DevSuite
7
7
  module Performance
8
- module Profiling
9
- class BenchmarkProfiler < BaseProfiler
8
+ module Profiler
9
+ class Benchmark < Base
10
10
  def run(&block)
11
- Benchmark.measure do
11
+ ::Benchmark.measure do
12
12
  block.call
13
13
  end
14
14
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "base_profiler"
3
+ require_relative "base"
4
4
  require_relative "../data/memory_usage"
5
5
 
6
6
  module DevSuite
7
7
  module Performance
8
- module Profiling
9
- class MemoryProfiler < BaseProfiler
8
+ module Profiler
9
+ class Memory < Base
10
10
  attr_reader :max_memory, :min_memory, :average_memory
11
11
 
12
12
  def initialize
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Performance
5
+ module Profiler
6
+ require_relative "profiler/benchmark"
7
+ require_relative "profiler/memory"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module DevSuite
2
+ module Performance
3
+ module Reportor
4
+ class Base
5
+ def generate
6
+ raise NotImplementedError, "Subclasses must implement the generate method"
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../../utils/table/table"
4
- require_relative "../../utils/table/config"
5
- require_relative "../../utils/table/renderer/simple"
3
+ require_relative "base"
4
+ require_relative "../../utils"
6
5
 
7
6
  module DevSuite
8
7
  module Performance
9
- module Reporting
10
- class ReportGenerator
8
+ module Reportor
9
+ class Simple < Base
11
10
  def initialize(description, benchmark_result, memory_stats)
11
+ super()
12
12
  @description = description
13
13
  @benchmark_result = benchmark_result
14
14
  @memory_stats = memory_stats
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Performance
5
+ module Reporting
6
+ require_relative "reportor/simple"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Performance
5
+ require_relative "performance/analyzer"
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Table
6
+ module Column
7
+ require_relative "column/column"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Table
6
+ module Renderer
7
+ require_relative "renderer/base"
8
+ require_relative "renderer/simple"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Table
6
+ module Row
7
+ require_relative "row/row"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "column/column"
4
4
  require_relative "row/row"
5
- require_relative "renderer/simple"
5
+ require_relative "renderer"
6
6
  require_relative "config"
7
7
 
8
8
  module DevSuite
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ require_relative "utils/table/table"
6
+ require_relative "utils/table/config"
7
+ require_relative "utils/table/renderer/simple"
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module DevSuite
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/dev_suite.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dev_suite/version"
4
- require "dev_suite/performance/analyzer"
4
+ require "dev_suite/performance"
5
5
 
6
6
  module DevSuite
7
7
  class Error < StandardError; 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.1.0
4
+ version: 0.1.1
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-09 00:00:00.000000000 Z
11
+ date: 2024-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark
@@ -38,8 +38,8 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.2'
41
- description: Provides tools for performance analysis, folder structure visualization,
42
- and custom curl command generation.
41
+ description: This gem provides a suite of utilities for developers to enhance their
42
+ productivity.
43
43
  email:
44
44
  - patrick204nqh@gmail.com
45
45
  executables: []
@@ -61,19 +61,28 @@ files:
61
61
  - bin/setup
62
62
  - dev_suite.gemspec
63
63
  - lib/dev_suite.rb
64
+ - lib/dev_suite/performance.rb
64
65
  - lib/dev_suite/performance/analyzer.rb
66
+ - lib/dev_suite/performance/data.rb
65
67
  - lib/dev_suite/performance/data/memory_usage.rb
66
- - lib/dev_suite/performance/profiling/base_profiler.rb
67
- - lib/dev_suite/performance/profiling/benchmark_profiler.rb
68
- - lib/dev_suite/performance/profiling/memory_profiler.rb
69
- - lib/dev_suite/performance/reporting/report_generator.rb
68
+ - lib/dev_suite/performance/profiler.rb
69
+ - lib/dev_suite/performance/profiler/base.rb
70
+ - lib/dev_suite/performance/profiler/benchmark.rb
71
+ - lib/dev_suite/performance/profiler/memory.rb
72
+ - lib/dev_suite/performance/reportor.rb
73
+ - lib/dev_suite/performance/reportor/base.rb
74
+ - lib/dev_suite/performance/reportor/simple.rb
75
+ - lib/dev_suite/utils.rb
76
+ - lib/dev_suite/utils/table/column.rb
70
77
  - lib/dev_suite/utils/table/column/column.rb
71
78
  - lib/dev_suite/utils/table/config.rb
72
79
  - lib/dev_suite/utils/table/formatter/colorizer.rb
73
80
  - lib/dev_suite/utils/table/formatter/column_width_calculator.rb
74
81
  - lib/dev_suite/utils/table/formatter/text_aligner.rb
82
+ - lib/dev_suite/utils/table/renderer.rb
75
83
  - lib/dev_suite/utils/table/renderer/base.rb
76
84
  - lib/dev_suite/utils/table/renderer/simple.rb
85
+ - lib/dev_suite/utils/table/row.rb
77
86
  - lib/dev_suite/utils/table/row/row.rb
78
87
  - lib/dev_suite/utils/table/table.rb
79
88
  - lib/dev_suite/version.rb