appmap 0.53.0 → 0.54.4

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +16 -10
  3. data/CHANGELOG.md +41 -0
  4. data/Rakefile +13 -4
  5. data/appmap.gemspec +1 -0
  6. data/lib/appmap.rb +31 -112
  7. data/lib/appmap/agent.rb +115 -0
  8. data/lib/appmap/class_map.rb +2 -2
  9. data/lib/appmap/config.rb +11 -3
  10. data/lib/appmap/handler/net_http.rb +3 -2
  11. data/lib/appmap/handler/rails/request_handler.rb +2 -1
  12. data/lib/appmap/handler/rails/template.rb +2 -1
  13. data/lib/appmap/hook.rb +7 -3
  14. data/lib/appmap/hook/method.rb +36 -28
  15. data/lib/appmap/metadata.rb +4 -2
  16. data/lib/appmap/minitest.rb +2 -0
  17. data/lib/appmap/railtie.rb +2 -2
  18. data/lib/appmap/rspec.rb +5 -3
  19. data/lib/appmap/swagger.rb +2 -0
  20. data/lib/appmap/swagger/configuration.rb +70 -0
  21. data/lib/appmap/swagger/markdown_descriptions.rb +43 -0
  22. data/lib/appmap/swagger/rake_tasks.rb +43 -0
  23. data/lib/appmap/swagger/stable.rb +37 -0
  24. data/lib/appmap/trace.rb +2 -0
  25. data/lib/appmap/util.rb +17 -1
  26. data/lib/appmap/version.rb +1 -1
  27. data/package.json +0 -1
  28. data/release.sh +0 -1
  29. data/spec/config_spec.rb +0 -1
  30. data/spec/fixtures/hook/.gitignore +2 -0
  31. data/spec/fixtures/hook/app/controllers/api/api_keys_controller.rb +1 -0
  32. data/spec/fixtures/hook/app/controllers/organizations_controller.rb +1 -0
  33. data/spec/fixtures/hook/app/models/api_key.rb +1 -0
  34. data/spec/fixtures/hook/app/models/configuration.rb +1 -0
  35. data/spec/fixtures/hook/app/models/show.rb +1 -0
  36. data/spec/fixtures/hook/app/models/user.rb +1 -0
  37. data/spec/fixtures/hook/kwargs.rb +11 -0
  38. data/spec/fixtures/hook/revoke_api_key.appmap.json +847 -0
  39. data/spec/fixtures/hook/spec/api_spec.rb +1 -0
  40. data/spec/fixtures/hook/spec/user_spec.rb +1 -0
  41. data/spec/fixtures/hook/user_page_scenario.appmap.json +1722 -0
  42. data/spec/fixtures/rails5_users_app/config/environments/test.rb +3 -0
  43. data/spec/fixtures/rails6_users_app/Dockerfile +0 -1
  44. data/spec/fixtures/rails6_users_app/appmap.yml +3 -1
  45. data/spec/fixtures/rails6_users_app/config/environments/test.rb +3 -0
  46. data/spec/fixtures/rails6_users_app/lib/tasks/appmap.rake +13 -0
  47. data/spec/hook_spec.rb +9 -0
  48. data/spec/rails_recording_spec.rb +1 -1
  49. data/spec/record_net_http_spec.rb +1 -0
  50. data/spec/swagger/swagger_spec.rb +47 -0
  51. data/test/gem_test.rb +1 -0
  52. metadata +36 -2
@@ -1,3 +1,6 @@
1
+ require 'active_support'
2
+ require 'active_support/core_ext'
3
+
1
4
  Rails.application.configure do
2
5
  # Settings specified here will take precedence over those in config/application.rb.
3
6
 
@@ -2,7 +2,6 @@ ARG GEM_VERSION
2
2
  ARG RUBY_VERSION
3
3
 
4
4
  FROM appmap:${GEM_VERSION} as appmap
5
-
6
5
  FROM ruby:${RUBY_VERSION}
7
6
 
8
7
  SHELL ["/bin/bash", "-c"]
@@ -5,4 +5,6 @@ packages:
5
5
  - path: app/controllers
6
6
  labels: [ mvc.controller ]
