appmap 0.26.1 → 0.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -3
- data/CHANGELOG.md +37 -0
- data/README.md +170 -29
- data/Rakefile +1 -1
- data/exe/appmap +3 -1
- data/lib/appmap.rb +56 -35
- data/lib/appmap/algorithm/stats.rb +2 -1
- data/lib/appmap/class_map.rb +21 -28
- data/lib/appmap/command/record.rb +2 -61
- data/lib/appmap/config.rb +89 -0
- data/lib/appmap/cucumber.rb +89 -0
- data/lib/appmap/event.rb +28 -19
- data/lib/appmap/hook.rb +56 -128
- data/lib/appmap/hook/method.rb +78 -0
- data/lib/appmap/metadata.rb +62 -0
- data/lib/appmap/middleware/remote_recording.rb +2 -6
- data/lib/appmap/minitest.rb +141 -0
- data/lib/appmap/rails/action_handler.rb +7 -7
- data/lib/appmap/rails/sql_handler.rb +10 -8
- data/lib/appmap/railtie.rb +2 -2
- data/lib/appmap/record.rb +27 -0
- data/lib/appmap/rspec.rb +20 -38
- data/lib/appmap/trace.rb +19 -11
- data/lib/appmap/util.rb +59 -0
- data/lib/appmap/version.rb +1 -1
- data/package-lock.json +3 -3
- data/spec/abstract_controller4_base_spec.rb +1 -1
- data/spec/abstract_controller_base_spec.rb +9 -2
- data/spec/config_spec.rb +3 -3
- data/spec/fixtures/hook/compare.rb +7 -0
- data/spec/fixtures/hook/singleton_method.rb +54 -0
- data/spec/fixtures/rails_users_app/Gemfile +1 -0
- data/spec/fixtures/rails_users_app/features/api_users.feature +13 -0
- data/spec/fixtures/rails_users_app/features/support/env.rb +4 -0
- data/spec/fixtures/rails_users_app/features/support/hooks.rb +11 -0
- data/spec/fixtures/rails_users_app/features/support/steps.rb +18 -0
- data/spec/hook_spec.rb +228 -53
- data/spec/rails_spec_helper.rb +2 -0
- data/spec/record_sql_rails_pg_spec.rb +56 -33
- data/spec/rspec_feature_metadata_spec.rb +2 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/util_spec.rb +21 -0
- data/test/cli_test.rb +4 -4
- data/test/cucumber_test.rb +72 -0
- data/test/fixtures/cucumber4_recorder/Gemfile +5 -0
- data/test/fixtures/cucumber4_recorder/appmap.yml +3 -0
- data/test/fixtures/cucumber4_recorder/features/say_hello.feature +5 -0
- data/test/fixtures/cucumber4_recorder/features/support/env.rb +5 -0
- data/test/fixtures/cucumber4_recorder/features/support/hooks.rb +11 -0
- data/test/fixtures/cucumber4_recorder/features/support/steps.rb +9 -0
- data/test/fixtures/cucumber4_recorder/lib/hello.rb +7 -0
- data/test/fixtures/cucumber_recorder/Gemfile +5 -0
- data/test/fixtures/cucumber_recorder/appmap.yml +3 -0
- data/test/fixtures/cucumber_recorder/features/say_hello.feature +5 -0
- data/test/fixtures/cucumber_recorder/features/support/env.rb +5 -0
- data/test/fixtures/cucumber_recorder/features/support/hooks.rb +11 -0
- data/test/fixtures/cucumber_recorder/features/support/steps.rb +9 -0
- data/test/fixtures/cucumber_recorder/lib/hello.rb +7 -0
- data/test/fixtures/minitest_recorder/Gemfile +5 -0
- data/test/fixtures/minitest_recorder/appmap.yml +3 -0
- data/test/fixtures/minitest_recorder/lib/hello.rb +5 -0
- data/test/fixtures/minitest_recorder/test/hello_test.rb +12 -0
- data/test/fixtures/process_recorder/appmap.yml +3 -0
- data/test/fixtures/process_recorder/hello.rb +9 -0
- data/test/minitest_test.rb +38 -0
- data/test/record_process_test.rb +35 -0
- data/test/test_helper.rb +1 -0
- metadata +39 -3
- data/spec/fixtures/hook/class_method.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6becd9530caf01e14b8a7db69e74b40297d41e4724f25315cd7b44ea6ad3e02
|
4
|
+
data.tar.gz: 2863e714f0651d73fc9f2f87d0ea2c5f9fb7f9f553d1f109d9d8f10fff35f5be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5574478fee68b2531449df2b9ec135a60110950cdcd518cf5b85d10e6d0d756b3e22740a4ce0905d7fccb2e6e7d684ee38ac61fd11ad6fdfcff4355a7ae7b36
|
7
|
+
data.tar.gz: d15827a809ffde6b6ff98bfb62057f759cdc03e7e24452c1a8273801f94e37d61bab265ddb863ce8f60d83c639875fcf2d247f27abe9b27164817f0739b7c699
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1
|
+
# v0.32.0
|
2
|
+
|
3
|
+
* Removes un-necessary fields from `return` events.
|
4
|
+
|
5
|
+
# v0.31.0
|
6
|
+
|
7
|
+
* Add the ability to hook methods by default, and optionally add labels to them in the
|
8
|
+
classmap. Use it to hook `ActiveSupport::SecurityUtils.secure_compare`.
|
9
|
+
|
10
|
+
# v0.30.0
|
11
|
+
|
12
|
+
* Add support for Minitest.
|
13
|
+
|
14
|
+
# v0.29.0
|
15
|
+
|
16
|
+
* Add `lib/appmap/record.rb`, which can be `require`d to record the rest of the process.
|
17
|
+
|
18
|
+
# v0.28.1
|
19
|
+
|
20
|
+
* Fix the `defined_class` recorded in an appmap for an instance method included in a class
|
21
|
+
at runtime.
|
22
|
+
* Only include the `static` attribute on `call` events in an appmap. Determine its value
|
23
|
+
based on the receiver of the method call.
|
24
|
+
|
25
|
+
# v0.28.0
|
26
|
+
|
27
|
+
* Change behavior of **AppMap.record** to return a complete AppMap as a Hash.
|
28
|
+
* Update README with information about recording Cucumber tests.
|
29
|
+
* **AppMap.initialize** automatically runs when `AppMap` is required, unless disabled
|
30
|
+
by environment variable `APPMAP_INITIALIZE=false`.
|
31
|
+
* **AppMap.hook** no longer takes a `configuration` argument.
|
32
|
+
* Add **AppMap::Util.scenario_filename**.
|
33
|
+
|
34
|
+
# v0.27.0
|
35
|
+
|
36
|
+
* Add **AppMap.record** to programatically record and capture an AppMap of a Ruby block.
|
37
|
+
|
1
38
|
# v0.26.1
|
2
39
|
|
3
40
|
* Fix a bug that caused duplicate entries in the list of frameworks that appear
|
data/README.md
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
- [About](#about)
|
2
|
-
- [Testing](#testing)
|
3
2
|
- [Installation](#installation)
|
4
3
|
- [Configuration](#configuration)
|
5
4
|
- [Running](#running)
|
6
5
|
- [RSpec](#rspec)
|
6
|
+
- [Minitest](#minitest)
|
7
|
+
- [Cucumber](#cucumber)
|
7
8
|
- [Remote recording](#remote-recording)
|
8
9
|
- [Ruby on Rails](#ruby-on-rails)
|
9
10
|
- [Uploading AppMaps](#uploading-appmaps)
|
11
|
+
- [Development](#development)
|
12
|
+
- [Running tests](#running-tests)
|
13
|
+
- [Using fixture apps](#using-fixture-apps)
|
14
|
+
- [`test/fixtures`](#testfixtures)
|
15
|
+
- [`spec/fixtures`](#specfixtures)
|
10
16
|
- [Build status](#build-status)
|
11
17
|
|
12
18
|
# About
|
13
19
|
|
14
20
|
`appmap-ruby` is a Ruby Gem for recording
|
15
|
-
[AppMaps](https://github.com/applandinc/appmap) of your code.
|
21
|
+
[AppMaps](https://github.com/applandinc/appmap) of your code.
|
16
22
|
"AppMap" is a data format which records code structure (modules, classes, and methods), code execution events
|
17
23
|
(function calls and returns), and code metadata (repo name, repo URL, commit
|
18
24
|
SHA, labels, etc). It's more granular than a performance profile, but it's less
|
@@ -22,26 +28,15 @@ There are several ways to record AppMaps of your Ruby program using the `appmap`
|
|
22
28
|
|
23
29
|
* Run your RSpec tests with the environment variable `APPMAP=true`. An AppMap will be generated for each spec.
|
24
30
|
* Run your application server with AppMap remote recording enabled, and use the AppMap.
|
25
|
-
browser extension to start, stop, and upload recordings.
|
31
|
+
browser extension to start, stop, and upload recordings.
|
26
32
|
* Run the command `appmap record <program>` to record the entire execution of a program.
|
27
33
|
|
28
34
|
Once you have recorded some AppMaps (for example, by running RSpec tests), you use the `appland upload` command
|
29
35
|
to upload them to the AppLand server. This command, and some others, is provided
|
30
|
-
by the [AppLand CLI](https://github.com/applandinc/appland-cli/releases)
|
36
|
+
by the [AppLand CLI](https://github.com/applandinc/appland-cli/releases).
|
31
37
|
Then, on the [AppLand website](https://app.land), you can
|
32
38
|
visualize the design of your code and share links with collaborators.
|
33
39
|
|
34
|
-
# Testing
|
35
|
-
Before running tests, configure `local.appmap` to point to your local `appmap-ruby` directory.
|
36
|
-
```
|
37
|
-
$ bundle config local.appmap $(pwd)
|
38
|
-
```
|
39
|
-
|
40
|
-
Run the tests via `rake`:
|
41
|
-
```
|
42
|
-
$ bundle exec rake test
|
43
|
-
```
|
44
|
-
|
45
40
|
# Installation
|
46
41
|
|
47
42
|
Add `gem 'appmap'` to your Gemfile just as you would any other dependency.
|
@@ -60,7 +55,7 @@ group :development, :test do
|
|
60
55
|
end
|
61
56
|
```
|
62
57
|
|
63
|
-
Then install with `bundle`.
|
58
|
+
Then install with `bundle`.
|
64
59
|
|
65
60
|
# Configuration
|
66
61
|
|
@@ -90,36 +85,37 @@ Each entry in the `packages` list is a YAML object which has the following keys:
|
|
90
85
|
|
91
86
|
## RSpec
|
92
87
|
|
93
|
-
To
|
88
|
+
To record RSpec tests, follow these additional steps:
|
94
89
|
|
95
|
-
1) Require `appmap/rspec` in your `spec_helper.rb
|
90
|
+
1) Require `appmap/rspec` in your `spec_helper.rb` before any other classes are loaded.
|
96
91
|
|
97
92
|
```ruby
|
98
93
|
require 'appmap/rspec'
|
99
94
|
```
|
100
95
|
|
101
|
-
|
96
|
+
Note that `spec_helper.rb` in a Rails project typically loads the application's classes this way:
|
102
97
|
|
103
98
|
```ruby
|
104
|
-
|
105
|
-
describe 'says hello' do
|
106
|
-
it 'when prompted' do
|
107
|
-
expect(Hello.new.say_hello).to eq('Hello!')
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
99
|
+
require File.expand_path("../../config/environment", __FILE__)
|
111
100
|
```
|
112
101
|
|
113
|
-
|
102
|
+
and `appmap/rspec` must be required before this:
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
require 'appmap/rspec'
|
106
|
+
require File.expand_path("../../config/environment", __FILE__)
|
107
|
+
```
|
108
|
+
|
109
|
+
2) *Optional* Add `feature: '<feature name>'` and `feature_group: '<feature group name>'` annotations to your
|
114
110
|
examples.
|
115
111
|
|
116
|
-
|
112
|
+
3) Run the tests with the environment variable `APPMAP=true`:
|
117
113
|
|
118
114
|
```sh-session
|
119
115
|
$ APPMAP=true bundle exec rspec -t appmap
|
120
116
|
```
|
121
117
|
|
122
|
-
Each RSpec test will output
|
118
|
+
Each RSpec test will output an AppMap file into the directory `tmp/appmap/rspec`. For example:
|
123
119
|
|
124
120
|
```
|
125
121
|
$ find tmp/appmap/rspec
|
@@ -143,6 +139,82 @@ If you include the `feature` and `feature_group` metadata, these attributes will
|
|
143
139
|
|
144
140
|
If you don't explicitly declare `feature` and `feature_group`, then they will be inferred from the spec name and example descriptions.
|
145
141
|
|
142
|
+
## Minitest
|
143
|
+
|
144
|
+
To record Minitest tests, follow these additional steps:
|
145
|
+
|
146
|
+
1) Require `appmap/minitest` in `test_helper.rb`
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
require 'appmap/minitest'
|
150
|
+
```
|
151
|
+
|
152
|
+
Note that `test_helper.rb` in a Rails project typically loads the application's classes this way:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
require_relative '../config/environment'
|
156
|
+
```
|
157
|
+
|
158
|
+
and `appmap/rspec` must be required before this:
|
159
|
+
|
160
|
+
```ruby
|
161
|
+
require 'appmap/rspec'
|
162
|
+
require_relative '../config/environment'
|
163
|
+
```
|
164
|
+
|
165
|
+
2) Run the tests with the environment variable `APPMAP=true`:
|
166
|
+
|
167
|
+
```sh-session
|
168
|
+
$ APPMAP=true bundle exec -Ilib -Itest test/*
|
169
|
+
```
|
170
|
+
|
171
|
+
Each Minitest test will output an AppMap file into the directory `tmp/appmap/minitest`. For example:
|
172
|
+
|
173
|
+
```
|
174
|
+
$ find tmp/appmap/minitest
|
175
|
+
Hello_says_hello_when_prompted.appmap.json
|
176
|
+
```
|
177
|
+
|
178
|
+
## Cucumber
|
179
|
+
|
180
|
+
To record Cucumber tests, follow these additional steps:
|
181
|
+
|
182
|
+
1) Require `appmap/cucumber` in `support/env.rb`:
|
183
|
+
|
184
|
+
```ruby
|
185
|
+
require 'appmap/cucumber'
|
186
|
+
```
|
187
|
+
|
188
|
+
Be sure to require it before `config/environment` is required.
|
189
|
+
|
190
|
+
2) Create an `Around` hook in `support/hooks.rb` to record the scenario:
|
191
|
+
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
if AppMap::Cucumber.enabled?
|
195
|
+
Around('not @appmap-disable') do |scenario, block|
|
196
|
+
appmap = AppMap.record do
|
197
|
+
block.call
|
198
|
+
end
|
199
|
+
|
200
|
+
AppMap::Cucumber.write_scenario(scenario, appmap)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
```
|
204
|
+
|
205
|
+
3) Run the tests with the environment variable `APPMAP=true`:
|
206
|
+
|
207
|
+
```sh-session
|
208
|
+
$ APPMAP=true bundle exec cucumber
|
209
|
+
```
|
210
|
+
|
211
|
+
Each Cucumber test will output an AppMap file into the directory `tmp/appmap/cucumber`. For example:
|
212
|
+
|
213
|
+
```
|
214
|
+
$ find tmp/appmap/cucumber
|
215
|
+
Hello_Says_hello_when_prompted.appmap.json
|
216
|
+
```
|
217
|
+
|
146
218
|
## Remote recording
|
147
219
|
|
148
220
|
To manually record ad-hoc AppMaps of your Ruby app, use AppMap remote recording.
|
@@ -183,5 +255,74 @@ Note that using this method is kind of a blunt instrument. Recording RSpecs and
|
|
183
255
|
|
184
256
|
For instructions on uploading, see the documentation of the [AppLand CLI](https://github.com/applandinc/appland-cli).
|
185
257
|
|
258
|
+
# Development
|
259
|
+
|
260
|
+
## Running tests
|
261
|
+
|
262
|
+
Before running tests, configure `local.appmap` to point to your local `appmap-ruby` directory.
|
263
|
+
```
|
264
|
+
$ bundle config local.appmap $(pwd)
|
265
|
+
```
|
266
|
+
|
267
|
+
Run the tests via `rake`:
|
268
|
+
```
|
269
|
+
$ bundle exec rake test
|
270
|
+
```
|
271
|
+
|
272
|
+
## Using fixture apps
|
273
|
+
|
274
|
+
### `test/fixtures`
|
275
|
+
|
276
|
+
The fixture apps in `test/fixtures` are plain Ruby projects that exercise the basic functionality of the
|
277
|
+
`appmap` gem. To develop in a fixture, simple enter the fixture directory and `bundle`.
|
278
|
+
|
279
|
+
### `spec/fixtures`
|
280
|
+
|
281
|
+
The fixture apps in `spec/fixtures` are simple Rack, Rails4, and Rails5 apps.
|
282
|
+
You can use them to interactively develop and test the recording features of the `appmap` gem.
|
283
|
+
These fixture apps are more sophisticated than `test/fixtures`, because they include additional
|
284
|
+
resources such as a PostgreSQL database.
|
285
|
+
|
286
|
+
To build the fixture container images, first run:
|
287
|
+
|
288
|
+
```sh-session
|
289
|
+
$ bundle exec rake fixtures:all
|
290
|
+
```
|
291
|
+
|
292
|
+
This will build the `appmap.gem`, along with a Docker image for each fixture app.
|
293
|
+
|
294
|
+
Then move to the directory of the fixture you want to use, and provision the environment.
|
295
|
+
In this example, we use Ruby 2.6.
|
296
|
+
|
297
|
+
```sh-session
|
298
|
+
$ export RUBY_VERSION=2.6
|
299
|
+
$ docker-compose up -d pg
|
300
|
+
$ sleep 10s # Or some reasonable amount of time
|
301
|
+
$ docker-compose run --rm app ./create_app
|
302
|
+
```
|
303
|
+
|
304
|
+
Now you can start a development container.
|
305
|
+
|
306
|
+
```sh-session
|
307
|
+
$ docker-compose run --rm -v $PWD/../../..:/src/appmap-ruby app bash
|
308
|
+
Starting rails_users_app_pg_1 ... done
|
309
|
+
root@6fab5f89125f:/app# cd /src/app
|
310
|
+
root@6fab5f89125f:/src/app# bundle config local.appmap /src/appmap-ruby
|
311
|
+
root@6fab5f89125f:/src/app# bundle update appmap
|
312
|
+
```
|
313
|
+
|
314
|
+
At this point, the bundle is built with the `appmap` gem located in `/src/appmap`, which is volume-mounted from the host.
|
315
|
+
So you can edit the fixture code and the appmap code and run test commands such as `rspec` and `cucumber` in the container.
|
316
|
+
For example:
|
317
|
+
|
318
|
+
```sh-session
|
319
|
+
root@6fab5f89125f:/src/app# bundle exec rspec
|
320
|
+
Configuring AppMap from path appmap.yml
|
321
|
+
....
|
322
|
+
|
323
|
+
Finished in 0.07357 seconds (files took 2.1 seconds to load)
|
324
|
+
4 examples, 0 failures
|
325
|
+
```
|
326
|
+
|
186
327
|
# Build status
|
187
328
|
[![Build Status](https://travis-ci.org/applandinc/appmap-ruby.svg?branch=master)](https://travis-ci.org/applandinc/appmap-ruby)
|
data/Rakefile
CHANGED
data/exe/appmap
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
|
4
4
|
require 'gli'
|
5
5
|
|
6
|
+
ENV['APPMAP_INITIALIZE'] = 'false'
|
7
|
+
|
6
8
|
require 'appmap'
|
7
9
|
require 'appmap/version'
|
8
10
|
|
@@ -136,7 +138,7 @@ module AppMap
|
|
136
138
|
protected
|
137
139
|
|
138
140
|
def interpret_config_option(fname)
|
139
|
-
AppMap.
|
141
|
+
AppMap.initialize fname
|
140
142
|
end
|
141
143
|
|
142
144
|
def interpret_output_file_option(file_name)
|
data/lib/appmap.rb
CHANGED
@@ -8,60 +8,81 @@ rescue NameError
|
|
8
8
|
end
|
9
9
|
|
10
10
|
require 'appmap/version'
|
11
|
+
require 'appmap/hook'
|
12
|
+
require 'appmap/config'
|
13
|
+
require 'appmap/trace'
|
14
|
+
require 'appmap/class_map'
|
15
|
+
require 'appmap/metadata'
|
16
|
+
require 'appmap/util'
|
11
17
|
|
12
18
|
module AppMap
|
13
|
-
BATCH_HEADER_NAME = 'AppLand-Scenario-Batch'
|
14
|
-
|
15
19
|
class << self
|
16
|
-
@
|
17
|
-
@
|
20
|
+
@configuration = nil
|
21
|
+
@configuration_file_path = nil
|
18
22
|
|
19
|
-
# configuration gets the
|
23
|
+
# configuration gets the configuration. If there is no configuration, the default
|
24
|
+
# configuration is initialized.
|
20
25
|
def configuration
|
21
|
-
|
22
|
-
|
23
|
-
@config
|
26
|
+
@configuration ||= configure
|
24
27
|
end
|
25
28
|
|
26
|
-
#
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
def configure(config_file_path = 'appmap.yml')
|
31
|
-
if @config
|
32
|
-
return @config if @config_file_path == config_file_path
|
33
|
-
|
34
|
-
raise "AppMap is already configured from #{@config_file_path}, can't reconfigure from #{config_file_path}"
|
35
|
-
end
|
29
|
+
# configuration= sets the configuration. This is only expected to happen once per
|
30
|
+
# Ruby process.
|
31
|
+
def configuration=(config)
|
32
|
+
warn 'AppMap is already configured' if @configuration && config
|
36
33
|
|
37
|
-
|
38
|
-
require 'appmap/hook'
|
39
|
-
AppMap::Hook::Config.load_from_file(config_file_path).tap do |config|
|
40
|
-
@config = config
|
41
|
-
@config_file_path = config_file_path
|
42
|
-
end
|
34
|
+
@configuration = config
|
43
35
|
end
|
44
36
|
|
45
|
-
#
|
37
|
+
# initialize configures AppMap for recording. Default behavior is to configure from "appmap.yml".
|
38
|
+
# This method also activates the code hooks which record function calls as trace events.
|
46
39
|
# Call this function before the program code is loaded by the Ruby VM, otherwise
|
47
40
|
# the load events won't be seen and the hooks won't activate.
|
48
|
-
def
|
49
|
-
|
50
|
-
|
41
|
+
def initialize(config_file_path = 'appmap.yml')
|
42
|
+
warn "Configuring AppMap from path #{config_file_path}"
|
43
|
+
self.configuration = Config.load_from_file(config_file_path)
|
44
|
+
Hook.new(configuration).enable
|
51
45
|
end
|
52
46
|
|
53
|
-
#
|
47
|
+
# tracing can be used to start tracing, stop tracing, and record events.
|
54
48
|
def tracing
|
55
|
-
|
56
|
-
|
49
|
+
@tracing ||= Trace::Tracing.new
|
50
|
+
end
|
51
|
+
|
52
|
+
# record records the events which occur while processing a block,
|
53
|
+
# and returns an AppMap as a Hash.
|
54
|
+
def record
|
55
|
+
tracer = tracing.trace
|
56
|
+
begin
|
57
|
+
yield
|
58
|
+
ensure
|
59
|
+
tracing.delete(tracer)
|
60
|
+
end
|
61
|
+
|
62
|
+
events = [].tap do |event_list|
|
63
|
+
event_list << tracer.next_event.to_h while tracer.event?
|
64
|
+
end
|
65
|
+
{
|
66
|
+
'version' => AppMap::APPMAP_FORMAT_VERSION,
|
67
|
+
'metadata' => detect_metadata,
|
68
|
+
'classMap' => class_map(tracer.event_methods),
|
69
|
+
'events' => events
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
# class_map builds a class map from a config and a list of Ruby methods.
|
74
|
+
def class_map(methods)
|
75
|
+
ClassMap.build_from_methods(configuration, methods)
|
57
76
|
end
|
58
77
|
|
59
|
-
#
|
60
|
-
|
61
|
-
|
62
|
-
|
78
|
+
# detect_metadata returns default metadata detected from the Ruby system and from the
|
79
|
+
# filesystem.
|
80
|
+
def detect_metadata
|
81
|
+
@metadata ||= Metadata.detect.freeze
|
82
|
+
@metadata.deep_dup
|
63
83
|
end
|
64
84
|
end
|
65
85
|
end
|
66
86
|
|
67
87
|
require 'appmap/railtie' if defined?(::Rails::Railtie)
|
88
|
+
AppMap.initialize unless ENV['APPMAP_INITIALIZE'] == 'false'
|