taski 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Taski
4
+ module Utils
5
+ # Helper module for tree display functionality
6
+ # Provides common logic for displaying dependency trees
7
+ module TreeDisplayHelper
8
+ private
9
+
10
+ # Render dependencies as tree structure
11
+ # @param dependencies [Array] Array of dependency objects
12
+ # @param prefix [String] Current indentation prefix
13
+ # @param visited [Set] Set of visited classes
14
+ # @param color [Boolean] Whether to use color output
15
+ # @return [String] Formatted dependency tree string
16
+ def render_dependencies_tree(dependencies, prefix, visited, color)
17
+ result = ""
18
+
19
+ dependencies = dependencies.uniq { |dep| extract_class(dep) }
20
+ dependencies.each_with_index do |dep, index|
21
+ dep_class = extract_class(dep)
22
+ is_last = index == dependencies.length - 1
23
+
24
+ connector_text = is_last ? "└── " : "├── "
25
+ connector = color ? TreeColors.connector(connector_text) : connector_text
26
+ child_prefix_text = is_last ? " " : "│ "
27
+ child_prefix = prefix + (color ? TreeColors.connector(child_prefix_text) : child_prefix_text)
28
+
29
+ # For the dependency itself, we want to use the connector
30
+ # For its children, we want to use the child_prefix
31
+ dep_tree = if dep_class.respond_to?(:tree)
32
+ dep_class.tree(child_prefix, visited, color: color)
33
+ else
34
+ "#{child_prefix}#{dep_class.name}\n"
35
+ end
36
+
37
+ # Replace the first line (which has child_prefix) with the proper connector
38
+ dep_lines = dep_tree.lines
39
+ if dep_lines.any?
40
+ # Replace the first line prefix with connector
41
+ first_line = dep_lines[0]
42
+ fixed_first_line = first_line.sub(/^#{Regexp.escape(child_prefix)}/, prefix + connector)
43
+ result += fixed_first_line
44
+ # Add the rest of the lines as-is
45
+ result += dep_lines[1..].join if dep_lines.length > 1
46
+ else
47
+ dep_name = color ? TreeColors.task(dep_class.name) : dep_class.name
48
+ result += "#{prefix}#{connector}#{dep_name}\n"
49
+ end
50
+ end
51
+
52
+ result
53
+ end
54
+
55
+ # Check for circular dependencies and handle visited set
56
+ # @param visited [Set] Set of visited classes
57
+ # @param current_class [Class] Current class being processed
58
+ # @param prefix [String] Current indentation prefix
59
+ # @return [Array] Returns [should_return_early, result_string, new_visited_set]
60
+ def handle_circular_dependency_check(visited, current_class, prefix)
61
+ if visited.include?(current_class)
62
+ return [true, "#{prefix}#{current_class.name} (circular)\n", visited]
63
+ end
64
+
65
+ new_visited = visited.dup
66
+ new_visited << current_class
67
+ [false, nil, new_visited]
68
+ end
69
+ end
70
+ end
71
+ end
data/lib/taski/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Taski
4
- VERSION = "0.2.2"
4
+ VERSION = "0.3.0"
5
5
  end
data/lib/taski.rb CHANGED
@@ -10,6 +10,7 @@ require_relative "taski/progress_display"
10
10
  require_relative "taski/reference"
11
11
  require_relative "taski/dependency_analyzer"
12
12
  require_relative "taski/utils"
13
+ require_relative "taski/tree_colors"
13
14
 
14
15
  # Load Task class components
15
16
  require_relative "taski/task/base"
@@ -18,6 +19,9 @@ require_relative "taski/task/define_api"
18
19
  require_relative "taski/task/instance_management"
19
20
  require_relative "taski/task/dependency_resolver"
20
21
 
22
+ # Load Section class
23
+ require_relative "taski/section"
24
+
21
25
  module Taski
22
26
  # Main module for the Taski task framework
23
27
  #
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taski
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ahogappa
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-06-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: prism
@@ -43,19 +43,36 @@ files:
43
43
  - examples/advanced_patterns.rb
44
44
  - examples/progress_demo.rb
45
45
  - examples/quick_start.rb
46
+ - examples/section_configuration.rb
46
47
  - examples/tree_demo.rb
47
48
  - lib/taski.rb
48
49
  - lib/taski/dependency_analyzer.rb
49
50
  - lib/taski/exceptions.rb
50
51
  - lib/taski/logger.rb
52
+ - lib/taski/logging/formatter_factory.rb
53
+ - lib/taski/logging/formatter_interface.rb
54
+ - lib/taski/logging/json_formatter.rb
55
+ - lib/taski/logging/simple_formatter.rb
56
+ - lib/taski/logging/structured_formatter.rb
57
+ - lib/taski/progress/display_colors.rb
58
+ - lib/taski/progress/display_manager.rb
59
+ - lib/taski/progress/output_capture.rb
60
+ - lib/taski/progress/spinner_animation.rb
61
+ - lib/taski/progress/task_formatter.rb
62
+ - lib/taski/progress/task_status.rb
63
+ - lib/taski/progress/terminal_controller.rb
51
64
  - lib/taski/progress_display.rb
52
65
  - lib/taski/reference.rb
66
+ - lib/taski/section.rb
53
67
  - lib/taski/task/base.rb
54
68
  - lib/taski/task/define_api.rb
55
69
  - lib/taski/task/dependency_resolver.rb
56
70
  - lib/taski/task/exports_api.rb
57
71
  - lib/taski/task/instance_management.rb
72
+ - lib/taski/tree_colors.rb
58
73
  - lib/taski/utils.rb
74
+ - lib/taski/utils/dependency_resolver_helper.rb
75
+ - lib/taski/utils/tree_display_helper.rb
59
76
  - lib/taski/version.rb
60
77
  - sig/taski.rbs
61
78
  homepage: https://github.com/ahogappa/taski
@@ -78,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
95
  - !ruby/object:Gem::Version
79
96
  version: '0'
80
97
  requirements: []
81
- rubygems_version: 3.6.2
98
+ rubygems_version: 3.6.7
82
99
  specification_version: 4
83
100
  summary: A simple yet powerful Ruby task runner with static dependency resolution
84
101
  (in development).