stateoscope 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +15 -2
- data/CHANGELOG.md +23 -0
- data/README.md +48 -7
- data/Rakefile +3 -3
- data/bin/console +4 -4
- data/lib/stateoscope.rb +20 -7
- data/lib/stateoscope/adapter.rb +21 -0
- data/lib/stateoscope/{integrations → adapter}/aasm.rb +31 -20
- data/lib/stateoscope/adapter/base.rb +26 -0
- data/lib/stateoscope/adapter_registry.rb +26 -0
- data/lib/stateoscope/core_ext.rb +1 -0
- data/lib/stateoscope/core_ext/class.rb +6 -0
- data/lib/stateoscope/errors.rb +6 -0
- data/lib/stateoscope/graph.rb +8 -8
- data/lib/stateoscope/version.rb +1 -1
- data/lib/stateoscope/visualizer.rb +9 -16
- data/lib/tasks/stateoscope.rake +5 -4
- data/stateoscope.gemspec +17 -13
- metadata +69 -8
- data/lib/stateoscope/integrations.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 34c359ee93ffc4709384af57c9c6efb8c97c2fa736f3a94ede2e7dc7ad6ca8fa
|
4
|
+
data.tar.gz: f7f704ffaee3bda3a75734ecb5b1f5ccacfbacf824f2642f68e33328258d2718
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c88971ae8bf8291d08dc1a54ce992d157e196c614751ca744a4f4fe701f2125ad7fc0735e43de47bc5c7524a6dfa22f27ea6bb1d156e8d731bb6db46ba397ad2
|
7
|
+
data.tar.gz: 775982abd2df2c36cd14178396b89425e14f6ec4b3f1fdf8ac0ae9b3d969c4ba0f2b49f9109bf8a34131ea1b1024c4ab41d1b78bf2790f8b168de00c6ea636e0
|
data/.travis.yml
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
|
3
|
+
- 2.4.5
|
4
|
+
- 2.5.3
|
5
|
+
env:
|
6
|
+
global:
|
7
|
+
- CC_TEST_REPORTER_ID=9302884ead7bad6d1cc81026ba78b5cd8551024643cf14c72fe2d42eaaef36e6
|
8
|
+
before_install:
|
9
|
+
- gem update --system
|
10
|
+
- gem install bundler
|
11
|
+
before_script:
|
12
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
13
|
+
- chmod +x ./cc-test-reporter
|
14
|
+
- ./cc-test-reporter before-build
|
15
|
+
after_script:
|
16
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
17
|
+
cache: bundler
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# v0.1.2 (04.04.2019)
|
2
|
+
|
3
|
+
Features:
|
4
|
+
|
5
|
+
- add ability to mark current state
|
6
|
+
- add ability to specify output format
|
7
|
+
- add ability to specify output directory
|
8
|
+
|
9
|
+
Bugfixes:
|
10
|
+
|
11
|
+
- dependency updates
|
12
|
+
|
13
|
+
|
14
|
+
# v0.1.1 (07.10.2015)
|
15
|
+
|
16
|
+
Bugfixes:
|
17
|
+
|
18
|
+
- fixed timestamp in generated filename
|
19
|
+
|
20
|
+
|
21
|
+
# v0.1.0 (07.10.2015)
|
22
|
+
|
23
|
+
Initial release
|
data/README.md
CHANGED
@@ -1,20 +1,38 @@
|
|
1
1
|
# Stateoscope
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/padde/stateoscope.svg)](https://travis-ci.org/padde/stateoscope)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/padde/stateoscope/badges/gpa.svg)](https://codeclimate.com/github/padde/stateoscope)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/padde/stateoscope/badges/coverage.svg)](https://codeclimate.com/github/padde/stateoscope/coverage)
|
6
|
+
[![Inline docs](http://inch-ci.org/github/padde/stateoscope.svg?branch=master)](http://inch-ci.org/github/padde/stateoscope)
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/stateoscope.svg)](https://badge.fury.io/rb/stateoscope)
|
8
|
+
[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/stateoscope)
|
9
|
+
|
3
10
|
Visualize State Machines using GraphViz
|
4
11
|
|
12
|
+
## External Dependencies
|
13
|
+
|
14
|
+
Stateoscope depends on [GraphViz](http://www.graphviz.org/) for generating the
|
15
|
+
graphs. You need to make sure that GraphViz is properly installed on your system
|
16
|
+
before you will be able to generate graphs. If you are on a Mac, you can install
|
17
|
+
GraphViz via [Homebrew](http://brew.sh/)
|
18
|
+
|
19
|
+
```
|
20
|
+
$ brew install graphviz
|
21
|
+
```
|
22
|
+
|
5
23
|
## Installation
|
6
24
|
|
7
25
|
Add this line to your application's Gemfile:
|
8
26
|
|
9
27
|
```ruby
|
10
|
-
gem 'stateoscope'
|
28
|
+
gem 'stateoscope', '~> 0.1.2', group: :development
|
11
29
|
```
|
12
30
|
|
13
31
|
And then execute:
|
14
32
|
|
15
33
|
$ bundle
|
16
34
|
|
17
|
-
##
|
35
|
+
## Using the rake task
|
18
36
|
|
19
37
|
To generate a state machine visualization for your `Model`, run
|
20
38
|
|
@@ -29,14 +47,38 @@ of the state machine as second parameter
|
|
29
47
|
rake 'stateoscope:visualize[Model,specific_state_machine]'
|
30
48
|
```
|
31
49
|
|
32
|
-
|
50
|
+
If you want to highlight a specific state of your state machine, add the name as a third argument.
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
rake 'stateoscope:visualize[Order,order_state,delivered]'
|
54
|
+
```
|
55
|
+
|
56
|
+
In any case, a PDF file containing the graph visualization will be saved to
|
33
57
|
the current directory.
|
34
58
|
|
35
|
-
##
|
59
|
+
## Using Stateoscope directly
|
60
|
+
|
61
|
+
Stateoscope exposes a `visualize` method that allows for a more fine-grained and dynamic usage.
|
62
|
+
|
63
|
+
Example:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
filename = Stateoscope.visualize(
|
67
|
+
Order,
|
68
|
+
state_machine_name: "order_state",
|
69
|
+
current_state: "delivered",
|
70
|
+
dir: Rails.root.join("public"), # default current directory
|
71
|
+
format: "png" # default "pdf", possible are all formats that GraphViz supports
|
72
|
+
)
|
73
|
+
|
74
|
+
# filename will be for example RAILS_ROOT/public/order_state-20191201145422.png
|
75
|
+
```
|
36
76
|
|
37
|
-
|
77
|
+
## Adapters
|
38
78
|
|
39
|
-
|
79
|
+
Stateoscope ships with adapters for the following state machine gems:
|
80
|
+
|
81
|
+
- [AASM](https://github.com/aasm/aasm)
|
40
82
|
|
41
83
|
## Development
|
42
84
|
|
@@ -47,4 +89,3 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
47
89
|
## Contributing
|
48
90
|
|
49
91
|
Bug reports and pull requests are welcome on GitHub at https://github.com/padde/stateoscope.
|
50
|
-
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'stateoscope'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require
|
10
|
+
# require 'pry'
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/lib/stateoscope.rb
CHANGED
@@ -1,18 +1,31 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_support/core_ext'
|
3
|
+
|
4
|
+
require 'stateoscope/core_ext'
|
1
5
|
require 'stateoscope/version'
|
2
|
-
require 'stateoscope/
|
6
|
+
require 'stateoscope/errors'
|
7
|
+
require 'stateoscope/adapter'
|
3
8
|
require 'stateoscope/visualizer'
|
4
9
|
|
5
10
|
require 'stateoscope/railtie' if defined?(Rails)
|
6
11
|
|
7
12
|
module Stateoscope
|
8
13
|
def self.visualize(klass, options = {})
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
Visualizer.new(
|
14
|
+
adapter = Adapter.new_for(klass, options[:state_machine_name])
|
15
|
+
adapter.build_graph
|
16
|
+
|
17
|
+
visualizer = Visualizer.new(adapter.graph)
|
18
|
+
visualizer.parse_graph(options[:current_state])
|
19
|
+
|
20
|
+
output_format = options.fetch(:format, 'pdf')
|
21
|
+
filename = filename_for(adapter, output_format)
|
22
|
+
filename = File.join(options[:dir], filename) if options[:dir].present?
|
23
|
+
|
24
|
+
visualizer.output(filename, output_format)
|
25
|
+
filename
|
13
26
|
end
|
14
27
|
|
15
|
-
def self.filename_for(
|
16
|
-
"#{
|
28
|
+
def self.filename_for(adapter, output_format)
|
29
|
+
"#{adapter.full_state_machine_name}-#{Time.now.utc.strftime('%Y%m%d%H%M%S')}.#{output_format}"
|
17
30
|
end
|
18
31
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'stateoscope/adapter_registry'
|
2
|
+
|
3
|
+
module Stateoscope
|
4
|
+
module Adapter
|
5
|
+
mattr_accessor :registry
|
6
|
+
|
7
|
+
self.registry = AdapterRegistry.new
|
8
|
+
|
9
|
+
def self.register(adapter)
|
10
|
+
registry.register(adapter)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.new_for(klass, state_machine_name)
|
14
|
+
adapter = registry.find!(klass, state_machine_name)
|
15
|
+
adapter.new(klass, state_machine_name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'stateoscope/adapter/base'
|
21
|
+
require 'stateoscope/adapter/aasm'
|
@@ -1,29 +1,20 @@
|
|
1
1
|
module Stateoscope
|
2
|
-
module
|
3
|
-
class AASM <
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
graph.initial_state = state_machine.initial_state.to_s
|
8
|
-
|
9
|
-
state_machine.states.each do |state|
|
10
|
-
graph.add_state(state.name.to_s)
|
11
|
-
end
|
12
|
-
|
13
|
-
state_machine.events.each do |event|
|
14
|
-
event.transitions.each do |transition|
|
15
|
-
graph.add_transition(transition.from.to_s, transition.to.to_s, event.name.to_s)
|
16
|
-
end
|
17
|
-
end
|
2
|
+
module Adapter
|
3
|
+
class AASM < Base
|
4
|
+
def self.handle?(klass, _state_machine_name)
|
5
|
+
klass.inherits_from?('::AASM')
|
6
|
+
end
|
18
7
|
|
8
|
+
def build_graph
|
9
|
+
add_initial_state
|
10
|
+
add_states
|
11
|
+
add_transitions
|
19
12
|
graph.detect_final_states!
|
20
|
-
|
21
|
-
graph
|
22
13
|
end
|
23
14
|
|
24
15
|
def full_state_machine_name
|
25
16
|
[
|
26
|
-
|
17
|
+
'aasm',
|
27
18
|
klass.name,
|
28
19
|
state_machine_name
|
29
20
|
].compact.join('-').dasherize
|
@@ -32,8 +23,28 @@ module Stateoscope
|
|
32
23
|
private
|
33
24
|
|
34
25
|
def state_machine
|
35
|
-
klass.
|
26
|
+
klass.aasm(state_machine_name.presence)
|
27
|
+
end
|
28
|
+
|
29
|
+
def add_initial_state
|
30
|
+
graph.initial_state = state_machine.initial_state.to_s
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_states
|
34
|
+
state_machine.states.each do |state|
|
35
|
+
graph.add_state(state.name.to_s)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_transitions
|
40
|
+
state_machine.events.each do |event|
|
41
|
+
event.transitions.each do |transition|
|
42
|
+
graph.add_transition(transition.from.to_s, transition.to.to_s, event.name.to_s)
|
43
|
+
end
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
47
|
+
|
48
|
+
register ::Stateoscope::Adapter::AASM
|
38
49
|
end
|
39
50
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'stateoscope/graph'
|
2
|
+
|
3
|
+
module Stateoscope
|
4
|
+
module Adapter
|
5
|
+
class Base
|
6
|
+
attr_accessor :klass, :state_machine_name, :graph
|
7
|
+
def self.handle?(_klass, _state_machine_name)
|
8
|
+
fail AbstractMethodError
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(klass, state_machine_name)
|
12
|
+
self.klass = klass
|
13
|
+
self.state_machine_name = state_machine_name
|
14
|
+
self.graph = Graph.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def build_graph
|
18
|
+
fail AbstractMethodError
|
19
|
+
end
|
20
|
+
|
21
|
+
def full_state_machine_name
|
22
|
+
fail AbstractMethodError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Stateoscope
|
2
|
+
AdapterRegistry = Struct.new(:adapters) do
|
3
|
+
def initialize
|
4
|
+
self.adapters = []
|
5
|
+
end
|
6
|
+
|
7
|
+
def register(adapter)
|
8
|
+
adapters << adapter
|
9
|
+
end
|
10
|
+
|
11
|
+
def find(klass, state_machine_name)
|
12
|
+
adapters.find do |adapter|
|
13
|
+
adapter.handle?(klass, state_machine_name)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def find!(klass, state_machine_name)
|
18
|
+
adapter = find(klass, state_machine_name)
|
19
|
+
if adapter
|
20
|
+
adapter
|
21
|
+
else
|
22
|
+
fail MissingAdapterError, 'unsupported state machine implementation'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'stateoscope/core_ext/class'
|
data/lib/stateoscope/graph.rb
CHANGED
@@ -5,25 +5,25 @@ module Stateoscope
|
|
5
5
|
attr_accessor :initial_state, :states, :final_states, :transitions
|
6
6
|
|
7
7
|
def initialize
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
self.states = []
|
9
|
+
self.final_states = []
|
10
|
+
self.transitions = []
|
11
11
|
end
|
12
12
|
|
13
13
|
def add_state(state)
|
14
|
-
|
14
|
+
states << state
|
15
15
|
end
|
16
16
|
|
17
|
-
def add_transition(from, to, event)
|
18
|
-
|
17
|
+
def add_transition(from, to, event = nil)
|
18
|
+
transitions << OpenStruct.new(from: from, to: to, event: event)
|
19
19
|
end
|
20
20
|
|
21
21
|
def detect_final_states!
|
22
|
-
|
22
|
+
self.final_states = states - transitions.map(&:from)
|
23
23
|
end
|
24
24
|
|
25
25
|
def final_state?(state)
|
26
|
-
|
26
|
+
final_states.include?(state)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/lib/stateoscope/version.rb
CHANGED
@@ -1,40 +1,33 @@
|
|
1
1
|
require 'ruby-graphviz'
|
2
2
|
|
3
3
|
module Stateoscope
|
4
|
-
|
5
|
-
def
|
6
|
-
super
|
7
|
-
parse_graph!
|
8
|
-
end
|
9
|
-
|
10
|
-
def parse_graph!
|
4
|
+
Visualizer = Struct.new(:graph) do
|
5
|
+
def parse_graph(current_state)
|
11
6
|
@viz = GraphViz.new(:G, type: 'digraph')
|
12
7
|
add_entry_point
|
13
|
-
add_states
|
8
|
+
add_states(current_state)
|
14
9
|
add_entry_point_transition
|
15
10
|
add_state_transitions
|
16
11
|
end
|
17
12
|
|
18
|
-
def output(filename)
|
19
|
-
@viz.output(
|
13
|
+
def output(filename, output_format)
|
14
|
+
@viz.output(output_format => filename)
|
20
15
|
end
|
21
16
|
|
22
17
|
private
|
23
18
|
|
24
19
|
ENTRY_POINT = '__ENTRY_POINT__'
|
25
20
|
|
26
|
-
def filename
|
27
|
-
"#{integration.name}-#{state_machine_name}-#{Time.now.utc.strftime('%Y%m%d%H%M%S')}"
|
28
|
-
end
|
29
|
-
|
30
21
|
def add_entry_point
|
31
22
|
return unless graph.initial_state
|
32
23
|
add_node(ENTRY_POINT, shape: 'circle', label: '', style: 'filled', color: 'black', fixedsize: true, width: 0.3)
|
33
24
|
end
|
34
25
|
|
35
|
-
def add_states
|
26
|
+
def add_states(current_state)
|
36
27
|
graph.states.each do |state|
|
37
|
-
|
28
|
+
options = { peripheries: graph.final_state?(state) ? 2 : 1 }
|
29
|
+
options[:color] = 'green' if state == current_state
|
30
|
+
add_node(state, options)
|
38
31
|
end
|
39
32
|
end
|
40
33
|
|
data/lib/tasks/stateoscope.rake
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
namespace :stateoscope do
|
2
2
|
desc 'visualize state machine for a given class'
|
3
|
-
task :visualize, [
|
4
|
-
|
5
|
-
klass = args
|
6
|
-
|
3
|
+
task :visualize, %i[class state_machine_name current_state] => :environment do |_, args|
|
4
|
+
args = args.to_hash
|
5
|
+
klass = args.delete(:class)
|
6
|
+
raise ArgumentError, 'missing required argument <class>' if klass.blank?
|
7
|
+
Stateoscope.visualize(klass.classify.constantize, args)
|
7
8
|
end
|
8
9
|
end
|
data/stateoscope.gemspec
CHANGED
@@ -4,24 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'stateoscope/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'stateoscope'
|
8
8
|
spec.version = Stateoscope::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Patrick Oscity']
|
10
|
+
spec.email = ['patrick.oscity@gmail.com']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
12
|
+
spec.summary = 'State Machine Visualizer'
|
13
|
+
spec.description = 'Visualize State Machines using GraphViz'
|
14
|
+
spec.homepage = 'https://github.com/padde/stateoscope'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_dependency
|
22
|
+
spec.add_dependency 'activesupport'
|
23
|
+
spec.add_dependency 'ruby-graphviz'
|
23
24
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
25
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'timecop'
|
29
|
+
spec.add_development_dependency 'simplecov'
|
30
|
+
spec.add_development_dependency 'pry'
|
27
31
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stateoscope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Oscity
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: ruby-graphviz
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -30,14 +44,14 @@ dependencies:
|
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '2.0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '2.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -54,6 +68,48 @@ dependencies:
|
|
54
68
|
version: '10.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: timecop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
57
113
|
requirement: !ruby/object:Gem::Requirement
|
58
114
|
requirements:
|
59
115
|
- - ">="
|
@@ -76,6 +132,7 @@ files:
|
|
76
132
|
- ".gitignore"
|
77
133
|
- ".rspec"
|
78
134
|
- ".travis.yml"
|
135
|
+
- CHANGELOG.md
|
79
136
|
- Gemfile
|
80
137
|
- LICENSE.txt
|
81
138
|
- README.md
|
@@ -83,9 +140,14 @@ files:
|
|
83
140
|
- bin/console
|
84
141
|
- bin/setup
|
85
142
|
- lib/stateoscope.rb
|
143
|
+
- lib/stateoscope/adapter.rb
|
144
|
+
- lib/stateoscope/adapter/aasm.rb
|
145
|
+
- lib/stateoscope/adapter/base.rb
|
146
|
+
- lib/stateoscope/adapter_registry.rb
|
147
|
+
- lib/stateoscope/core_ext.rb
|
148
|
+
- lib/stateoscope/core_ext/class.rb
|
149
|
+
- lib/stateoscope/errors.rb
|
86
150
|
- lib/stateoscope/graph.rb
|
87
|
-
- lib/stateoscope/integrations.rb
|
88
|
-
- lib/stateoscope/integrations/aasm.rb
|
89
151
|
- lib/stateoscope/railtie.rb
|
90
152
|
- lib/stateoscope/version.rb
|
91
153
|
- lib/stateoscope/visualizer.rb
|
@@ -110,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
172
|
- !ruby/object:Gem::Version
|
111
173
|
version: '0'
|
112
174
|
requirements: []
|
113
|
-
|
114
|
-
rubygems_version: 2.4.5
|
175
|
+
rubygems_version: 3.0.3
|
115
176
|
signing_key:
|
116
177
|
specification_version: 4
|
117
178
|
summary: State Machine Visualizer
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'stateoscope/graph'
|
2
|
-
require 'stateoscope/integrations/aasm'
|
3
|
-
|
4
|
-
module Stateoscope
|
5
|
-
module Integrations
|
6
|
-
def self.new_for(klass, state_machine_name)
|
7
|
-
if klass.ancestors.include?(::AASM)
|
8
|
-
::Stateoscope::Integrations::AASM.new(klass, state_machine_name)
|
9
|
-
else
|
10
|
-
fail NotImplementedError, "unsupported state machine implementation"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|