caixanegra 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: fd21dec4c184b88b2898d5f011eb9e7288562c28f2204db0a6e85cca004153de
4
- data.tar.gz: 49b39b216ac37609aa921ece85a263de64a7e932082d80761388e41d5c5eaf3d
3
+ metadata.gz: 4296a7a3ef7cd55657a83b6fd6f4cf9389c8ba731a539191a6e6c16e853b6848
4
+ data.tar.gz: 8805ae26d4cbb6a37c98a22b5fba5b11a3f14a88de9fa685d313bfc58d22e4ed
5
5
  SHA512:
6
- metadata.gz: 8dcad855ae35dc5241379f3f4acc574ec4b0204877cea2d8770a08cf9774ffe7257f0a873ac0e067048ea432ee4c2689c94afea393aecd94942764b42ea67e06
7
- data.tar.gz: a636a4d03ab305b54464f2003488fdb21f756f3876f4899da6b026b53e6f3326a4909a860ec7cb3390eecb68530e9070c44ed794a9fa484fbf25dbd35411d424
6
+ metadata.gz: c866e8d7614824e7a82bd8fe26dc0a434be293a6e317142169724c24a00f5c60b7e4ff804836053a0f75a865f6df1943464ae5c5dbfad8c2500ce31ea820b306
7
+ data.tar.gz: 0d12dc642122961304bb47ec2840560e6da603f83c575b8e3e0604e5527743a54ce43c950ca372763018658da8f9a9ba2a06e88da6a31bb62bb18e45e128e7e3
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2021 sergiorribeiro
1
+ Copyright 2023 sergiorribeiro
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,18 +1,69 @@
1
1
  # caixanegra
