aasm-vis 0.1.1 → 0.1.3

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: 11920e9448b638133c2046027a26b757952cb1fe520e9c403b3555ef1511f4fd
4
- data.tar.gz: 9346db77906aee7d178070df116b0b80cf0f66d710e0edfd3be91f30a439f726
3
+ metadata.gz: 4273c8cdcd2c48874d413838a90680f0cfa0a01ea706e10f3c657e0270856f47
4
+ data.tar.gz: 739e683166d0804ec22572acbc4150f4931320da30087e071b057cb8824a00cc
5
5
  SHA512:
6
- metadata.gz: 3bfb6f306b4d1077c5c0440021b2ab0ed2613024e2524dfd89e5d970e463c2029e0028c3cb0344211939cc87b1d8bef3631b0f948471e385fb414e9c062dcc74
7
- data.tar.gz: 5822cec22a72e374c2df4cf237cc9d36cd0a71ccd9f714f1210bd554a9feb253ab52c0478a72f76b799cc934d0893517212b1787a54a89c4a0409f3c6f91d61a
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
- # Uncomment to register a new dependency of your gem
36
- # spec.add_dependency "example-gem", "~> 1.0"
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AASM
4
4
  module Vis
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
data/lib/aasm/vis.rb CHANGED
@@ -26,11 +26,6 @@ module AASM
26
26
  end
27
27
  end
28
28
 
29
-
30
-
31
-
32
-
33
-
34
29
  results << <<~TXT
35
30
  ```mermaid
36
31
  ---
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.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: