appmap 0.27.0 → 0.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -3
  3. data/CHANGELOG.md +37 -0
  4. data/README.md +170 -29
  5. data/Rakefile +1 -1
  6. data/appmap.gemspec +1 -0
  7. data/exe/appmap +3 -1
  8. data/lib/appmap.rb +54 -38
  9. data/lib/appmap/algorithm/stats.rb +2 -1
  10. data/lib/appmap/class_map.rb +21 -28
  11. data/lib/appmap/command/record.rb +2 -61
  12. data/lib/appmap/config.rb +89 -0
  13. data/lib/appmap/cucumber.rb +89 -0
  14. data/lib/appmap/event.rb +28 -19
  15. data/lib/appmap/hook.rb +56 -128
  16. data/lib/appmap/hook/method.rb +78 -0
  17. data/lib/appmap/metadata.rb +62 -0
  18. data/lib/appmap/middleware/remote_recording.rb +2 -6
  19. data/lib/appmap/minitest.rb +141 -0
  20. data/lib/appmap/open.rb +57 -0
  21. data/lib/appmap/rails/action_handler.rb +7 -7
  22. data/lib/appmap/rails/sql_handler.rb +10 -8
  23. data/lib/appmap/railtie.rb +2 -2
  24. data/lib/appmap/record.rb +27 -0
  25. data/lib/appmap/rspec.rb +9 -37
  26. data/lib/appmap/trace.rb +18 -10
  27. data/lib/appmap/util.rb +59 -0
  28. data/lib/appmap/version.rb +1 -1
  29. data/package-lock.json +3 -3
  30. data/spec/abstract_controller4_base_spec.rb +1 -1
  31. data/spec/abstract_controller_base_spec.rb +9 -2
  32. data/spec/config_spec.rb +3 -3
  33. data/spec/fixtures/hook/compare.rb +7 -0
  34. data/spec/fixtures/hook/singleton_method.rb +54 -0
  35. data/spec/fixtures/rails_users_app/Gemfile +1 -0
  36. data/spec/fixtures/rails_users_app/features/api_users.feature +13 -0
  37. data/spec/fixtures/rails_users_app/features/support/env.rb +4 -0
  38. data/spec/fixtures/rails_users_app/features/support/hooks.rb +11 -0
  39. data/spec/fixtures/rails_users_app/features/support/steps.rb +18 -0
  40. data/spec/hook_spec.rb +228 -53
  41. data/spec/open_spec.rb +19 -0
  42. data/spec/rails_spec_helper.rb +2 -0
  43. data/spec/record_sql_rails_pg_spec.rb +56 -33
  44. data/spec/rspec_feature_metadata_spec.rb +2 -0
  45. data/spec/spec_helper.rb +4 -0
  46. data/spec/util_spec.rb +21 -0
  47. data/test/cli_test.rb +4 -4
  48. data/test/cucumber_test.rb +72 -0
  49. data/test/fixtures/cucumber4_recorder/Gemfile +5 -0
  50. data/test/fixtures/cucumber4_recorder/appmap.yml +3 -0
  51. data/test/fixtures/cucumber4_recorder/features/say_hello.feature +5 -0
  52. data/test/fixtures/cucumber4_recorder/features/support/env.rb +5 -0
  53. data/test/fixtures/cucumber4_recorder/features/support/hooks.rb +11 -0
  54. data/test/fixtures/cucumber4_recorder/features/support/steps.rb +9 -0
  55. data/test/fixtures/cucumber4_recorder/lib/hello.rb +7 -0
  56. data/test/fixtures/cucumber_recorder/Gemfile +5 -0
  57. data/test/fixtures/cucumber_recorder/appmap.yml +3 -0
  58. data/test/fixtures/cucumber_recorder/features/say_hello.feature +5 -0
  59. data/test/fixtures/cucumber_recorder/features/support/env.rb +5 -0
  60. data/test/fixtures/cucumber_recorder/features/support/hooks.rb +11 -0
  61. data/test/fixtures/cucumber_recorder/features/support/steps.rb +9 -0
  62. data/test/fixtures/cucumber_recorder/lib/hello.rb +7 -0
  63. data/test/fixtures/minitest_recorder/Gemfile +5 -0
  64. data/test/fixtures/minitest_recorder/appmap.yml +3 -0
  65. data/test/fixtures/minitest_recorder/lib/hello.rb +5 -0
  66. data/test/fixtures/minitest_recorder/test/hello_test.rb +12 -0
  67. data/test/fixtures/process_recorder/appmap.yml +3 -0
  68. data/test/fixtures/process_recorder/hello.rb +9 -0
  69. data/test/minitest_test.rb +38 -0
  70. data/test/record_process_test.rb +35 -0
  71. data/test/test_helper.rb +1 -0
  72. metadata +55 -3
  73. data/spec/fixtures/hook/class_method.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd23faab460498cfac79b397c4fc87920df8d1a984142909542f524057d1e4cb
