active_interaction_mapper 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/Gemfile +1 -1
- data/README.md +53 -4
- data/active_interaction_mapper.gemspec +2 -1
- data/lib/active_interaction_mapper/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04df9c268dba3ec70903f55e79c1c2192ea5b48e56c54efe90151236163ba8ec
|
4
|
+
data.tar.gz: 0b52c77f0a6f2ad1f8fef6d0110c48019e736a80e4e15f528009dc5250f3444d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1948eb450ee1077ac2ad496d04010dd918ac3061f464258fa535bf103bb28137bc23ac6388d508698ba99095dc8db7590a56541afa135acf93ab72826197dd01
|
7
|
+
data.tar.gz: 4cae1c962e177c00f828a0423f2bc254106d013774750b14a3f380aac925396730b2e9192d5bad0a65e5f293ba1034e329a23cacf79262cf0de9aff90a1f1da9
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# ActiveInteractionMapper
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
This gem allows the tracking of ActiveInteractions interactions.
|
4
|
+
This is done by tracking the .execute methode that is overridden in each class inheriting from ActiveInteraction.
|
5
|
+
To be able to trace function calls, I used Ruby's TracePoint class and to draw the graphs I used the 'ruby-graphviz' gem.
|
6
|
+
Note that you need to install GraphViz in your environment and have its path in your path environment variable to be able to draw graphs.
|
6
7
|
|
7
8
|
## Installation
|
8
9
|
|
@@ -20,9 +21,57 @@ Or install it yourself as:
|
|
20
21
|
|
21
22
|
$ gem install active_interaction_mapper
|
22
23
|
|
24
|
+
Note: You also need to install the gem : [ruby-graphviz](https://rubygems.org/gems/ruby-graphviz/) and install [graphviz](https://graphviz.org/download/) in your environment.
|
25
|
+
|
23
26
|
## Usage
|
24
27
|
|
25
|
-
|
28
|
+
Generating a graph and outputting as text to STDOUT:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
ActiveInteractionMapper.trace(output_image: false) do
|
32
|
+
# Code to trace
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
You can choose to output your result as a png as follows:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
ActiveInteractionMapper.trace(output_image: true, folder_name:'', file_name:'') do
|
40
|
+
# Code to trace
|
41
|
+
end
|
42
|
+
```
|
43
|
+
By default, the files are generated in the tmp folder.
|
44
|
+
If the folder_name and file_name are left empty, the code will create a directory and a file using the current date and time.
|
45
|
+
|
46
|
+
You can also choose where the graph should start by using the start_at argument with the full name of the interaction you want to start at.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
ActiveInteractionMapper.trace(output_image: true, folder_name:'', file_name:'', start_at: 'ActiveInteractionA') do
|
50
|
+
# Code to trace
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
Here's an example of a code I worked on. It runs an interaction in an Rspec test and puts the graph in the directory 'tmp/spec/.../test_file_name' and in a file with the name of the test running and the date it was run at.
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
require 'active_interaction_mapper'
|
58
|
+
|
59
|
+
RSpec.describe Test do
|
60
|
+
|
61
|
+
around do |example|
|
62
|
+
path = example.metadata[:example_group][:file_path]
|
63
|
+
ActiveInteractionMapper.trace(folder_name: path.split('.')[1], file_name: example.metadata[:description]) do
|
64
|
+
example.call
|
65
|
+
end
|
66
|
+
end
|
67
|
+
it "does something useful" do
|
68
|
+
outcome = Test::ActiveInteractionA.run()
|
69
|
+
expect(outcome.result).to eq(true)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
|
26
75
|
|
27
76
|
## Development
|
28
77
|
|
@@ -33,7 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
35
|
# Uncomment to register a new dependency of your gem
|
36
|
-
|
36
|
+
spec.add_dependency 'ruby-graphviz', '~> 1.2.5'
|
37
|
+
|
37
38
|
|
38
39
|
# For more information and examples about making a new gem, checkout our
|
39
40
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_interaction_mapper
|
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
|
- charbel-elhajj
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
12
|
-
dependencies:
|
11
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruby-graphviz
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.5
|
13
27
|
description: |
|
14
28
|
This gem allows the tracking of ActiveInteractions interactions.
|
15
29
|
|