appmap 0.26.0 → 0.31.0
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/.gitignore +1 -2
- data/CHANGELOG.md +38 -0
- data/README.md +144 -31
- data/Rakefile +1 -1
- data/exe/appmap +3 -1
- data/lib/appmap.rb +55 -35
- data/lib/appmap/algorithm/stats.rb +2 -1
- data/lib/appmap/class_map.rb +16 -24
- data/lib/appmap/command/record.rb +2 -61
- data/lib/appmap/config.rb +91 -0
- data/lib/appmap/cucumber.rb +89 -0
- data/lib/appmap/event.rb +6 -6
- data/lib/appmap/hook.rb +94 -116
- 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 +2 -2
- data/lib/appmap/rails/sql_handler.rb +2 -2
- 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 +40 -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 +1 -1
- data/spec/config_spec.rb +3 -3
- data/spec/fixtures/hook/compare.rb +7 -0
- data/spec/fixtures/hook/openssl_sign.rb +87 -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 +243 -36
- data/spec/rails_spec_helper.rb +2 -0
- 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 +2 -2
- 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/fixtures/rspec_recorder/Gemfile +1 -1
- data/test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb +12 -0
- data/test/minitest_test.rb +38 -0
- data/test/record_process_test.rb +35 -0
- data/test/rspec_test.rb +5 -0
- metadata +39 -3
- data/spec/fixtures/hook/class_method.rb +0 -17
data/spec/rails_spec_helper.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/util_spec.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'appmap/util'
|
5
|
+
|
6
|
+
describe AppMap::Util, docker: false do
|
7
|
+
let(:subject) { AppMap::Util.method(:scenario_filename) }
|
8
|
+
describe 'scenario_filename' do
|
9
|
+
it 'leaves short names alone' do
|
10
|
+
expect(subject.call('foobar')).to eq('foobar.appmap.json')
|
11
|
+
end
|
12
|
+
it 'has a customizable suffix' do
|
13
|
+
expect(subject.call('foobar', extension: '.json')).to eq('foobar.json')
|
14
|
+
end
|
15
|
+
it 'limits the filename length' do
|
16
|
+
fname = (0...104).map { |i| ((i % 26) + 97).chr }.join
|
17
|
+
|
18
|
+
expect(subject.call(fname, max_length: 50)).to eq('abcdefghijklmno-RAd_SFbH1sUZ_OXfwPsfzw.appmap.json')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/test/cli_test.rb
CHANGED
@@ -59,7 +59,7 @@ class CLITest < Minitest::Test
|
|
59
59
|
|
60
60
|
Method frequency:
|
61
61
|
----------------
|
62
|
-
|
62
|
+
1 Main.say_hello
|
63
63
|
OUTPUT
|
64
64
|
end
|
65
65
|
|
@@ -85,7 +85,7 @@ class CLITest < Minitest::Test
|
|
85
85
|
"method_frequency": [
|
86
86
|
{
|
87
87
|
"name": "Main.say_hello",
|
88
|
-
"count":
|
88
|
+
"count": 1
|
89
89
|
}
|
90
90
|
]
|
91
91
|
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'test_helper'
|
5
|
+
require 'English'
|
6
|
+
|
7
|
+
class CucumberTest < Minitest::Test
|
8
|
+
def perform_test(dir)
|
9
|
+
Bundler.with_clean_env do
|
10
|
+
Dir.chdir "test/fixtures/#{dir}" do
|
11
|
+
FileUtils.rm_rf 'tmp'
|
12
|
+
system 'bundle config --local local.appmap ../../..'
|
13
|
+
system 'bundle'
|
14
|
+
system({ 'APPMAP' => 'true' }, %(bundle exec cucumber))
|
15
|
+
|
16
|
+
yield
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_cucumber
|
22
|
+
perform_test 'cucumber_recorder' do
|
23
|
+
appmap_file = 'tmp/appmap/cucumber/Say_hello.appmap.json'
|
24
|
+
|
25
|
+
assert File.file?(appmap_file),
|
26
|
+
%(appmap output file does not exist in #{Dir.new('tmp/appmap/cucumber').entries.join(', ')})
|
27
|
+
appmap = JSON.parse(File.read(appmap_file))
|
28
|
+
assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
|
29
|
+
assert_includes appmap.keys, 'metadata'
|
30
|
+
metadata = appmap['metadata']
|
31
|
+
|
32
|
+
assert_equal 'say_hello', metadata['feature_group']
|
33
|
+
assert_equal 'I can say hello', metadata['feature']
|
34
|
+
assert_equal 'Say hello', metadata['name']
|
35
|
+
assert_includes metadata.keys, 'client'
|
36
|
+
assert_equal({ name: 'appmap', url: AppMap::URL, version: AppMap::VERSION }.stringify_keys, metadata['client'])
|
37
|
+
assert_includes metadata.keys, 'recorder'
|
38
|
+
assert_equal({ name: 'cucumber' }.stringify_keys, metadata['recorder'])
|
39
|
+
|
40
|
+
assert_includes metadata.keys, 'frameworks'
|
41
|
+
cucumber = metadata['frameworks'].select {|f| f['name'] == 'cucumber'}
|
42
|
+
assert_equal 1, cucumber.count
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_cucumber4
|
47
|
+
perform_test 'cucumber4_recorder' do
|
48
|
+
appmap_file = 'tmp/appmap/cucumber/Say_hello.appmap.json'
|
49
|
+
|
50
|
+
assert File.file?(appmap_file),
|
51
|
+
%(appmap output file does not exist in #{Dir.new('tmp/appmap/cucumber').entries.join(', ')})
|
52
|
+
appmap = JSON.parse(File.read(appmap_file))
|
53
|
+
assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
|
54
|
+
assert_includes appmap.keys, 'metadata'
|
55
|
+
metadata = appmap['metadata']
|
56
|
+
|
57
|
+
assert_equal 'say_hello', metadata['feature_group']
|
58
|
+
# In cucumber4, there's no access to the feature name from within the executing scenario
|
59
|
+
# (as far as I can tell).
|
60
|
+
assert_equal 'Say hello', metadata['feature']
|
61
|
+
assert_equal 'Say hello', metadata['name']
|
62
|
+
assert_includes metadata.keys, 'client'
|
63
|
+
assert_equal({ name: 'appmap', url: AppMap::URL, version: AppMap::VERSION }.stringify_keys, metadata['client'])
|
64
|
+
assert_includes metadata.keys, 'recorder'
|
65
|
+
assert_equal({ name: 'cucumber' }.stringify_keys, metadata['recorder'])
|
66
|
+
|
67
|
+
assert_includes metadata.keys, 'frameworks'
|
68
|
+
cucumber = metadata['frameworks'].select {|f| f['name'] == 'cucumber'}
|
69
|
+
assert_equal 1, cucumber.count
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -3,6 +3,18 @@ require 'appmap/rspec'
|
|
3
3
|
require 'hello'
|
4
4
|
|
5
5
|
describe Hello, feature_group: 'Saying hello' do
|
6
|
+
before do
|
7
|
+
# Trick appmap-ruby into thinking we're a Rails app.
|
8
|
+
stub_const('Rails', double('rails', version: 'fake.0'))
|
9
|
+
end
|
10
|
+
|
11
|
+
# The order of these examples is important. The tests check the
|
12
|
+
# appmap for 'says hello', and we want another example to get run
|
13
|
+
# before it.
|
14
|
+
it 'does not say goodbye', feature: 'Speak hello', appmap: true do
|
15
|
+
expect(Hello.new.say_hello).not_to eq('Goodbye!')
|
16
|
+
end
|
17
|
+
|
6
18
|
it 'says hello', feature: 'Speak hello', appmap: true do
|
7
19
|
expect(Hello.new.say_hello).to eq('Hello!')
|
8
20
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'test_helper'
|
5
|
+
require 'English'
|
6
|
+
|
7
|
+
class MinitestTest < Minitest::Test
|
8
|
+
def perform_test(test_name)
|
9
|
+
Bundler.with_clean_env do
|
10
|
+
Dir.chdir 'test/fixtures/minitest_recorder' do
|
11
|
+
FileUtils.rm_rf 'tmp'
|
12
|
+
system 'bundle config --local local.appmap ../../..'
|
13
|
+
system 'bundle'
|
14
|
+
system({ 'APPMAP' => 'true' }, %(bundle exec ruby -Ilib -Itest test/#{test_name}_test.rb))
|
15
|
+
|
16
|
+
yield
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_hello
|
22
|
+
perform_test 'hello' do
|
23
|
+
appmap_file = 'tmp/appmap/minitest/Hello_hello.appmap.json'
|
24
|
+
|
25
|
+
assert File.file?(appmap_file), 'appmap output file does not exist'
|
26
|
+
appmap = JSON.parse(File.read(appmap_file))
|
27
|
+
assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
|
28
|
+
assert_includes appmap.keys, 'metadata'
|
29
|
+
metadata = appmap['metadata']
|
30
|
+
assert_equal 'minitest_recorder', metadata['app']
|
31
|
+
assert_equal 'minitest', metadata['recorder']['name']
|
32
|
+
assert_equal 'ruby', metadata['language']['name']
|
33
|
+
assert_equal 'Hello', metadata['feature_group']
|
34
|
+
assert_equal 'hello', metadata['feature']
|
35
|
+
assert_equal 'Hello hello', metadata['name']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'test_helper'
|
5
|
+
require 'English'
|
6
|
+
|
7
|
+
class RecordProcessTest < Minitest::Test
|
8
|
+
def perform_test(program_name)
|
9
|
+
Bundler.with_clean_env do
|
10
|
+
Dir.chdir 'test/fixtures/process_recorder' do
|
11
|
+
FileUtils.rm_rf 'tmp'
|
12
|
+
system 'bundle config --local local.appmap ../../..'
|
13
|
+
system 'bundle'
|
14
|
+
system(%(bundle exec ruby #{program_name}))
|
15
|
+
|
16
|
+
yield
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_hello
|
22
|
+
perform_test 'hello.rb' do
|
23
|
+
appmap_file = 'appmap.json'
|
24
|
+
|
25
|
+
assert File.file?(appmap_file), 'appmap output file does not exist'
|
26
|
+
appmap = JSON.parse(File.read(appmap_file))
|
27
|
+
assert_equal AppMap::APPMAP_FORMAT_VERSION, appmap['version']
|
28
|
+
assert_includes appmap.keys, 'metadata'
|
29
|
+
metadata = appmap['metadata']
|
30
|
+
assert_equal 'process_recorder', metadata['app']
|
31
|
+
assert_equal 'record_process', metadata['recorder']['name']
|
32
|
+
assert_equal 'ruby', metadata['language']['name']
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/test/rspec_test.rb
CHANGED
@@ -9,6 +9,7 @@ class RSpecTest < Minitest::Test
|
|
9
9
|
Bundler.with_clean_env do
|
10
10
|
Dir.chdir 'test/fixtures/rspec_recorder' do
|
11
11
|
FileUtils.rm_rf 'tmp'
|
12
|
+
system 'bundle config --local local.appmap ../../..'
|
12
13
|
system 'bundle'
|
13
14
|
system({ 'APPMAP' => 'true' }, %(bundle exec rspec spec/#{test_name}.rb))
|
14
15
|
|
@@ -48,6 +49,10 @@ class RSpecTest < Minitest::Test
|
|
48
49
|
assert_equal({ name: 'appmap', url: AppMap::URL, version: AppMap::VERSION }.stringify_keys, metadata['client'])
|
49
50
|
assert_includes metadata.keys, 'recorder'
|
50
51
|
assert_equal({ name: 'rspec' }.stringify_keys, metadata['recorder'])
|
52
|
+
|
53
|
+
assert_includes metadata.keys, 'frameworks'
|
54
|
+
rspec = metadata['frameworks'].select {|f| f['name'] == 'rspec'}
|
55
|
+
assert_equal 1, rspec.count
|
51
56
|
end
|
52
57
|
end
|
53
58
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -269,14 +269,20 @@ files:
|
|
269
269
|
- lib/appmap/class_map.rb
|
270
270
|
- lib/appmap/command/record.rb
|
271
271
|
- lib/appmap/command/stats.rb
|
272
|
+
- lib/appmap/config.rb
|
273
|
+
- lib/appmap/cucumber.rb
|
272
274
|
- lib/appmap/event.rb
|
273
275
|
- lib/appmap/hook.rb
|
276
|
+
- lib/appmap/metadata.rb
|
274
277
|
- lib/appmap/middleware/remote_recording.rb
|
278
|
+
- lib/appmap/minitest.rb
|
275
279
|
- lib/appmap/rails/action_handler.rb
|
276
280
|
- lib/appmap/rails/sql_handler.rb
|
277
281
|
- lib/appmap/railtie.rb
|
282
|
+
- lib/appmap/record.rb
|
278
283
|
- lib/appmap/rspec.rb
|
279
284
|
- lib/appmap/trace.rb
|
285
|
+
- lib/appmap/util.rb
|
280
286
|
- lib/appmap/version.rb
|
281
287
|
- lore/pages/2019-05-21-install-and-record/index.pug
|
282
288
|
- lore/pages/2019-05-21-install-and-record/install_example_appmap.png
|
@@ -301,10 +307,12 @@ files:
|
|
301
307
|
- spec/abstract_controller_base_spec.rb
|
302
308
|
- spec/config_spec.rb
|
303
309
|
- spec/fixtures/hook/attr_accessor.rb
|
304
|
-
- spec/fixtures/hook/
|
310
|
+
- spec/fixtures/hook/compare.rb
|
305
311
|
- spec/fixtures/hook/constructor.rb
|
306
312
|
- spec/fixtures/hook/exception_method.rb
|
307
313
|
- spec/fixtures/hook/instance_method.rb
|
314
|
+
- spec/fixtures/hook/openssl_sign.rb
|
315
|
+
- spec/fixtures/hook/singleton_method.rb
|
308
316
|
- spec/fixtures/rack_users_app/.dockerignore
|
309
317
|
- spec/fixtures/rack_users_app/.gitignore
|
310
318
|
- spec/fixtures/rack_users_app/Dockerfile
|
@@ -436,6 +444,10 @@ files:
|
|
436
444
|
- spec/fixtures/rails_users_app/db/migrate/20190728211408_create_users.rb
|
437
445
|
- spec/fixtures/rails_users_app/db/schema.rb
|
438
446
|
- spec/fixtures/rails_users_app/docker-compose.yml
|
447
|
+
- spec/fixtures/rails_users_app/features/api_users.feature
|
448
|
+
- spec/fixtures/rails_users_app/features/support/env.rb
|
449
|
+
- spec/fixtures/rails_users_app/features/support/hooks.rb
|
450
|
+
- spec/fixtures/rails_users_app/features/support/steps.rb
|
439
451
|
- spec/fixtures/rails_users_app/lib/tasks/.keep
|
440
452
|
- spec/fixtures/rails_users_app/log/.keep
|
441
453
|
- spec/fixtures/rails_users_app/public/robots.txt
|
@@ -452,15 +464,39 @@ files:
|
|
452
464
|
- spec/remote_recording_spec.rb
|
453
465
|
- spec/rspec_feature_metadata_spec.rb
|
454
466
|
- spec/spec_helper.rb
|
467
|
+
- spec/util_spec.rb
|
455
468
|
- test/cli_test.rb
|
469
|
+
- test/cucumber_test.rb
|
456
470
|
- test/fixtures/cli_record_test/appmap.yml
|
457
471
|
- test/fixtures/cli_record_test/lib/cli_record_test/main.rb
|
472
|
+
- test/fixtures/cucumber4_recorder/Gemfile
|
473
|
+
- test/fixtures/cucumber4_recorder/appmap.yml
|
474
|
+
- test/fixtures/cucumber4_recorder/features/say_hello.feature
|
475
|
+
- test/fixtures/cucumber4_recorder/features/support/env.rb
|
476
|
+
- test/fixtures/cucumber4_recorder/features/support/hooks.rb
|
477
|
+
- test/fixtures/cucumber4_recorder/features/support/steps.rb
|
478
|
+
- test/fixtures/cucumber4_recorder/lib/hello.rb
|
479
|
+
- test/fixtures/cucumber_recorder/Gemfile
|
480
|
+
- test/fixtures/cucumber_recorder/appmap.yml
|
481
|
+
- test/fixtures/cucumber_recorder/features/say_hello.feature
|
482
|
+
- test/fixtures/cucumber_recorder/features/support/env.rb
|
483
|
+
- test/fixtures/cucumber_recorder/features/support/hooks.rb
|
484
|
+
- test/fixtures/cucumber_recorder/features/support/steps.rb
|
485
|
+
- test/fixtures/cucumber_recorder/lib/hello.rb
|
486
|
+
- test/fixtures/minitest_recorder/Gemfile
|
487
|
+
- test/fixtures/minitest_recorder/appmap.yml
|
488
|
+
- test/fixtures/minitest_recorder/lib/hello.rb
|
489
|
+
- test/fixtures/minitest_recorder/test/hello_test.rb
|
490
|
+
- test/fixtures/process_recorder/appmap.yml
|
491
|
+
- test/fixtures/process_recorder/hello.rb
|
458
492
|
- test/fixtures/rspec_recorder/Gemfile
|
459
493
|
- test/fixtures/rspec_recorder/appmap.yml
|
460
494
|
- test/fixtures/rspec_recorder/lib/hello.rb
|
461
495
|
- test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb
|
462
496
|
- test/fixtures/rspec_recorder/spec/labeled_hello_spec.rb
|
463
497
|
- test/fixtures/rspec_recorder/spec/plain_hello_spec.rb
|
498
|
+
- test/minitest_test.rb
|
499
|
+
- test/record_process_test.rb
|
464
500
|
- test/rspec_test.rb
|
465
501
|
- test/test_helper.rb
|
466
502
|
homepage: https://github.com/applandinc/appmap-ruby
|