caixanegra 0.1.0 → 0.1.1
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/MIT-LICENSE +1 -1
- data/README.md +56 -5
- data/lib/caixanegra/engine.rb +2 -2
- data/lib/caixanegra/executor.rb +1 -1
- data/lib/caixanegra/manager.rb +1 -1
- data/lib/caixanegra/version.rb +3 -1
- data/lib/caixanegra.rb +8 -7
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4296a7a3ef7cd55657a83b6fd6f4cf9389c8ba731a539191a6e6c16e853b6848
|
4
|
+
data.tar.gz: 8805ae26d4cbb6a37c98a22b5fba5b11a3f14a88de9fa685d313bfc58d22e4ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c866e8d7614824e7a82bd8fe26dc0a434be293a6e317142169724c24a00f5c60b7e4ff804836053a0f75a865f6df1943464ae5c5dbfad8c2500ce31ea820b306
|
7
|
+
data.tar.gz: 0d12dc642122961304bb47ec2840560e6da603f83c575b8e3e0604e5527743a54ce43c950ca372763018658da8f9a9ba2a06e88da6a31bb62bb18e45e128e7e3
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,18 +1,69 @@
|
|
1
1
|
# caixanegra
|
2
2
|

|
3
3
|
|
4
|
-
|
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
|
-
|
12
|
-
|
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
|
-
|
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
|
-
|
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).
|
data/lib/caixanegra/engine.rb
CHANGED
@@ -6,13 +6,13 @@ module Caixanegra
|
|
6
6
|
self.units = []
|
7
7
|
|
8
8
|
def self.setup(&block)
|
9
|
-
|
9
|
+
yield self
|
10
10
|
end
|
11
11
|
|
12
12
|
class Engine < ::Rails::Engine
|
13
13
|
isolate_namespace Caixanegra
|
14
14
|
|
15
|
-
initializer
|
15
|
+
initializer 'caixanegra.assets.precompile' do |app|
|
16
16
|
app.config.assets.precompile += %w[
|
17
17
|
caixanegra/api.js
|
18
18
|
caixanegra/caixanegra.js
|
data/lib/caixanegra/executor.rb
CHANGED
data/lib/caixanegra/manager.rb
CHANGED
@@ -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))
|
data/lib/caixanegra/version.rb
CHANGED
data/lib/caixanegra.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
|
2
|
-
require "caixanegra/engine"
|
3
|
-
require "caixanegra/version"
|
4
|
-
require "caixanegra/executor"
|
5
|
-
require "caixanegra/manager"
|
1
|
+
# frozen_string_literal: true
|
6
2
|
|
7
|
-
|
8
|
-
|
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.
|
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-
|
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:
|
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:
|
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:
|
99
|
+
summary: Unopinionated flow oriented blackbox designer, executor and debugger
|
100
100
|
test_files: []
|