2
2
  ![Gem](https://img.shields.io/gem/v/caixanegra?logo=ruby&logoColor=red)
3
3
 
4
- ## Getting Started
4
+ An unopinionated flow oriented blackbox designer, executor and debugger to interface your service classes and allow users to manipulate or completely redesign processes using your code.
5
5
 
6
+ # Installation
7
+ Add this line to your application's Gemfile:
6
8
 
9
+ ```ruby
10
+ gem 'caixanegra'
11
+ ```
7
12
 
13
+ or
8
14
 
15
+ ```
16
+ bundler add caixanegra
17
+ ```
18
+ # Getting Started
19
+ **caixanegra** implements a self-contained designer, which only requires Redis to be able to receive and report back flow descriptors.
20
+ To get started, the only thing you need is to point to your Redis instance and point which classes on your codebase should represent units.
9
21
 
22
+ First, mount the engine. Add the line below to `routes.rb` file:
10
23
 
11
- ## Installation
12
- Add this line to your application's Gemfile:
24
+ ```ruby
25
+ mount Caixanegra::Engine, at: "/caixanegra", as: :caixanegra
26
+ ```
27
+
28
+ Then, let's create a `caixanegra.rb` initializer (or any name you prefer)
13
29
 
14
30
  ```ruby
15
- gem 'caixanegra'
31
+ Caixanegra.setup do |config|
32
+ config.units = {
33
+ awesome_unit: Caixanegra::Units::AU,
34
+ another_awesome_unit: Some::Other::Namespace::AAU,
35
+ you_can_also: {
36
+ scope_units: Caixanegra::Units::ScopedUnit,
37
+ },
38
+ }
39
+ config.redis = Redis.new
40
+ end
41
+ ```
42
+
43
+ With the designer configured, you can use `Caixanegra::Manager` to handle the previously stored definition (or an empty one).
44
+ This will give you the UID that **caixanegra** designer will understand.
45
+
46
+ ```ruby
47
+ my_flow = somewhere.get_flow # get from your own persistence or transport solution
48
+ uid = Caixanegra::Manager.handler(my_flow || {})
16
49
  ```
17
- ## License
50
+
51
+ You can then safely navigate to the designer.
52
+
53
+ ```ruby
54
+ link_to "Some flow", "/caixanegra/design/#{@uid}?unit_scope=optional_scope", target: :blank
55
+ ```
56
+
57
+ Saved changes will update the flow definition on Redis, and you must then persist them. You can get the flow definition for any specified **caixanegra** handled UID:
58
+
59
+ ```ruby
60
+ updated_flow = Caixanegra::Manager.get(my_uid)
61
+ persist_flow(updated_flow) # your own persistence or transport solution. It's a JSON
62
+ ```
63
+
64
+ **NOTE:** There's currently no managed way to set callbacks on save actions from the designer. Working on it
65
+
66
+ Please, refer to [the wiki](https://github.com/sergiorribeiro/caixanegra/wiki) to get to know more about [creating your units](https://github.com/sergiorribeiro/caixanegra/wiki/Creating-units).
67
+
68
+ # License
18
69
  **caixanegra** is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -6,13 +6,13 @@ module Caixanegra
6
6
  self.units = []
7
7
 
8
8
  def self.setup(&block)
9
- yield self
9
+ yield self
10
10
  end
11
11
 
12
12
  class Engine < ::Rails::Engine
13
13
  isolate_namespace Caixanegra
14
14
 
15
- initializer "caixanegra.assets.precompile" do |app|
15
+ initializer 'caixanegra.assets.precompile' do |app|
16
16
  app.config.assets.precompile += %w[
17
17
  caixanegra/api.js
18
18
  caixanegra/caixanegra.js
@@ -27,7 +27,7 @@ module Caixanegra
27
27
  end
28
28
 
29
29
  def run_and_report_result
30
- log_console_entry "Started"
30
+ log_console_entry 'Started'
31
31
  set_start_unit
32
32
  format_result(flow_through)
33
33
  rescue Caixanegra::UnitScopedException => e
@@ -4,7 +4,7 @@ module Caixanegra
4
4
  class Manager
5
5
  class << self
6
6
  def handler(flow_definition = {})
7
- uid = SecureRandom.uuid.gsub("-", "")
7
+ uid = SecureRandom.uuid.gsub('-', '')
8
8
 
9
9
  Caixanegra.redis.multi do |pipeline|
10
10
  pipeline.hset(:caixanegra, uid, JSON.dump(flow_definition))
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Caixanegra
2
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
3
5
  end
data/lib/caixanegra.rb CHANGED
@@ -1,8 +1,9 @@
1
- require "caixanegra/exceptions"
2
- require "caixanegra/engine"
3
- require "caixanegra/version"
4
- require "caixanegra/executor"
5
- require "caixanegra/manager"
1
+ # frozen_string_literal: true
6
2
 
7
- module Caixanegra
8
- end
3
+ require 'caixanegra/exceptions'
4
+ require 'caixanegra/engine'
5
+ require 'caixanegra/version'
6
+ require 'caixanegra/executor'
7
+ require 'caixanegra/manager'
8
+
9
+ module Caixanegra ; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caixanegra
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
  - sergiorribeiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-08 00:00:00.000000000 Z
11
+ date: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,7 +38,8 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: TBD
41
+ description: An unopinionated, flow oriented blackbox designer and executor to interface
42
+ your service classes
42
43
  email:
43
44
  - sergio.r.ribeiro@live.com
44
45
  executables: []
@@ -73,11 +74,10 @@ files:
73
74
  - lib/caixanegra/manager.rb
74
75
  - lib/caixanegra/version.rb
75
76
  - lib/tasks/caixanegra_tasks.rake
76
- homepage: http://sergioribeiro.com
77
+ homepage: https://github.com/sergiorribeiro/caixanegra/wiki
77
78
  licenses:
78
79
  - MIT
79
- metadata:
80
- allowed_push_host: https://rubygems.org
80
+ metadata: {}
81
81
  post_install_message:
82
82
  rdoc_options: []
83
83
  require_paths:
@@ -96,5 +96,5 @@ requirements: []
96
96
  rubygems_version: 3.3.17
97
97
  signing_key:
98
98
  specification_version: 4
99
- summary: TBD
99
+ summary: Unopinionated flow oriented blackbox designer, executor and debugger
100
100
  test_files: []