aasm-vis 0.1.1 → 0.1.3
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/README.md +43 -0
- data/aasm-vis.gemspec +2 -5
- data/lib/aasm/vis/version.rb +1 -1
- data/lib/aasm/vis.rb +0 -5
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4273c8cdcd2c48874d413838a90680f0cfa0a01ea706e10f3c657e0270856f47
|
4
|
+
data.tar.gz: 739e683166d0804ec22572acbc4150f4931320da30087e071b057cb8824a00cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 621a4e398453d5524fa12c70b42c1e0a91887da11463c3b2c70d59b5823b2cd2e8d4b2e87b554ca1d021ec7f9cea05fc3dca278abec2b9223cba8e6fdf97f0f8
|
7
|
+
data.tar.gz: e50f1b9d8d56b4a24dc2e450c42791d8040122ba84bfd0ab91a44d8dd0871456033104f610e5755e3814c32a2986dc160781fe309efd817df388118a19de783d
|
data/README.md
CHANGED
@@ -12,6 +12,49 @@ Add `gem 'aasm-vis', group: :development` to your `Gemfile` and run `bundle`.
|
|
12
12
|
|
13
13
|
To visualise the results you can use the [github cli](https://cli.github.com/): `gh gist create tmp/assm-vis.md` or any other tool that can render markdown files supporting mermaid.
|
14
14
|
|
15
|
+
## Example
|
16
|
+
|
17
|
+
The following ruby code defines a simple state machine for a `Job` model:
|
18
|
+
```ruby
|
19
|
+
class Job < ApplicationRecord
|
20
|
+
include AASM
|
21
|
+
|
22
|
+
aasm :state do
|
23
|
+
state :created, initial: true
|
24
|
+
state :running
|
25
|
+
state :finished_successfully
|
26
|
+
state :finished_with_error
|
27
|
+
|
28
|
+
event :run, after: :notify_somebody do
|
29
|
+
transitions from: :created, to: :running
|
30
|
+
transitions from: :running, to: :finished_with_error
|
31
|
+
transitions from: :running, to: :finished_successfully
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
It will generate the following mermaid diagram:
|
38
|
+
|
39
|
+
```mermaid
|
40
|
+
---
|
41
|
+
title: Job#state
|
42
|
+
---
|
43
|
+
stateDiagram-v2
|
44
|
+
|
45
|
+
created : Created
|
46
|
+
running : Running
|
47
|
+
finished_successfully : Finished successfully
|
48
|
+
finished_with_error : Finished with error
|
49
|
+
|
50
|
+
[*] --> created
|
51
|
+
created --> running
|
52
|
+
running --> finished_with_error
|
53
|
+
running --> finished_successfully
|
54
|
+
|
55
|
+
finished_with_error --> [*]
|
56
|
+
finished_successfully --> [*]
|
57
|
+
```
|
15
58
|
|
16
59
|
## Development
|
17
60
|
|
data/aasm-vis.gemspec
CHANGED
@@ -32,9 +32,6 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
|
-
|
36
|
-
#
|
37
|
-
|
38
|
-
# For more information and examples about making a new gem, check out our
|
39
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
35
|
+
spec.add_dependency "aasm", "~> 5"
|
36
|
+
# TODO: add rails or railties or rake?
|
40
37
|
end
|
data/lib/aasm/vis/version.rb
CHANGED
data/lib/aasm/vis.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aasm-vis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kamil Gwóźdź
|
@@ -9,7 +9,21 @@ autorequire:
|
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-07-18 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aasm
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5'
|
13
27
|
description: Gem for visualising https://github.com/aasm/aasm state machines using
|
14
28
|
markdown and https://github.com/mermaid-js/mermaid.
|
15
29
|
email:
|