taski 0.5.0 → 0.7.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/README.md +40 -21
- data/docs/GUIDE.md +340 -0
- data/examples/README.md +65 -17
- data/examples/{context_demo.rb → args_demo.rb} +27 -27
- data/examples/clean_demo.rb +204 -0
- data/examples/group_demo.rb +113 -0
- data/examples/reexecution_demo.rb +93 -80
- data/examples/system_call_demo.rb +56 -0
- data/lib/taski/{context.rb → args.rb} +3 -3
- data/lib/taski/execution/execution_context.rb +379 -0
- data/lib/taski/execution/executor.rb +408 -117
- data/lib/taski/execution/registry.rb +17 -1
- data/lib/taski/execution/scheduler.rb +308 -0
- data/lib/taski/execution/task_output_pipe.rb +42 -0
- data/lib/taski/execution/task_output_router.rb +216 -0
- data/lib/taski/execution/task_wrapper.rb +210 -40
- data/lib/taski/execution/tree_progress_display.rb +385 -98
- data/lib/taski/execution/worker_pool.rb +104 -0
- data/lib/taski/section.rb +16 -3
- data/lib/taski/task.rb +222 -36
- data/lib/taski/version.rb +1 -1
- data/lib/taski.rb +138 -23
- data/sig/taski.rbs +207 -27
- metadata +13 -7
- data/docs/advanced-features.md +0 -625
- data/docs/api-guide.md +0 -509
- data/docs/error-handling.md +0 -684
- data/examples/section_progress_demo.rb +0 -78
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require_relative "../lib/taski"
|
|
5
|
-
|
|
6
|
-
# Demo for tree-based progress display with Section
|
|
7
|
-
# Run with: ruby examples/section_progress_demo.rb
|
|
8
|
-
|
|
9
|
-
# Database Section with multiple impl candidates
|
|
10
|
-
class DatabaseSection < Taski::Section
|
|
11
|
-
interfaces :connection_string
|
|
12
|
-
|
|
13
|
-
def impl
|
|
14
|
-
if ENV["USE_PROD_DB"] == "1"
|
|
15
|
-
ProductionDB
|
|
16
|
-
else
|
|
17
|
-
DevelopmentDB
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
class ProductionDB < Taski::Task
|
|
22
|
-
def run
|
|
23
|
-
puts "Connecting to production database..."
|
|
24
|
-
sleep(0.3)
|
|
25
|
-
@connection_string = "postgresql://prod-server:5432/myapp"
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
class DevelopmentDB < Taski::Task
|
|
30
|
-
def run
|
|
31
|
-
puts "Connecting to development database..."
|
|
32
|
-
sleep(0.2)
|
|
33
|
-
@connection_string = "postgresql://localhost:5432/myapp_dev"
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# Simple task that uses the database
|
|
39
|
-
class FetchData < Taski::Task
|
|
40
|
-
exports :data
|
|
41
|
-
|
|
42
|
-
def run
|
|
43
|
-
db = DatabaseSection.connection_string
|
|
44
|
-
puts "Fetching data from #{db}..."
|
|
45
|
-
sleep(0.3)
|
|
46
|
-
@data = ["item1", "item2", "item3"]
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# Main application task
|
|
51
|
-
class Application < Taski::Task
|
|
52
|
-
exports :result
|
|
53
|
-
|
|
54
|
-
def run
|
|
55
|
-
data = FetchData.data
|
|
56
|
-
puts "Processing #{data.size} items..."
|
|
57
|
-
sleep(0.2)
|
|
58
|
-
@result = "Processed: #{data.join(", ")}"
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# Show tree structure before execution
|
|
63
|
-
puts "Task Tree Structure:"
|
|
64
|
-
puts "=" * 60
|
|
65
|
-
puts Application.tree
|
|
66
|
-
puts "=" * 60
|
|
67
|
-
puts
|
|
68
|
-
|
|
69
|
-
# Reset for execution
|
|
70
|
-
Application.reset!
|
|
71
|
-
|
|
72
|
-
# Execute
|
|
73
|
-
result = Application.result
|
|
74
|
-
|
|
75
|
-
puts "\n"
|
|
76
|
-
puts "=" * 60
|
|
77
|
-
puts "Execution completed!"
|
|
78
|
-
puts "Result: #{result}"
|