appmap 0.23.0 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +17 -8
  4. data/.travis.yml +6 -0
  5. data/CHANGELOG.md +43 -0
  6. data/README.md +33 -21
  7. data/Rakefile +3 -3
  8. data/appmap.gemspec +3 -1
  9. data/exe/appmap +5 -73
  10. data/lib/appmap.rb +61 -6
  11. data/lib/appmap/algorithm/prune_class_map.rb +2 -0
  12. data/lib/appmap/algorithm/stats.rb +4 -2
  13. data/lib/appmap/class_map.rb +143 -0
  14. data/lib/appmap/command/record.rb +8 -6
  15. data/lib/appmap/command/stats.rb +2 -0
  16. data/lib/appmap/event.rb +168 -0
  17. data/lib/appmap/hook.rb +152 -0
  18. data/lib/appmap/middleware/remote_recording.rb +14 -21
  19. data/lib/appmap/rails/action_handler.rb +10 -6
  20. data/lib/appmap/rails/sql_handler.rb +10 -13
  21. data/lib/appmap/railtie.rb +31 -18
  22. data/lib/appmap/rspec.rb +247 -260
  23. data/lib/appmap/trace.rb +88 -0
  24. data/lib/appmap/version.rb +1 -1
  25. data/package-lock.json +90 -92
  26. data/spec/abstract_controller4_base_spec.rb +1 -1
  27. data/spec/abstract_controller_base_spec.rb +7 -3
  28. data/spec/config_spec.rb +25 -0
  29. data/spec/fixtures/hook/attr_accessor.rb +5 -0
  30. data/spec/fixtures/hook/class_method.rb +17 -0
  31. data/spec/fixtures/hook/constructor.rb +7 -0
  32. data/spec/fixtures/hook/exception_method.rb +11 -0
  33. data/spec/fixtures/hook/instance_method.rb +23 -0
  34. data/spec/fixtures/rails4_users_app/app/controllers/api/users_controller.rb +3 -3
  35. data/spec/fixtures/rails4_users_app/config/database.yml +2 -1
  36. data/spec/fixtures/rails4_users_app/docker-compose.yml +2 -0
  37. data/spec/fixtures/rails_users_app/.ruby-version +1 -1
  38. data/spec/fixtures/rails_users_app/app/controllers/api/users_controller.rb +2 -2
  39. data/spec/fixtures/rails_users_app/config/database.yml +2 -1
  40. data/spec/fixtures/rails_users_app/create_app +1 -0
  41. data/spec/fixtures/rails_users_app/docker-compose.yml +4 -0
  42. data/spec/fixtures/rails_users_app/spec/models/user_spec.rb +1 -1
  43. data/spec/hook_spec.rb +369 -0
  44. data/spec/rails_spec_helper.rb +25 -16
  45. data/spec/railtie_spec.rb +1 -1
  46. data/spec/record_sql_rails_pg_spec.rb +1 -2
  47. data/spec/remote_recording_spec.rb +117 -0
  48. data/spec/spec_helper.rb +5 -0
  49. data/test/cli_test.rb +4 -46
  50. data/test/fixtures/cli_record_test/appmap.yml +2 -1
  51. data/test/fixtures/cli_record_test/lib/cli_record_test/main.rb +4 -2
  52. data/test/fixtures/rspec_recorder/Gemfile +1 -1
  53. data/test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb +12 -0
  54. data/test/rspec_test.rb +5 -0
  55. data/test/test_helper.rb +0 -42
  56. metadata +46 -63
  57. data/exe/_appmap-record-self +0 -49
  58. data/lib/appmap/command/inspect.rb +0 -14
  59. data/lib/appmap/command/upload.rb +0 -99
  60. data/lib/appmap/config.rb +0 -65
  61. data/lib/appmap/config/directory.rb +0 -65
  62. data/lib/appmap/config/file.rb +0 -13
  63. data/lib/appmap/config/named_function.rb +0 -21
  64. data/lib/appmap/config/package_dir.rb +0 -52
  65. data/lib/appmap/config/path.rb +0 -25
  66. data/lib/appmap/feature.rb +0 -262
  67. data/lib/appmap/inspect.rb +0 -91
  68. data/lib/appmap/inspect/inspector.rb +0 -99
  69. data/lib/appmap/inspect/parse_node.rb +0 -170
  70. data/lib/appmap/inspect/parser.rb +0 -15
  71. data/lib/appmap/parser.rb +0 -60
  72. data/lib/appmap/rspec/parse_node.rb +0 -41
  73. data/lib/appmap/rspec/parser.rb +0 -15
  74. data/lib/appmap/trace/event_handler/rack_handler_webrick.rb +0 -65
  75. data/lib/appmap/trace/tracer.rb +0 -356
  76. data/spec/fixtures/rails_users_app/bin/_appmap-record-self +0 -29
  77. data/spec/rack_handler_webrick_spec.rb +0 -59
  78. data/test/config_test.rb +0 -149
  79. data/test/explict_inspect_test.rb +0 -29
  80. data/test/fixtures/active_record_like/active_record.rb +0 -2
  81. data/test/fixtures/active_record_like/active_record/aggregations.rb +0 -4
  82. data/test/fixtures/active_record_like/active_record/association.rb +0 -4
  83. data/test/fixtures/active_record_like/active_record/associations/join_dependency.rb +0 -6
  84. data/test/fixtures/active_record_like/active_record/associations/join_dependency/join_base.rb +0 -8
  85. data/test/fixtures/active_record_like/active_record/associations/join_dependency/join_part.rb +0 -8
  86. data/test/fixtures/active_record_like/active_record/caps/caps.rb +0 -4
  87. data/test/fixtures/ignore_non_ruby_file/class.rb +0 -3
  88. data/test/fixtures/ignore_non_ruby_file/non-ruby.txt +0 -1
  89. data/test/fixtures/includes_excludes/lib/a/a_1.rb +0 -6
  90. data/test/fixtures/includes_excludes/lib/a/a_2.rb +0 -6
  91. data/test/fixtures/includes_excludes/lib/a/x/x_1.rb +0 -8
  92. data/test/fixtures/includes_excludes/lib/b/b_1.rb +0 -6
  93. data/test/fixtures/includes_excludes/lib/root_1.rb +0 -4
  94. data/test/fixtures/inspect_multiple_subdirs/module_a.rb +0 -2
  95. data/test/fixtures/inspect_multiple_subdirs/module_a/class_a.rb +0 -5
  96. data/test/fixtures/inspect_multiple_subdirs/module_b.rb +0 -2
  97. data/test/fixtures/inspect_multiple_subdirs/module_b/class_b.rb +0 -5
  98. data/test/fixtures/inspect_multiple_subdirs/module_b/class_c.rb +0 -5
  99. data/test/fixtures/inspect_package/module_a/module_b/class_in_module.rb +0 -6
  100. data/test/fixtures/parse_file/defs_static_function.rb +0 -96
  101. data/test/fixtures/parse_file/function_within_class.rb +0 -36
  102. data/test/fixtures/parse_file/include_public_methods.rb +0 -127
  103. data/test/fixtures/parse_file/instance_function.rb +0 -17
  104. data/test/fixtures/parse_file/modules.rb +0 -71
  105. data/test/fixtures/parse_file/sclass_static_function.rb +0 -88
  106. data/test/fixtures/parse_file/toplevel_class.rb +0 -13
  107. data/test/fixtures/parse_file/toplevel_function.rb +0 -14
  108. data/test/fixtures/trace_test/trace_program_1.rb +0 -44
  109. data/test/implicit_inspect_test.rb +0 -33
  110. data/test/include_exclude_test.rb +0 -48
  111. data/test/prerecorded_trace_test.rb +0 -76
  112. data/test/trace_test.rb +0 -92
@@ -1,36 +0,0 @@
1
- # @appmap
2
- class Main
3
- class << self
4
- # @appmap
5
- def sclass_function
6
- end
7
- end
8
-
9
- # @appmap
10
- def instance_function
11
- end
12
- end
13
-
14
- puts DATA.read
15
- __END__
16
- [
17
- {
18
- "name": "Main",
19
- "location": "$FIXTURE_DIR/function_within_class.rb:2",
20
- "type": "class",
21
- "children": [
22
- {
23
- "name": "sclass_function",
24
- "location": "$FIXTURE_DIR/function_within_class.rb:5",
25
- "type": "function",
26
- "static": true
27
- },
28
- {
29
- "name": "instance_function",
30
- "location": "$FIXTURE_DIR/function_within_class.rb:10",
31
- "type": "function",
32
- "static": false
33
- }
34
- ]
35
- }
36
- ]
@@ -1,127 +0,0 @@
1
- # @appmap include=public_methods
2
- class Main
3
- class << self
4
- def sclass_function
5
- end
6
- end
7
-
8
- def public_function
9
- end
10
-
11
- protected
12
-
13
- def protected_function
14
- end
15
-
16
- def Main.protected_function_2
17
- end
18
-
19
- def self.protected_function_3
20
- end
21
-
22
- public
23
-
24
- def public_function_2
25
- end
26
- end
27
-
28
- module Mod
29
- end
30
-
31
- # @appmap include=public_methods
32
- class M2
33
- include Mod
34
-
35
- def public_function_3
36
- end
37
- end
38
-
39
- puts DATA.read
40
- __END__
41
- {
42
- "explicit": [
43
- {
44
- "name": "Main",
45
- "location": "$FIXTURE_DIR/include_public_methods.rb:2",
46
- "attributes": {
47
- "include": "public_methods"
48
- },
49
- "type": "class",
50
- "children": [
51
- {
52
- "name": "public_function",
53
- "location": "$FIXTURE_DIR/include_public_methods.rb:8",
54
- "type": "function",
55
- "static": false
56
- },
57
- {
58
- "name": "public_function_2",
59
- "location": "$FIXTURE_DIR/include_public_methods.rb:24",
60
- "type": "function",
61
- "static": false
62
- }
63
- ]
64
- },
65
- {
66
- "name": "M2",
67
- "location": "$FIXTURE_DIR/include_public_methods.rb:32",
68
- "attributes": {
69
- "include": "public_methods"
70
- },
71
- "type": "class",
72
- "children": [
73
- {
74
- "name": "public_function_3",
75
- "location": "$FIXTURE_DIR/include_public_methods.rb:35",
76
- "type": "function",
77
- "static": false
78
- }
79
- ]
80
- }
81
- ],
82
- "implicit": [
83
- {
84
- "name": "Main",
85
- "location": "$FIXTURE_DIR/include_public_methods.rb:2",
86
- "type": "class",
87
- "children": [
88
- {
89
- "name": "sclass_function",
90
- "location": "$FIXTURE_DIR/include_public_methods.rb:4",
91
- "type": "function",
92
- "static": true
93
- },
94
- {
95
- "name": "public_function",
96
- "location": "$FIXTURE_DIR/include_public_methods.rb:8",
97
- "type": "function",
98
- "static": false
99
- },
100
- {
101
- "name": "public_function_2",
102
- "location": "$FIXTURE_DIR/include_public_methods.rb:24",
103
- "type": "function",
104
- "static": false
105
- }
106
- ]
107
- },
108
- {
109
- "name": "Mod",
110
- "location": "$FIXTURE_DIR/include_public_methods.rb:28",
111
- "type": "class"
112
- },
113
- {
114
- "name": "M2",
115
- "location": "$FIXTURE_DIR/include_public_methods.rb:32",
116
- "type": "class",
117
- "children": [
118
- {
119
- "name": "public_function_3",
120
- "location": "$FIXTURE_DIR/include_public_methods.rb:35",
121
- "type": "function",
122
- "static": false
123
- }
124
- ]
125
- }
126
- ]
127
- }
@@ -1,17 +0,0 @@
1
- class Main
2
- # @appmap
3
- def instance_func
4
- end
5
- end
6
-
7
- puts DATA.read
8
- __END__
9
- [
10
- {
11
- "name": "instance_func",
12
- "location": "$FIXTURE_DIR/instance_func.rb:3",
13
- "type": "function",
14
- "class_name": "Main",
15
- "static": false
16
- }
17
- ]
@@ -1,71 +0,0 @@
1
- module Main
2
- def main_func; end
3
-
4
- module MainModule
5
- def module_func; end
6
-
7
- def MainModule.module_class_func; end
8
- end
9
-
10
- class Cls
11
- module ClsModule
12
- def cls_module_func; end
13
- end
14
- end
15
- end
16
- puts DATA.read
17
- __END__
18
- [
19
- {
20
- "name": "Main",
21
- "location": "$FIXTURE_DIR/modules.rb:1",
22
- "type": "class",
23
- "children": [
24
- {
25
- "name": "main_func",
26
- "location": "$FIXTURE_DIR/modules.rb:2",
27
- "type": "function",
28
- "static": false
29
- },
30
- {
31
- "name": "MainModule",
32
- "location": "$FIXTURE_DIR/modules.rb:4",
33
- "type": "class",
34
- "children": [
35
- {
36
- "name": "module_func",
37
- "location": "$FIXTURE_DIR/modules.rb:5",
38
- "type": "function",
39
- "static": false
40
- },
41
- {
42
- "name": "module_class_func",
43
- "location": "$FIXTURE_DIR/modules.rb:7",
44
- "type": "function",
45
- "static": true
46
- }
47
- ]
48
- },
49
- {
50
- "name": "Cls",
51
- "location": "$FIXTURE_DIR/modules.rb:10",
52
- "type": "class",
53
- "children": [
54
- {
55
- "name": "ClsModule",
56
- "location": "$FIXTURE_DIR/modules.rb:11",
57
- "type": "class",
58
- "children": [
59
- {
60
- "name": "cls_module_func",
61
- "location": "$FIXTURE_DIR/modules.rb:12",
62
- "type": "function",
63
- "static": false
64
- }
65
- ]
66
- }
67
- ]
68
- }
69
- ]
70
- }
71
- ]
@@ -1,88 +0,0 @@
1
- obj = Object.new
2
- class << obj
3
- # @appmap
4
- def object_sclass_func
5
- end
6
- end
7
-
8
- class Main
9
- class << self
10
- # @appmap
11
- def main_sclass_func_1
12
- end
13
- end
14
- end
15
-
16
- class Main2
17
- class << self
18
- # @appmap
19
- def main_sclass_func_1
20
- end
21
-
22
- # @appmap
23
- def main_sclass_func_2
24
- end
25
- end
26
- end
27
-
28
- puts DATA.read
29
- __END__
30
- {
31
- "explicit": [
32
- {
33
- "name": "main_sclass_func_1",
34
- "location": "$FIXTURE_DIR/sclass_static_function.rb:11",
35
- "type": "function",
36
- "class_name": "Main",
37
- "static": true
38
- },
39
- {
40
- "name": "main_sclass_func_1",
41
- "location": "$FIXTURE_DIR/sclass_static_function.rb:19",
42
- "type": "function",
43
- "class_name": "Main2",
44
- "static": true
45
- },
46
- {
47
- "name": "main_sclass_func_2",
48
- "location": "$FIXTURE_DIR/sclass_static_function.rb:23",
49
- "type": "function",
50
- "class_name": "Main2",
51
- "static": true
52
- }
53
- ],
54
- "implicit": [
55
- {
56
- "name": "Main",
57
- "location": "$FIXTURE_DIR/sclass_static_function.rb:8",
58
- "type": "class",
59
- "children": [
60
- {
61
- "name": "main_sclass_func_1",
62
- "location": "$FIXTURE_DIR/sclass_static_function.rb:11",
63
- "type": "function",
64
- "static": true
65
- }
66
- ]
67
- },
68
- {
69
- "name": "Main2",
70
- "location": "$FIXTURE_DIR/sclass_static_function.rb:16",
71
- "type": "class",
72
- "children": [
73
- {
74
- "name": "main_sclass_func_1",
75
- "location": "$FIXTURE_DIR/sclass_static_function.rb:19",
76
- "type": "function",
77
- "static": true
78
- },
79
- {
80
- "name": "main_sclass_func_2",
81
- "location": "$FIXTURE_DIR/sclass_static_function.rb:23",
82
- "type": "function",
83
- "static": true
84
- }
85
- ]
86
- }
87
- ]
88
- }
@@ -1,13 +0,0 @@
1
- # @appmap
2
- class Main
3
- end
4
-
5
- puts DATA.read
6
- __END__
7
- [
8
- {
9
- "name": "Main",
10
- "location": "$FIXTURE_DIR/toplevel_class.rb:2",
11
- "type": "class"
12
- }
13
- ]
@@ -1,14 +0,0 @@
1
- # @appmap
2
- def main
3
- end
4
-
5
- puts DATA.read
6
- __END__
7
- [
8
- {
9
- "name": "main",
10
- "location": "$FIXTURE_DIR/toplevel_function.rb:2",
11
- "type": "function",
12
- "static": false
13
- }
14
- ]
@@ -1,44 +0,0 @@
1
- module Fixtures
2
- module TraceTest
3
- module TraceProgram1
4
- class Main
5
- def initialize(printer)
6
- @printer = printer
7
- end
8
-
9
- def say(msg)
10
- @printer.say(msg)
11
- end
12
- end
13
-
14
- module Printer
15
- # Stdout is a class with a 'say' instance method.
16
- class Stdout
17
- def say(msg)
18
- puts(msg)
19
- end
20
- end
21
-
22
- # Define 'say' on a static class method.
23
- class Stderr
24
- class << self
25
- def say(msg)
26
- warn(msg)
27
- end
28
- end
29
- end
30
-
31
- # make_stderr_printer builds an object which modifies 'say' to print to stderr.
32
- def Printer.make_stderr_printer
33
- Stdout.new.tap do |err_printer|
34
- class << err_printer
35
- def say(msg)
36
- warn(msg)
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,33 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ImplicitInspectTest < Minitest::Test
4
- include FixtureFile
5
-
6
- def test_toplevel_class
7
- assert_fixture_features :implicit, 'toplevel_class.rb'
8
- end
9
-
10
- def test_defs_static_function
11
- assert_fixture_features :implicit, 'defs_static_function.rb'
12
- end
13
-
14
- def test_sclass_static_function
15
- assert_fixture_features :implicit, 'sclass_static_function.rb'
16
- end
17
-
18
- def test_toplevel_function
19
- assert_fixture_features :implicit, 'toplevel_function.rb'
20
- end
21
-
22
- def test_function_within_class
23
- assert_fixture_features :implicit, 'function_within_class.rb'
24
- end
25
-
26
- def test_include_public_methods
27
- assert_fixture_features :implicit, 'include_public_methods.rb'
28
- end
29
-
30
- def test_modules
31
- assert_fixture_features :implicit, 'modules.rb'
32
- end
33
- end