4
- data.tar.gz: a967224c65d6a479287768389feb73a378e6e1be133f1033d06be6034a43b18e
3
+ metadata.gz: ae23c62b9a3f01cc3b7680706746d2f51c94c3a776978a8ee2d4e0e8501fca01
4
+ data.tar.gz: 4aa33af19ed0c31b826f8cffa75e147e2781fe93ed39353ace29cede8a7882b9
5
5
  SHA512:
6
- metadata.gz: 7822e4c821cb5e57579163fdd080bc3b74fb5ad0c8999bc6e3d29ace636301d8ed931966abfe9a59a6a59603f83af03e82130c241293ee198173ef6f6f41ebd1
7
- data.tar.gz: 8ba03667929d4571e13439ab53420934e0b1c9ee4605dfd71e9a7ff82b984d34e37ca43e206cbf5dc750201df93dc8dc9babbdafbadf12a86051e52efc6ef985
6
+ metadata.gz: 04a3c1bee70c02c96c1b71d5153a6ed44d668d6fc69d6da77cd6201364ede609bee93604f4ace391ddb38f8259841d6b334fdbe9051f1667d41cf3383281fe58
7
+ data.tar.gz: c60d868b2c1fa9c1e8742856dd7f946f5bf1284cab01a4478708c1582add5ca8fd16002e150d8a2cd897819edb661a9082cb01ec3e9879686d85d49b341d4ba8
data/.gitignore CHANGED
@@ -1,7 +1,6 @@
1
1
  .DS_Store
2
2
  /html/
3
- /.appmap/
4
- /.bundle/
3
+ .bundle
5
4
  /.yardoc
6
5
  /_yardoc/
7
6
  /coverage/
@@ -16,4 +15,3 @@ appmap.json
16
15
  .vscode
17
16
  .byebug_history
18
17
 
19
- /test/fixtures/rspec_recorder/.bundle/
@@ -1,3 +1,40 @@
1
+ # v0.33.0
2
+
3
+ * Added command `AppMap.open` to open an AppMap in the browser.
4
+
5
+ # v0.32.0
6
+
7
+ * Removes un-necessary fields from `return` events.
8
+
9
+ # v0.31.0
10
+
11
+ * Add the ability to hook methods by default, and optionally add labels to them in the
12
+ classmap. Use it to hook `ActiveSupport::SecurityUtils.secure_compare`.
13
+
14
+ # v0.30.0
15
+
16
+ * Add support for Minitest.
17
+
18
+ # v0.29.0
19
+
20
+ * Add `lib/appmap/record.rb`, which can be `require`d to record the rest of the process.
21
+
22
+ # v0.28.1
23
+
24
+ * Fix the `defined_class` recorded in an appmap for an instance method included in a class
25
+ at runtime.
26
+ * Only include the `static` attribute on `call` events in an appmap. Determine its value
27
+ based on the receiver of the method call.
28
+
29
+ # v0.28.0
30
+
31
+ * Change behavior of **AppMap.record** to return a complete AppMap as a Hash.
32
+ * Update README with information about recording Cucumber tests.
33
+ * **AppMap.initialize** automatically runs when `AppMap` is required, unless disabled
34
+ by environment variable `APPMAP_INITIALIZE=false`.
35
+ * **AppMap.hook** no longer takes a `configuration` argument.
36
+ * Add **AppMap::Util.scenario_filename**.
37
+
1
38
  # v0.27.0
2
39
 
3
40
  * Add **AppMap.record** to programatically record and capture an AppMap of a Ruby block.
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), to
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 instrument RSpec tests, follow these additional steps:
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
- 2) Add `appmap: true` to the tests you want to instrument.
96
+ Note that `spec_helper.rb` in a Rails project typically loads the application's classes this way:
102
97
 
