dev_suite 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +31 -0
  4. data/lib/dev_suite/{utils/table/column/column.rb → directory_tree/node/base.rb} +7 -3
  5. data/lib/dev_suite/directory_tree/node/directory.rb +26 -0
  6. data/lib/dev_suite/directory_tree/node/file.rb +15 -0
  7. data/lib/dev_suite/directory_tree/node/permission_denied.rb +25 -0
  8. data/lib/dev_suite/directory_tree/node.rb +11 -0
  9. data/lib/dev_suite/directory_tree/renderer/base.rb +38 -0
  10. data/lib/dev_suite/directory_tree/renderer/simple.rb +77 -0
  11. data/lib/dev_suite/directory_tree/renderer.rb +9 -0
  12. data/lib/dev_suite/directory_tree/visualizer.rb +26 -0
  13. data/lib/dev_suite/directory_tree.rb +7 -0
  14. data/lib/dev_suite/performance/reportor/base.rb +2 -0
  15. data/lib/dev_suite/performance/reportor/simple.rb +0 -1
  16. data/lib/dev_suite/utils/color/colorizer.rb +25 -0
  17. data/lib/dev_suite/utils/color/config.rb +40 -0
  18. data/lib/dev_suite/utils/color/palette/base.rb +32 -0
  19. data/lib/dev_suite/utils/color/palette/default.rb +22 -0
  20. data/lib/dev_suite/utils/color/palette.rb +23 -0
  21. data/lib/dev_suite/utils/color/strategy/base.rb +15 -0
  22. data/lib/dev_suite/utils/color/strategy/basic.rb +25 -0
  23. data/lib/dev_suite/utils/color/strategy/rgb.rb +27 -0
  24. data/lib/dev_suite/utils/color/strategy/theme.rb +36 -0
  25. data/lib/dev_suite/utils/color/strategy.rb +31 -0
  26. data/lib/dev_suite/utils/color.rb +12 -0
  27. data/lib/dev_suite/utils/table/column.rb +6 -2
  28. data/lib/dev_suite/utils/table/config.rb +26 -2
  29. data/lib/dev_suite/utils/table/formatter.rb +12 -0
  30. data/lib/dev_suite/utils/table/renderer/simple.rb +1 -6
  31. data/lib/dev_suite/utils/table/row.rb +6 -2
  32. data/lib/dev_suite/utils/table/table.rb +0 -5
  33. data/lib/dev_suite/utils/table.rb +14 -0
  34. data/lib/dev_suite/utils.rb +2 -3
  35. data/lib/dev_suite/version.rb +1 -1
  36. data/lib/dev_suite.rb +2 -0
  37. metadata +24 -4
  38. data/lib/dev_suite/utils/table/formatter/colorizer.rb +0 -33
  39. data/lib/dev_suite/utils/table/row/row.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18cb4bab59f55347094ab11c9772b132446789b2c5a12cdb0a596b9ccd57ab0b
4
- data.tar.gz: 212866e22087fa628633af141c349e9831f0d0ad060018aed0f0cd6742cbfb9e
3
+ metadata.gz: 92f5e3450bc8b204f0be7e25db8a863ebd49d4d5a6990cfad7c6d336ccaf7e5e
4
+ data.tar.gz: 368e6bd01867d4fc92856b8bc4825e1e5bdc2b3b978e3afa0966139f59216f28
5
5
  SHA512:
6
- metadata.gz: 29b881d2e2f34f10aced28ff856a56ca75da39c4000c8cd17194d2bd535c7b595799919ba164bf2a55ac61b4e0f3d9833f9e11c028e3fcc51c0b1017ba307aca
7
- data.tar.gz: d136f946ff59f6db1d5ac5d14447d302ed6f85df55e1c4b64af2f0cc5a54efa2a48ec4aaffa2a520cb455195af4300aeb0c3ae606da6c4b7aba19ca66a5a6e32
6
+ metadata.gz: 973f1f20d18eab20229c5df12a304c1370ccbfc56175795c9e55fc6bc2680c0a3a3adae63472bcd3dc15ed964ba4413a5847a55d8fefc28312a119af9b0b91d5
7
+ data.tar.gz: f31d767559b8cd4fbfa961cafef17a5cbbcda42a78ee5e012147a96a2652fd8b3417e1184a1e5a60925032aa21b6d256902753c799c322aa48e5240016b6f901
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dev_suite (0.1.1)
4
+ dev_suite (0.1.3)
5
5
  benchmark (~> 0.1)
