pipeline_gem 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 980929d5143f5f854c35ba6b940308715ea711db9bb3b23458876d9390d19ab9
4
+ data.tar.gz: 9340c0c8bc7addce7b2a17810f1e1439b3baf56b806cca02bb3ccbff7635225b
5
+ SHA512:
6
+ metadata.gz: 1ab604490764760d0ed3afaf5602a568086c4ff51f209f995f5156cc120007dd30410c5e82fcfe8d59e949b586bad982dba47834ee09f62407da15fd433c04cb
7
+ data.tar.gz: aa2b2ed1843f272d9019c8676ecfa184f8c87d5ab035c2f0ca31a61867c8d17e2c00f238b4ce0233ad9ddfb939e82914663ac8475733b18dfffa06152c4c1c9c
@@ -0,0 +1,20 @@
1
+ module PipelineGem
2
+ class Pipeline
3
+ def initialize(context = {})
4
+ @context = context
5
+ end
6
+
7
+ def stages
8
+ ObjectSpace.each_object(Class)
9
+ .select { |klass| klass < PipelineGem::Stage }
10
+ .sort_by { |klass| klass::PRIORITY }
11
+ .map(&:new)
12
+ end
13
+
14
+ def run
15
+ stages.each do |stage|
16
+ stage.execute(@context)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ module PipelineGem
2
+ class Stage
3
+ def pre_actions(context); end
4
+ def run(context); end
5
+ def post_actions(context); end
6
+
7
+ def execute(context)
8
+ pre_actions(context)
9
+ run(context)
10
+ post_actions(context)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ module PipelineGem
2
+ end
3
+
4
+ require_relative "pipeline_gem/stage"
5
+ require_relative "pipeline_gem/pipeline"
6
+
7
+ # Auto-load all stage files
8
+ Dir[File.join(__dir__, "stages", "*.rb")].sort.each do |file|
9
+ require file
10
+ end
@@ -0,0 +1,18 @@
1
+ module PipelineGem
2
+ class Fetch < Stage
3
+ PRIORITY = 1
4
+
5
+ def pre_actions(context)
6
+ puts "Fetch: pre_actions"
7
+ end
8
+
9
+ def run(context)
10
+ puts "Fetch: run"
11
+ context[:data] = "raw data"
12
+ end
13
+
14
+ def post_actions(context)
15
+ puts "Fetch: post_actions"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module PipelineGem
2
+ class Load < Stage
3
+ PRIORITY = 2
4
+
5
+ def pre_actions(context)
6
+ puts "Load: pre_actions"
7
+ end
8
+
9
+ def run(context)
10
+ puts "Load: run"
11
+ context[:data] = context[:data].upcase
12
+ end
13
+
14
+ def post_actions(context)
15
+ puts "Load: post_actions"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module PipelineGem
2
+ class Report < Stage
3
+ PRIORITY = 5
4
+
5
+ def pre_actions(context)
6
+ puts "Report: pre_actions"
7
+ end
8
+
9
+ def run(context)
10
+ puts "Report: run"
11
+ puts "Final context: #{context}"
12
+ end
13
+
14
+ def post_actions(context)
15
+ puts "Report: post_actions"
16
+ end
17
+ end
18
+ end
data/lib/stages/run.rb ADDED
@@ -0,0 +1,18 @@
1
+ module PipelineGem
2
+ class Run < Stage
3
+ PRIORITY = 3
4
+
5
+ def pre_actions(context)
6
+ puts "Run: pre_actions"
7
+ end
8
+
9
+ def run(context)
10
+ puts "Run: run"
11
+ context[:result] = context[:data].length
12
+ end
13
+
14
+ def post_actions(context)
15
+ puts "Run: post_actions"
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ module PipelineGem
2
+ class Update < Stage
3
+ PRIORITY = 4
4
+
5
+ def pre_actions(context)
6
+ puts "Update: pre_actions"
7
+ end
8
+
9
+ def run(context)
10
+ puts "Update: run"
11
+ context[:updated] = true
12
+ end
13
+
14
+ def post_actions(context)
15
+ puts "Update: post_actions"
16
+ end
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pipeline_gem
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Narayana
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-12-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A Ruby pipeline framework with automatic stage discovery and priority-based
14
+ execution.
15
+ email:
16
+ - nchikkam@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/pipeline_gem.rb
22
+ - lib/pipeline_gem/pipeline.rb
23
+ - lib/pipeline_gem/stage.rb
24
+ - lib/stages/fetch.rb
25
+ - lib/stages/load.rb
26
+ - lib/stages/report.rb
27
+ - lib/stages/run.rb
28
+ - lib/stages/update.rb
29
+ homepage: https://github.com/nchikkam/pipeline_gem
30
+ licenses:
31
+ - MIT
32
+ metadata:
33
+ source_code_uri: https://github.com/nchikkam/pipeline_gem
34
+ changelog_uri: https://github.com/nchikkam/pipeline_gem/blob/main/CHANGELOG.md
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubygems_version: 3.0.8
51
+ signing_key:
52
+ specification_version: 4
53
+ summary: Pipeline pattern with dynamic stages
54
+ test_files: []