103
98
  ```ruby
104
- describe Hello, appmap: true do
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
- 3) *Optional* Add `feature: '<feature name>'` and `feature_group: '<feature group name>'` annotations to your
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
- 4) Run the tests with the environment variable `APPMAP=true`:
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 a data file into the directory `tmp/appmap/rspec`. For example:
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
@@ -122,7 +122,7 @@ end
122
122
  Rake::TestTask.new(:minitest) do |t|
123
123
  t.libs << 'test'
124
124
  t.libs << 'lib'
125
- t.test_files = FileList['test/**/*_test.rb']
125
+ t.test_files = FileList['test/*_test.rb']
126
126
  end
127
127
 
128
128
  task spec: "spec:all"
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency 'faraday'
27
27
  spec.add_dependency 'gli'
28
28
  spec.add_dependency 'parser'
29
+ spec.add_dependency 'rack'
29
30
 
30
31
  spec.add_development_dependency 'bundler', '~> 1.16'
31
32
  spec.add_development_dependency 'minitest', '~> 5.0'
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.configure fname
141
+ AppMap.initialize fname
140
142
  end
141
143
 
142
144
  def interpret_output_file_option(file_name)
@@ -8,55 +8,52 @@ 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'
17
+ require 'appmap/open'
11
18
 
12
19
  module AppMap
13
- BATCH_HEADER_NAME = 'AppLand-Scenario-Batch'
14
-
15
20
  class << self
16
- @config = nil
17
- @config_file_path = nil
21
+ @configuration = nil
22
+ @configuration_file_path = nil
18
23
 
19
- # configuration gets the AppMap configuration.
24
+ # Gets the configuration. If there is no configuration, the default
25
+ # configuration is initialized.
20
26
  def configuration
21
- raise "AppMap is not configured" unless @config
22
-
23
- @config
27
+ @configuration ||= initialize
24
28
  end
25
29
 
26
- # configure applies the configuration from a file. This method can only be performed once.
27
- # Be sure and call it before +hook+ if you want non-default configuration.
28
- #
29
- # Default behavior is to configure from "appmap.yml".
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
30
+ # Sets the configuration. This is only expected to happen once per
31
+ # Ruby process.
32
+ def configuration=(config)
33
+ warn 'AppMap is already configured' if @configuration && config
36
34
 
37
- warn "Configuring AppMap from path #{config_file_path}"
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
35
+ @configuration = config
43
36
  end
44
37
 
45
- # Activate the code hooks which record function calls as trace events.
38
+ # Configures AppMap for recording. Default behavior is to configure from "appmap.yml".
39
+ # This method also activates the code hooks which record function calls as trace events.
46
40
  # Call this function before the program code is loaded by the Ruby VM, otherwise
47
41
  # the load events won't be seen and the hooks won't activate.
48
- def hook(config = configure)
49
- require 'appmap/hook'
50
- AppMap::Hook.hook(config)
42
+ def initialize(config_file_path = 'appmap.yml')
43
+ warn "Configuring AppMap from path #{config_file_path}"
44
+ Config.load_from_file(config_file_path).tap do |configuration|
45
+ self.configuration = configuration
46
+ Hook.new(configuration).enable
47
+ end
51
48
  end
52
49
 
53
- # Access the AppMap::Tracers, which can be used to start tracing, stop tracing, and record events.
50
+ # Used to start tracing, stop tracing, and record events.
54
51
  def tracing
55
- require 'appmap/trace'
56
- @tracing ||= Trace::Tracers.new
52
+ @tracing ||= Trace::Tracing.new
57
53
  end
58
54
 
59
- # Record a block and return the array of events.
55
+ # Records the events which occur while processing a block,
56
+ # and returns an AppMap as a Hash.
60
57
  def record
61
58
  tracer = tracing.trace
62
59
  begin
@@ -65,17 +62,36 @@ module AppMap
65
62
  tracing.delete(tracer)
66
63
  end
67
64
 
68
- [].tap do |events|
69
- events << tracer.next_event.to_h while tracer.event?
65
+ events = [].tap do |event_list|
66
+ event_list << tracer.next_event.to_h while tracer.event?
70
67
  end
68
+ {
69
+ 'version' => AppMap::APPMAP_FORMAT_VERSION,
70
+ 'metadata' => detect_metadata,
71
+ 'classMap' => class_map(tracer.event_methods),
72
+ 'events' => events
73
+ }
74
+ end
75
+
76
+ # Uploads an AppMap to the AppLand website and displays it.
77
+ def open(appmap = nil, &block)
78
+ appmap ||= AppMap.record(&block)
79
+ AppMap::Open.new(appmap).perform
80
+ end
81
+
82
+ # Builds a class map from a config and a list of Ruby methods.
83
+ def class_map(methods)
84
+ ClassMap.build_from_methods(configuration, methods)
71
85
  end
72
86
 
73
- # Build a class map from a config and a list of Ruby methods.
74
- def class_map(config, methods)
75
- require 'appmap/class_map'
76
- AppMap::ClassMap.build_from_methods(config, methods)
87
+ # Returns default metadata detected from the Ruby system and from the
88
+ # filesystem.
89
+ def detect_metadata
90
+ @metadata ||= Metadata.detect.freeze
91
+ @metadata.deep_dup
77
92
  end
78
93
  end
79
94
  end
80
95
 
81
96
  require 'appmap/railtie' if defined?(::Rails::Railtie)
97
+ AppMap.initialize unless ENV['APPMAP_INITIALIZE'] == 'false'