appmap 0.52.1 → 0.54.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -10
- data/CHANGELOG.md +41 -0
- data/Rakefile +13 -4
- data/appmap.gemspec +1 -1
- data/exe/appmap-agent-init +19 -0
- data/lib/appmap.rb +31 -112
- data/lib/appmap/agent.rb +115 -0
- data/lib/appmap/class_map.rb +2 -2
- data/lib/appmap/config.rb +11 -3
- data/lib/appmap/handler/net_http.rb +3 -2
- data/lib/appmap/handler/rails/request_handler.rb +2 -1
- data/lib/appmap/handler/rails/template.rb +2 -1
- data/lib/appmap/hook.rb +0 -1
- data/lib/appmap/hook/method.rb +36 -28
- data/lib/appmap/metadata.rb +4 -2
- data/lib/appmap/minitest.rb +2 -0
- data/lib/appmap/railtie.rb +2 -2
- data/lib/appmap/rspec.rb +5 -3
- data/lib/appmap/swagger.rb +2 -0
- data/lib/appmap/swagger/configuration.rb +70 -0
- data/lib/appmap/swagger/markdown_descriptions.rb +43 -0
- data/lib/appmap/swagger/rake_tasks.rb +43 -0
- data/lib/appmap/swagger/stable.rb +37 -0
- data/lib/appmap/trace.rb +2 -0
- data/lib/appmap/util.rb +17 -1
- data/lib/appmap/version.rb +1 -1
- data/package.json +0 -1
- data/release.sh +0 -1
- data/spec/config_spec.rb +0 -1
- data/spec/fixtures/hook/.gitignore +2 -0
- data/spec/fixtures/hook/app/controllers/api/api_keys_controller.rb +1 -0
- data/spec/fixtures/hook/app/controllers/organizations_controller.rb +1 -0
- data/spec/fixtures/hook/app/models/api_key.rb +1 -0
- data/spec/fixtures/hook/app/models/configuration.rb +1 -0
- data/spec/fixtures/hook/app/models/show.rb +1 -0
- data/spec/fixtures/hook/app/models/user.rb +1 -0
- data/spec/fixtures/hook/kwargs.rb +11 -0
- data/spec/fixtures/hook/revoke_api_key.appmap.json +847 -0
- data/spec/fixtures/hook/spec/api_spec.rb +1 -0
- data/spec/fixtures/hook/spec/user_spec.rb +1 -0
- data/spec/fixtures/hook/user_page_scenario.appmap.json +1722 -0
- data/spec/fixtures/rails5_users_app/config/environments/test.rb +3 -0
- data/spec/fixtures/rails6_users_app/Dockerfile +0 -1
- data/spec/fixtures/rails6_users_app/appmap.yml +3 -1
- data/spec/fixtures/rails6_users_app/config/environments/test.rb +3 -0
- data/spec/fixtures/rails6_users_app/lib/tasks/appmap.rake +13 -0
- data/spec/hook_spec.rb +9 -0
- data/spec/rails_recording_spec.rb +1 -1
- data/spec/record_net_http_spec.rb +1 -0
- data/spec/swagger/swagger_spec.rb +47 -0
- data/test/{agent_setup_cli_test.rb → agent_setup_init_test.rb} +4 -4
- data/test/gem_test.rb +1 -0
- metadata +39 -19
- data/exe/appmap-agent-setup +0 -47
data/spec/hook_spec.rb
CHANGED
@@ -985,4 +985,13 @@ describe 'AppMap class Hooking', docker: false do
|
|
985
985
|
expect(InstanceMethod.new.method(:say_echo).arity).to be(1)
|
986
986
|
end
|
987
987
|
end
|
988
|
+
|
989
|
+
describe 'kwargs handling' do
|
990
|
+
# https://github.com/applandinc/appmap-ruby/issues/153
|
991
|
+
it 'empty hash for **kwrest can be proxied as a regular function argument', github_issue: 153 do
|
992
|
+
invoke_test_file 'spec/fixtures/hook/kwargs.rb' do
|
993
|
+
expect(Kwargs.has_kwrest_calls_no_kwargs(nil, {})).to eq({})
|
994
|
+
end
|
995
|
+
end
|
996
|
+
end
|
988
997
|
end
|
@@ -224,7 +224,7 @@ describe 'Rails' do
|
|
224
224
|
'name' => 'ActionView',
|
225
225
|
'children' => include(hash_including(
|
226
226
|
# Rails 6/5 difference
|
227
|
-
'name' => /^(Template)?Renderer$/,
|
227
|
+
'name' => /^(Template)?Renderer$/,
|
228
228
|
'children' => include(hash_including(
|
229
229
|
'name' => 'render',
|
230
230
|
'labels' => ['mvc.view']
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require_relative '../rails_spec_helper'
|
2
|
+
|
3
|
+
describe 'rake appmap:swagger' do
|
4
|
+
include_context 'Rails app pg database', "spec/fixtures/rails6_users_app" unless use_existing_data?
|
5
|
+
include_context 'rails integration test setup'
|
6
|
+
|
7
|
+
def run_spec(spec_name)
|
8
|
+
cmd = <<~CMD.gsub "\n", ' '
|
9
|
+
docker-compose run --rm -e RAILS_ENV=test -e APPMAP=true
|
10
|
+
-v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rspec #{spec_name}
|
11
|
+
CMD
|
12
|
+
run_cmd cmd, chdir: fixture_dir
|
13
|
+
end
|
14
|
+
|
15
|
+
def generate_swagger
|
16
|
+
cmd = <<~CMD.gsub "\n", ' '
|
17
|
+
docker-compose run --rm -v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rake appmap:swagger
|
18
|
+
CMD
|
19
|
+
run_cmd cmd, chdir: fixture_dir
|
20
|
+
end
|
21
|
+
|
22
|
+
unless use_existing_data?
|
23
|
+
before(:all) do
|
24
|
+
generate_swagger
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# The swagger-building logic is mostly in the JS code. So what we are really testing here
|
29
|
+
# is the Rails integration - the rake task and integration with the appmap.yml.
|
30
|
+
# And of course the bundling of the JS code by the appmap gem.
|
31
|
+
it 'generates openapi_stable.yml' do
|
32
|
+
swagger = YAML.load(File.read(File.join(tmpdir, 'swagger', 'openapi_stable.yaml'))).deep_symbolize_keys
|
33
|
+
|
34
|
+
expect(swagger).to match(
|
35
|
+
hash_including(
|
36
|
+
openapi: /^\d\.\d\.\d$/,
|
37
|
+
info: {
|
38
|
+
title: 'Usersapp API',
|
39
|
+
version: '1.1.0'
|
40
|
+
},
|
41
|
+
paths: hash_including(
|
42
|
+
:'/api/users' => an_instance_of(Hash)
|
43
|
+
)
|
44
|
+
)
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'test_helper'
|
5
5
|
|
6
|
-
class
|
6
|
+
class AgentSetupInitTest < Minitest::Test
|
7
7
|
CONFIG_FILENAME = '123.yml'
|
8
8
|
SUBFOLDER_CONFIG_FILEPATH = 'conf/123.yml'
|
9
9
|
EXPECTED_CONFIG_CONTENT = %(name: appmap-ruby
|
@@ -12,13 +12,13 @@ packages:
|
|
12
12
|
)
|
13
13
|
|
14
14
|
def test_init_when_config_exists
|
15
|
-
output = `./exe/appmap-agent-
|
15
|
+
output = `./exe/appmap-agent-init`
|
16
16
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
17
17
|
assert_includes output, 'The AppMap config file appmap.yml already exists.'
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_init_with_custom_config_filename
|
21
|
-
output = `./exe/appmap-agent-
|
21
|
+
output = `./exe/appmap-agent-init -c #{CONFIG_FILENAME}`
|
22
22
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
23
23
|
assert_includes output, "The following AppMap config file #{CONFIG_FILENAME} has been created:"
|
24
24
|
assert_equal EXPECTED_CONFIG_CONTENT, File.read(CONFIG_FILENAME)
|
@@ -27,7 +27,7 @@ packages:
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_init_with_custom_config_file_in_subfolder
|
30
|
-
output = `./exe/appmap-agent-
|
30
|
+
output = `./exe/appmap-agent-init --config=#{SUBFOLDER_CONFIG_FILEPATH}`
|
31
31
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
32
32
|
assert_includes output, "The following AppMap config file #{SUBFOLDER_CONFIG_FILEPATH} has been created:"
|
33
33
|
assert_equal EXPECTED_CONFIG_CONTENT, File.read(SUBFOLDER_CONFIG_FILEPATH)
|
data/test/gem_test.rb
CHANGED
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.54.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Gilpin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: gli
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: method_source
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -290,11 +276,25 @@ dependencies:
|
|
290
276
|
- - ">="
|
291
277
|
- !ruby/object:Gem::Version
|
292
278
|
version: '0'
|
279
|
+
- !ruby/object:Gem::Dependency
|
280
|
+
name: webrick
|
281
|
+
requirement: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
type: :development
|
287
|
+
prerelease: false
|
288
|
+
version_requirements: !ruby/object:Gem::Requirement
|
289
|
+
requirements:
|
290
|
+
- - ">="
|
291
|
+
- !ruby/object:Gem::Version
|
292
|
+
version: '0'
|
293
293
|
description:
|
294
294
|
email:
|
295
295
|
- kgilpin@gmail.com
|
296
296
|
executables:
|
297
|
-
- appmap-agent-
|
297
|
+
- appmap-agent-init
|
298
298
|
- appmap-inspect
|
299
299
|
extensions:
|
300
300
|
- ext/appmap/extconf.rb
|
@@ -323,11 +323,12 @@ files:
|
|
323
323
|
- examples/mock_webapp/lib/mock_webapp/controller.rb
|
324
324
|
- examples/mock_webapp/lib/mock_webapp/request.rb
|
325
325
|
- examples/mock_webapp/lib/mock_webapp/user.rb
|
326
|
-
- exe/appmap-agent-
|
326
|
+
- exe/appmap-agent-init
|
327
327
|
- exe/appmap-inspect
|
328
328
|
- ext/appmap/appmap.c
|
329
329
|
- ext/appmap/extconf.rb
|
330
330
|
- lib/appmap.rb
|
331
|
+
- lib/appmap/agent.rb
|
331
332
|
- lib/appmap/class_map.rb
|
332
333
|
- lib/appmap/command/agent_setup/init.rb
|
333
334
|
- lib/appmap/command/inspect.rb
|
@@ -351,6 +352,11 @@ files:
|
|
351
352
|
- lib/appmap/record.rb
|
352
353
|
- lib/appmap/rspec.rb
|
353
354
|
- lib/appmap/service/guesser.rb
|
355
|
+
- lib/appmap/swagger.rb
|
356
|
+
- lib/appmap/swagger/configuration.rb
|
357
|
+
- lib/appmap/swagger/markdown_descriptions.rb
|
358
|
+
- lib/appmap/swagger/rake_tasks.rb
|
359
|
+
- lib/appmap/swagger/stable.rb
|
354
360
|
- lib/appmap/trace.rb
|
355
361
|
- lib/appmap/util.rb
|
356
362
|
- lib/appmap/version.rb
|
@@ -358,6 +364,13 @@ files:
|
|
358
364
|
- release.sh
|
359
365
|
- spec/class_map_spec.rb
|
360
366
|
- spec/config_spec.rb
|
367
|
+
- spec/fixtures/hook/.gitignore
|
368
|
+
- spec/fixtures/hook/app/controllers/api/api_keys_controller.rb
|
369
|
+
- spec/fixtures/hook/app/controllers/organizations_controller.rb
|
370
|
+
- spec/fixtures/hook/app/models/api_key.rb
|
371
|
+
- spec/fixtures/hook/app/models/configuration.rb
|
372
|
+
- spec/fixtures/hook/app/models/show.rb
|
373
|
+
- spec/fixtures/hook/app/models/user.rb
|
361
374
|
- spec/fixtures/hook/attr_accessor.rb
|
362
375
|
- spec/fixtures/hook/compare.rb
|
363
376
|
- spec/fixtures/hook/constructor.rb
|
@@ -365,9 +378,14 @@ files:
|
|
365
378
|
- spec/fixtures/hook/exception_method.rb
|
366
379
|
- spec/fixtures/hook/exclude.rb
|
367
380
|
- spec/fixtures/hook/instance_method.rb
|
381
|
+
- spec/fixtures/hook/kwargs.rb
|
368
382
|
- spec/fixtures/hook/labels.rb
|
369
383
|
- spec/fixtures/hook/method_named_call.rb
|
384
|
+
- spec/fixtures/hook/revoke_api_key.appmap.json
|
370
385
|
- spec/fixtures/hook/singleton_method.rb
|
386
|
+
- spec/fixtures/hook/spec/api_spec.rb
|
387
|
+
- spec/fixtures/hook/spec/user_spec.rb
|
388
|
+
- spec/fixtures/hook/user_page_scenario.appmap.json
|
371
389
|
- spec/fixtures/rack_users_app/.dockerignore
|
372
390
|
- spec/fixtures/rack_users_app/.gitignore
|
373
391
|
- spec/fixtures/rack_users_app/Dockerfile
|
@@ -510,6 +528,7 @@ files:
|
|
510
528
|
- spec/fixtures/rails6_users_app/features/support/hooks.rb
|
511
529
|
- spec/fixtures/rails6_users_app/features/support/steps.rb
|
512
530
|
- spec/fixtures/rails6_users_app/lib/tasks/.keep
|
531
|
+
- spec/fixtures/rails6_users_app/lib/tasks/appmap.rake
|
513
532
|
- spec/fixtures/rails6_users_app/log/.keep
|
514
533
|
- spec/fixtures/rails6_users_app/public/robots.txt
|
515
534
|
- spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb
|
@@ -527,8 +546,9 @@ files:
|
|
527
546
|
- spec/record_sql_rails_pg_spec.rb
|
528
547
|
- spec/remote_recording_spec.rb
|
529
548
|
- spec/spec_helper.rb
|
549
|
+
- spec/swagger/swagger_spec.rb
|
530
550
|
- spec/util_spec.rb
|
531
|
-
- test/
|
551
|
+
- test/agent_setup_init_test.rb
|
532
552
|
- test/bundle_vendor_test.rb
|
533
553
|
- test/cucumber_test.rb
|
534
554
|
- test/expectations/openssl_test_key_sign1.json
|
data/exe/appmap-agent-setup
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'gli'
|
5
|
-
|
6
|
-
require 'appmap'
|
7
|
-
|
8
|
-
class App
|
9
|
-
extend GLI::App
|
10
|
-
|
11
|
-
program_desc 'CLI tool to be used by code editor plugins for AppMap setup and configuration'
|
12
|
-
|
13
|
-
version AppMap::VERSION
|
14
|
-
|
15
|
-
subcommand_option_handling :normal
|
16
|
-
arguments :strict
|
17
|
-
preserve_argv true
|
18
|
-
|
19
|
-
desc 'AppMap configuration file name'
|
20
|
-
default_value ENV['APPMAP_CONFIG'] || AppMap::DEFAULT_CONFIG_FILE_PATH
|
21
|
-
arg_name 'filename'
|
22
|
-
flag %i[c config]
|
23
|
-
|
24
|
-
desc 'Creates base configuration file for the current project'
|
25
|
-
command :init do |c|
|
26
|
-
c.action do
|
27
|
-
require 'appmap/command/agent_setup/init'
|
28
|
-
AppMap::Command::AgentSetup::Init.new(@config_file).perform
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
pre do |global, _, _, _|
|
33
|
-
@config_file = global[:config]
|
34
|
-
@config = interpret_config_option(@config_file) if File.exist?(@config_file)
|
35
|
-
true
|
36
|
-
end
|
37
|
-
|
38
|
-
class << self
|
39
|
-
protected
|
40
|
-
|
41
|
-
def interpret_config_option(fname)
|
42
|
-
AppMap::Config.load_from_file fname
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
exit App.run(ARGV)
|