7
7
  - gem: sequel
8
-
8
+ swagger:
9
+ project_version: 1.1.0
10
+ output_dir: tmp/swagger
@@ -1,3 +1,6 @@
1
+ require 'active_support'
2
+ require 'active_support/core_ext'
3
+
1
4
  Rails.application.configure do
2
5
  # Settings specified here will take precedence over those in config/application.rb.
3
6
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :appmap do
4
+ def swagger_tasks
5
+ require 'appmap/swagger'
6
+
7
+ AppMap::Swagger::RakeTasks.define_tasks
8
+ end
9
+
10
+ if %w[test development].member?(Rails.env)
11
+ swagger_tasks
12
+ end
13
+ end
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']
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'diffy'
3
3
  require 'rack'
4
+ require 'webrick'
4
5
  require 'rack/handler/webrick'
5
6
 
6
7
  class HelloWorldApp
@@ -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
data/test/gem_test.rb CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  require 'test_helper'
5
5
  require 'English'
6
+ require 'json'
6
7
 
7
8
  class GemTest < Minitest::Test
8
9
  def perform_gem_test(test_name)
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.53.0
4
+ version: 0.54.4
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-23 00:00:00.000000000 Z
11
+ date: 2021-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -276,6 +276,20 @@ dependencies:
276
276
  - - ">="
277
277
  - !ruby/object:Gem::Version
278
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'
279
293
  description:
280
294
  email:
281
295
  - kgilpin@gmail.com
@@ -314,6 +328,7 @@ files:
314
328
  - ext/appmap/appmap.c
315
329
  - ext/appmap/extconf.rb
316
330
  - lib/appmap.rb
331
+ - lib/appmap/agent.rb
317
332
  - lib/appmap/class_map.rb
318
333
  - lib/appmap/command/agent_setup/init.rb
319
334
  - lib/appmap/command/inspect.rb
@@ -337,6 +352,11 @@ files:
337
352
  - lib/appmap/record.rb
338
353
  - lib/appmap/rspec.rb
339
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
340
360
  - lib/appmap/trace.rb
341
361
  - lib/appmap/util.rb
342
362
  - lib/appmap/version.rb
@@ -344,6 +364,13 @@ files:
344
364
  - release.sh
345
365
  - spec/class_map_spec.rb
346
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
347
374
  - spec/fixtures/hook/attr_accessor.rb
348
375
  - spec/fixtures/hook/compare.rb
349
376
  - spec/fixtures/hook/constructor.rb
@@ -351,9 +378,14 @@ files:
351
378
  - spec/fixtures/hook/exception_method.rb
352
379
  - spec/fixtures/hook/exclude.rb
353
380
  - spec/fixtures/hook/instance_method.rb
381
+ - spec/fixtures/hook/kwargs.rb
354
382
  - spec/fixtures/hook/labels.rb
355
383
  - spec/fixtures/hook/method_named_call.rb
384
+ - spec/fixtures/hook/revoke_api_key.appmap.json
356
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
357
389
  - spec/fixtures/rack_users_app/.dockerignore
358
390
  - spec/fixtures/rack_users_app/.gitignore
359
391
  - spec/fixtures/rack_users_app/Dockerfile
@@ -496,6 +528,7 @@ files:
496
528
  - spec/fixtures/rails6_users_app/features/support/hooks.rb
497
529
  - spec/fixtures/rails6_users_app/features/support/steps.rb
498
530
  - spec/fixtures/rails6_users_app/lib/tasks/.keep
531
+ - spec/fixtures/rails6_users_app/lib/tasks/appmap.rake
499
532
  - spec/fixtures/rails6_users_app/log/.keep
500
533
  - spec/fixtures/rails6_users_app/public/robots.txt
501
534
  - spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb
@@ -513,6 +546,7 @@ files:
513
546
  - spec/record_sql_rails_pg_spec.rb
514
547
  - spec/remote_recording_spec.rb
515
548
  - spec/spec_helper.rb
549
+ - spec/swagger/swagger_spec.rb
516
550
  - spec/util_spec.rb
517
551
  - test/agent_setup_init_test.rb
518
552
  - test/bundle_vendor_test.rb