6
6
  get_process_mem (~> 0.2)
7
7
 
data/README.md CHANGED
@@ -80,6 +80,37 @@ DevSuite::SomeUtility.do_something
80
80
  ```
81
81
  </details>
82
82
 
83
+ <details>
84
+ <summary><strong>Directory Tree Visualization</strong></summary>
85
+
86
+ Visualize the structure of directories and their subdirectories with a detailed hierarchical representation. This tool is essential for understanding the organization of your files and directories at a glance.
87
+
88
+ **Usage:**
89
+ ```ruby
90
+ require 'dev_suite'
91
+
92
+ # Set the base path for the directory you want to visualize
93
+ base_path = "/path/to/your/directory"
94
+
95
+ # Perform the visualization
96
+ DevSuite::DirectoryTree::Visualizer.visualize(base_path)
97
+ ```
98
+
99
+ **Example output**
100
+ ```
101
+ /path/to/your/directory/
102
+ ├── project/
103
+ │ ├── src/
104
+ │ │ ├── main.rb
105
+ │ │ └── helper.rb
106
+ │ └── spec/
107
+ │ └── main_spec.rb
108
+ ├── doc/
109
+ │ └── README.md
110
+ └── test/
111
+ └── test_helper.rb
112
+ ```
113
+ </details>
83
114
 
84
115
  ## Development
85
116
 
@@ -1,14 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DevSuite
4
- module Utils
5
- module Table
6
- class Column
4
+ module DirectoryTree
5
+ module Node
6
+ class Base
7
7
  attr_reader :name
8
8
 
9
9
  def initialize(name)
10
10
  @name = name
11
11
  end
12
+
13
+ def directory?
14
+ raise NotImplementedError, "Must implement in subclass"
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module DevSuite
6
+ module DirectoryTree
7
+ module Node
8
+ class Directory < Base
9
+ attr_reader :children
10
+
11
+ def initialize(name)
12
+ super
13
+ @children = []
14
+ end
15
+
16
+ def directory?
17
+ true
18
+ end
19
+
20
+ def add_child(child)
21
+ @children << child
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module DevSuite
6
+ module DirectoryTree
7
+ module Node
8
+ class File < Base
9
+ def directory?
10
+ false
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module DevSuite
6
+ module DirectoryTree
7
+ module Node
8
+ class PermissionDenied < Base
9
+ # This class is used to represent a file or directory that the user does not have permission to access.
10
+ def initialize(name, is_directory)
11
+ super(name)
12
+ @is_directory = is_directory
13
+ end
14
+
15
+ def directory?
16
+ @is_directory
17
+ end
18
+
19
+ def children
20
+ []
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module DirectoryTree
5
+ module Node
6
+ require_relative "node/file"
7
+ require_relative "node/directory"
8
+ require_relative "node/permission_denied"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+
5
+ module DevSuite
6
+ module DirectoryTree
7
+ module Renderer
8
+ class Base
9
+ def initialize(base_path)
10
+ @base_path = Pathname.new(base_path)
11
+ end
12
+
13
+ def render
14
+ root = build_tree(@base_path)
15
+ render_node(root, "", true)
16
+ end
17
+
18
+ private
19
+
20
+ # Builds the tree structure
21
+ # @param path [Pathname] The path to build the tree from
22
+ # @return [Node::Base] The root node of the tree
23
+ def build_tree(path)
24
+ raise NotImplementedError, "You must implement the build_tree method"
25
+ end
26
+
27
+ # Renders a node in the tree
28
+ # @param node [Node::Base] The node to render
29
+ # @param prefix [String] The prefix to add to the node
30
+ # @param is_last [Boolean] Whether this is the last node in the list
31
+ # @return [String] The rendered node
32
+ def render_node(node, prefix, is_last)
33
+ raise NotImplementedError, "You must implement the render_node method"
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+ require_relative "../node"
5
+
6
+ module DevSuite
7
+ module DirectoryTree
8
+ module Renderer
9
+ class Simple < Base
10
+ private
11
+
12
+ def build_tree(path)
13
+ return permission_denied_node(path) unless path.readable?
14
+
15
+ path.directory? ? directory_node(path) : file_node(path)
16
+ rescue Errno::EACCES
17
+ permission_denied_node(path)
18
+ end
19
+
20
+ def render_node(node, prefix = "", is_last = true)
21
+ is_root = prefix.empty?
22
+ connector = determine_connector(is_root, is_last)
23
+ new_prefix = update_prefix(prefix, is_last)
24
+
25
+ output = construct_output(node, prefix, connector)
26
+ output += node_suffix(node)
27
+
28
+ if node.directory? && node.children.any?
29
+ node.children.each_with_index do |child, index|
30
+ output += render_node(child, new_prefix, index == node.children.size - 1)
31
+ end
32
+ end
33
+
34
+ output
35
+ end
36
+
37
+ def determine_connector(is_root, is_last)
38
+ return "" if is_root
39
+
40
+ is_last ? "└── " : "├── "
41
+ end
42
+
43
+ def update_prefix(prefix, is_last)
44
+ "#{prefix}#{is_last ? " " : "| "}"
45
+ end
46
+
47
+ def construct_output(node, prefix, connector)
48
+ "#{prefix}#{connector}#{node.name}"
49
+ end
50
+
51
+ def node_suffix(node)
52
+ node.directory? ? "/\n" : "\n"
53
+ end
54
+
55
+ def directory_node(path)
56
+ dir = Node::Directory.new(path.basename.to_s)
57
+ sorted_children(path).each do |child|
58
+ dir.add_child(build_tree(child))
59
+ end
60
+ dir
61
+ end
62
+
63
+ def file_node(path)
64
+ Node::File.new(path.basename.to_s)
65
+ end
66
+
67
+ def permission_denied_node(path)
68
+ Node::PermissionDenied.new(path.basename.to_s, path.directory?)
69
+ end
70
+
71
+ def sorted_children(path)
72
+ path.children.sort_by { |child| child.basename.to_s.downcase }
73
+ end
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module DirectoryTree
5
+ module Renderer
6
+ require_relative "renderer/simple"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+ require_relative "renderer"
5
+
6
+ module DevSuite
7
+ module DirectoryTree
8
+ class Visualizer
9
+ class << self
10
+ # Visualizes the directory tree
11
+ # @param base_path [String] The base path of the directory
12
+ def visualize(base_path)
13
+ new(base_path).visualize
14
+ end
15
+ end
16
+
17
+ def initialize(base_path, renderer: Renderer::Simple.new(base_path))
18
+ @renderer = renderer
19
+ end
20
+
21
+ def visualize
22
+ puts @renderer.render
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module DirectoryTree
5
+ require_relative "directory_tree/visualizer"
6
+ end
7
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DevSuite
2
4
  module Performance
3
5
  module Reportor
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "base"
4
- require_relative "../../utils"
5
4
 
6
5
  module DevSuite
7
6
  module Performance
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ class << self
7
+ def colorize(text, **kargs)
8
+ Colorizer.new(Config.configuration).colorize(text, **kargs)
9
+ end
10
+ end
11
+
12
+ class Colorizer
13
+ attr_reader :config
14
+
15
+ def initialize(config = Config.configuration)
16
+ @config = config
17
+ end
18
+
19
+ def colorize(text, **kargs)
20
+ puts @config.strategy.colorize(text, **kargs)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ class Config
7
+ attr_accessor :strategy, :palette
8
+
9
+ def initialize(strategy: :theme, palette: :default)
10
+ @palette = Palette.create(palette)
11
+ @strategy = Strategy.create(strategy, palette: @palette)
12
+ freeze # Make the instance of this class immutable as well
13
+ end
14
+
15
+ class << self
16
+ #
17
+ # Provide global access to a single instance of Config
18
+ #
19
+ def configuration
20
+ @configuration ||= new
21
+ end
22
+
23
+ # Allow block-based configuration
24
+ def configure
25
+ yield(configuration)
26
+ rescue StandardError => e
27
+ handle_configuration_error(e)
28
+ raise
29
+ end
30
+
31
+ private
32
+
33
+ def handle_configuration_error(error)
34
+ puts "Configuration error: #{error.message}"
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ module Palette
7
+ class Base
8
+ # Define COLORS constant in subclass
9
+ # Example:
10
+ # COLORS = {
11
+ # red: 31,
12
+ # green: 32,
13
+ # yellow: 33,
14
+ # blue: 34,
15
+ # pink: 35,
16
+ # light_blue: 36,
17
+ # white: 37
18
+ # }
19
+ #
20
+
21
+ def colors
22
+ unless self.class.const_defined?(:COLORS)
23
+ raise NotImplementedError, "#{self.class} must define COLORS constant"
24
+ end
25
+
26
+ self.class::COLORS
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ module Palette
7
+ class Default < Base
8
+ COLORS = {
9
+ red: 31,
10
+ green: 32,
11
+ yellow: 33,
12
+ blue: 34,
13
+ magenta: 35,
14
+ cyan: 36,
15
+ white: 37,
16
+ default: 39,
17
+ }.freeze
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ module Palette
7
+ require_relative "palette/base"
8
+ require_relative "palette/default"
9
+
10
+ class << self
11
+ def create(type)
12
+ case type
13
+ when :default
14
+ Default.new
15
+ else
16
+ raise ArgumentError, "Unknown palette type: #{type}"
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ module Strategy
7
+ class Base
8
+ def colorize(text, **kwargs)
9
+ raise NotImplementedError
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ module Strategy
7
+ class Basic < Base
8
+ def colorize(text, color: :default)
9
+ unless valid_color_code?(color)
10
+ raise ArgumentError, "Invalid color code"
11
+ end
12
+
13
+ "\e[#{color}m#{text}\e[0m"
14
+ end
15
+
16
+ private
17
+
18
+ def valid_color_code?(color_code)
19
+ color_code.is_a?(Integer) && color_code.between?(0, 255)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ module Strategy
7
+ class Rgb < Base
8
+ def colorize(text, **kwargs)
9
+ r, g, b = kwargs.values_at(:r, :g, :b)
10
+
11
+ unless valid_rgb?(r, g, b)
12
+ raise ArgumentError, "RGB values must be integers between 0 and 255"
13
+ end
14
+
15
+ "\e[38;2;#{r};#{g};#{b}m#{text}\e[0m"
16
+ end
17
+
18
+ private
19
+
20
+ def valid_rgb?(r, g, b)
21
+ [r, g, b].all? { |value| value.is_a?(Integer) && value.between?(0, 255) }
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ module Strategy
7
+ class Theme < Base
8
+ def initialize(palette)
9
+ super()
10
+ @palette = palette
11
+ end
12
+
13
+ def colorize(text, color: :default)
14
+ unless @palette.colors.key?(color)
15
+ raise ArgumentError, "Invalid color key"
16
+ end
17
+
18
+ color_code = @palette.colors[color]
19
+
20
+ unless valid_color_code?(color_code)
21
+ raise ArgumentError, "Invalid color code"
22
+ end
23
+
24
+ "\e[#{color_code}m#{text}\e[0m"
25
+ end
26
+
27
+ private
28
+
29
+ def valid_color_code?(color_code)
30
+ color_code.is_a?(Integer) && color_code.between?(0, 255)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ module Strategy
7
+ require_relative "strategy/base"
8
+ require_relative "strategy/basic"
9
+ require_relative "strategy/rgb"
10
+ require_relative "strategy/theme"
11
+
12
+ class << self
13
+ def create(type, palette: nil)
14
+ case type
15
+ when :basic
16
+ Basic.new
17
+ when :rgb
18
+ Rgb.new
19
+ when :theme
20
+ raise ArgumentError, "Palette is required for theme strategy" unless palette
21
+
22
+ Theme.new(palette)
23
+ else
24
+ raise ArgumentError, "Unknown strategy type: #{type}"
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Color
6
+ require_relative "color/colorizer"
7
+ require_relative "color/palette"
8
+ require_relative "color/strategy"
9
+ require_relative "color/config"
10
+ end
11
+ end
12
+ end
@@ -3,8 +3,12 @@
3
3
  module DevSuite
4
4
  module Utils
5
5
  module Table
6
- module Column
7
- require_relative "column/column"
6
+ class Column
7
+ attr_reader :name
8
+
9
+ def initialize(name)
10
+ @name = name
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -17,8 +17,32 @@ module DevSuite
17
17
  },
18
18
  }.freeze
19
19
 
20
- def initialize(custom_settings = {})
21
- @settings = deep_merge(DEFAULTS, custom_settings)
20
+ attr_reader :settings
21
+
22
+ def initialize(settings = {})
23
+ @settings = deep_merge(DEFAULTS, settings)
24
+ end
25
+
26
+ class << self
27
+ #
28
+ # Provide global access to a single instance of Config
29
+ #
30
+ def configuration
31
+ @configuration ||= new
32
+ end
33
+
34
+ # Allow block-based configuration
35
+ def configure
36
+ yield(configuration)
37
+ rescue StandardError => e
38
+ handle_configuration_error(e)
39
+ end
40
+
41
+ private
42
+
43
+ def handle_configuration_error(error)
44
+ puts "Configuration error: #{error.message}"
45
+ end
22
46
  end
23
47
 
24
48
  def color_for(key)
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Table
6
+ module Formatter
7
+ require_relative "formatter/column_width_calculator"
8
+ require_relative "formatter/text_aligner"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "base"
4
- require_relative "../formatter/text_aligner"
5
- require_relative "../formatter/column_width_calculator"
6
- require_relative "../formatter/colorizer"
7
-
8
3
  module DevSuite
9
4
  module Utils
10
5
  module Table
@@ -35,7 +30,7 @@ module DevSuite
35
30
  # Colorizes the given string with the specified color
36
31
  #
37
32
  def colorize(str, color)
38
- Formatter::Colorizer.colorize(str, color)
33
+ Utils::Color.colorize(str, color: color)
39
34
  end
40
35
 
41
36
  #
@@ -3,8 +3,12 @@
3
3
  module DevSuite
4
4
  module Utils
5
5
  module Table
6
- module Row
7
- require_relative "row/row"
6
+ class Row
7
+ attr_reader :data
8
+
9
+ def initialize(data)
10
+ @data = data
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "column/column"
4
- require_relative "row/row"
5
- require_relative "renderer"
6
- require_relative "config"
7
-
8
3
  module DevSuite
9
4
  module Utils
10
5
  module Table
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DevSuite
4
+ module Utils
5
+ module Table
6
+ require_relative "table/table"
7
+ require_relative "table/column"
8
+ require_relative "table/row"
9
+ require_relative "table/config"
10
+ require_relative "table/formatter"
11
+ require_relative "table/renderer"
12
+ end
13
+ end
14
+ end
@@ -2,8 +2,7 @@
2
2
 
3
3
  module DevSuite
4
4
  module Utils
5
- require_relative "utils/table/table"
6
- require_relative "utils/table/config"
7
- require_relative "utils/table/renderer/simple"
5
+ require_relative "utils/color"
6
+ require_relative "utils/table"
8
7
  end
9
8
  end
@@ -1,3 +1,3 @@
1
1
  module DevSuite
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/dev_suite.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dev_suite/version"
4
+ require "dev_suite/utils"
4
5
  require "dev_suite/performance"
6
+ require "dev_suite/directory_tree"
5
7
 
6
8
  module DevSuite
7
9
  class Error < StandardError; end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_suite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Huy Nguyen
@@ -61,6 +61,16 @@ files:
61
61
  - bin/setup
62
62
  - dev_suite.gemspec
63
63
  - lib/dev_suite.rb
64
+ - lib/dev_suite/directory_tree.rb
65
+ - lib/dev_suite/directory_tree/node.rb
66
+ - lib/dev_suite/directory_tree/node/base.rb
67
+ - lib/dev_suite/directory_tree/node/directory.rb
68
+ - lib/dev_suite/directory_tree/node/file.rb
69
+ - lib/dev_suite/directory_tree/node/permission_denied.rb
70
+ - lib/dev_suite/directory_tree/renderer.rb
71
+ - lib/dev_suite/directory_tree/renderer/base.rb
72
+ - lib/dev_suite/directory_tree/renderer/simple.rb
73
+ - lib/dev_suite/directory_tree/visualizer.rb
64
74
  - lib/dev_suite/performance.rb
65
75
  - lib/dev_suite/performance/analyzer.rb
66
76
  - lib/dev_suite/performance/data.rb
@@ -73,17 +83,27 @@ files:
73
83
  - lib/dev_suite/performance/reportor/base.rb
74
84
  - lib/dev_suite/performance/reportor/simple.rb
75
85
  - lib/dev_suite/utils.rb
86
+ - lib/dev_suite/utils/color.rb
87
+ - lib/dev_suite/utils/color/colorizer.rb
88
+ - lib/dev_suite/utils/color/config.rb
89
+ - lib/dev_suite/utils/color/palette.rb
90
+ - lib/dev_suite/utils/color/palette/base.rb
91
+ - lib/dev_suite/utils/color/palette/default.rb
92
+ - lib/dev_suite/utils/color/strategy.rb
93
+ - lib/dev_suite/utils/color/strategy/base.rb
94
+ - lib/dev_suite/utils/color/strategy/basic.rb
95
+ - lib/dev_suite/utils/color/strategy/rgb.rb
96
+ - lib/dev_suite/utils/color/strategy/theme.rb
97
+ - lib/dev_suite/utils/table.rb
76
98
  - lib/dev_suite/utils/table/column.rb
77
- - lib/dev_suite/utils/table/column/column.rb
78
99
  - lib/dev_suite/utils/table/config.rb
79
- - lib/dev_suite/utils/table/formatter/colorizer.rb
100
+ - lib/dev_suite/utils/table/formatter.rb
80
101
  - lib/dev_suite/utils/table/formatter/column_width_calculator.rb
81
102
  - lib/dev_suite/utils/table/formatter/text_aligner.rb
82
103
  - lib/dev_suite/utils/table/renderer.rb
83
104
  - lib/dev_suite/utils/table/renderer/base.rb
84
105
  - lib/dev_suite/utils/table/renderer/simple.rb
85
106
  - lib/dev_suite/utils/table/row.rb
86
- - lib/dev_suite/utils/table/row/row.rb
87
107
  - lib/dev_suite/utils/table/table.rb
88
108
  - lib/dev_suite/version.rb
89
109
  homepage: https://patrick204nqh.github.io
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module Utils
5
- module Table
6
- module Formatter
7
- class Colorizer
8
- COLORS = {
9
- red: 31,
10
- green: 32,
11
- yellow: 33,
12
- blue: 34,
13
- magenta: 35,
14
- cyan: 36,
15
- white: 37,
16
- default: 39,
17
- }.freeze
18
-
19
- class << self
20
- def code_for(color)
21
- COLORS[color] || COLORS[:default]
22
- end
23
-
24
- def colorize(text, color = :default)
25
- color_code = code_for(color)
26
- "\e[#{color_code}m#{text}\e[0m"
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DevSuite
4
- module Utils
5
- module Table
6
- class Row
7
- attr_reader :data
8
-
9
- def initialize(data)
10
- @data = data
11
- end
12
- end
13
- end
14
- end
15
- end