appmap 0.23.0 → 0.27.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 +2 -0
- data/.rubocop.yml +17 -8
- data/.travis.yml +6 -0
- data/CHANGELOG.md +43 -0
- data/README.md +33 -21
- data/Rakefile +3 -3
- data/appmap.gemspec +3 -1
- data/exe/appmap +5 -73
- data/lib/appmap.rb +61 -6
- data/lib/appmap/algorithm/prune_class_map.rb +2 -0
- data/lib/appmap/algorithm/stats.rb +4 -2
- data/lib/appmap/class_map.rb +143 -0
- data/lib/appmap/command/record.rb +8 -6
- data/lib/appmap/command/stats.rb +2 -0
- data/lib/appmap/event.rb +168 -0
- data/lib/appmap/hook.rb +152 -0
- data/lib/appmap/middleware/remote_recording.rb +14 -21
- data/lib/appmap/rails/action_handler.rb +10 -6
- data/lib/appmap/rails/sql_handler.rb +10 -13
- data/lib/appmap/railtie.rb +31 -18
- data/lib/appmap/rspec.rb +247 -260
- data/lib/appmap/trace.rb +88 -0
- data/lib/appmap/version.rb +1 -1
- data/package-lock.json +90 -92
- data/spec/abstract_controller4_base_spec.rb +1 -1
- data/spec/abstract_controller_base_spec.rb +7 -3
- data/spec/config_spec.rb +25 -0
- data/spec/fixtures/hook/attr_accessor.rb +5 -0
- data/spec/fixtures/hook/class_method.rb +17 -0
- data/spec/fixtures/hook/constructor.rb +7 -0
- data/spec/fixtures/hook/exception_method.rb +11 -0
- data/spec/fixtures/hook/instance_method.rb +23 -0
- data/spec/fixtures/rails4_users_app/app/controllers/api/users_controller.rb +3 -3
- data/spec/fixtures/rails4_users_app/config/database.yml +2 -1
- data/spec/fixtures/rails4_users_app/docker-compose.yml +2 -0
- data/spec/fixtures/rails_users_app/.ruby-version +1 -1
- data/spec/fixtures/rails_users_app/app/controllers/api/users_controller.rb +2 -2
- data/spec/fixtures/rails_users_app/config/database.yml +2 -1
- data/spec/fixtures/rails_users_app/create_app +1 -0
- data/spec/fixtures/rails_users_app/docker-compose.yml +4 -0
- data/spec/fixtures/rails_users_app/spec/models/user_spec.rb +1 -1
- data/spec/hook_spec.rb +369 -0
- data/spec/rails_spec_helper.rb +25 -16
- data/spec/railtie_spec.rb +1 -1
- data/spec/record_sql_rails_pg_spec.rb +1 -2
- data/spec/remote_recording_spec.rb +117 -0
- data/spec/spec_helper.rb +5 -0
- data/test/cli_test.rb +4 -46
- data/test/fixtures/cli_record_test/appmap.yml +2 -1
- data/test/fixtures/cli_record_test/lib/cli_record_test/main.rb +4 -2
- data/test/fixtures/rspec_recorder/Gemfile +1 -1
- data/test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb +12 -0
- data/test/rspec_test.rb +5 -0
- data/test/test_helper.rb +0 -42
- metadata +46 -63
- data/exe/_appmap-record-self +0 -49
- data/lib/appmap/command/inspect.rb +0 -14
- data/lib/appmap/command/upload.rb +0 -99
- data/lib/appmap/config.rb +0 -65
- data/lib/appmap/config/directory.rb +0 -65
- data/lib/appmap/config/file.rb +0 -13
- data/lib/appmap/config/named_function.rb +0 -21
- data/lib/appmap/config/package_dir.rb +0 -52
- data/lib/appmap/config/path.rb +0 -25
- data/lib/appmap/feature.rb +0 -262
- data/lib/appmap/inspect.rb +0 -91
- data/lib/appmap/inspect/inspector.rb +0 -99
- data/lib/appmap/inspect/parse_node.rb +0 -170
- data/lib/appmap/inspect/parser.rb +0 -15
- data/lib/appmap/parser.rb +0 -60
- data/lib/appmap/rspec/parse_node.rb +0 -41
- data/lib/appmap/rspec/parser.rb +0 -15
- data/lib/appmap/trace/event_handler/rack_handler_webrick.rb +0 -65
- data/lib/appmap/trace/tracer.rb +0 -356
- data/spec/fixtures/rails_users_app/bin/_appmap-record-self +0 -29
- data/spec/rack_handler_webrick_spec.rb +0 -59
- data/test/config_test.rb +0 -149
- data/test/explict_inspect_test.rb +0 -29
- data/test/fixtures/active_record_like/active_record.rb +0 -2
- data/test/fixtures/active_record_like/active_record/aggregations.rb +0 -4
- data/test/fixtures/active_record_like/active_record/association.rb +0 -4
- data/test/fixtures/active_record_like/active_record/associations/join_dependency.rb +0 -6
- data/test/fixtures/active_record_like/active_record/associations/join_dependency/join_base.rb +0 -8
- data/test/fixtures/active_record_like/active_record/associations/join_dependency/join_part.rb +0 -8
- data/test/fixtures/active_record_like/active_record/caps/caps.rb +0 -4
- data/test/fixtures/ignore_non_ruby_file/class.rb +0 -3
- data/test/fixtures/ignore_non_ruby_file/non-ruby.txt +0 -1
- data/test/fixtures/includes_excludes/lib/a/a_1.rb +0 -6
- data/test/fixtures/includes_excludes/lib/a/a_2.rb +0 -6
- data/test/fixtures/includes_excludes/lib/a/x/x_1.rb +0 -8
- data/test/fixtures/includes_excludes/lib/b/b_1.rb +0 -6
- data/test/fixtures/includes_excludes/lib/root_1.rb +0 -4
- data/test/fixtures/inspect_multiple_subdirs/module_a.rb +0 -2
- data/test/fixtures/inspect_multiple_subdirs/module_a/class_a.rb +0 -5
- data/test/fixtures/inspect_multiple_subdirs/module_b.rb +0 -2
- data/test/fixtures/inspect_multiple_subdirs/module_b/class_b.rb +0 -5
- data/test/fixtures/inspect_multiple_subdirs/module_b/class_c.rb +0 -5
- data/test/fixtures/inspect_package/module_a/module_b/class_in_module.rb +0 -6
- data/test/fixtures/parse_file/defs_static_function.rb +0 -96
- data/test/fixtures/parse_file/function_within_class.rb +0 -36
- data/test/fixtures/parse_file/include_public_methods.rb +0 -127
- data/test/fixtures/parse_file/instance_function.rb +0 -17
- data/test/fixtures/parse_file/modules.rb +0 -71
- data/test/fixtures/parse_file/sclass_static_function.rb +0 -88
- data/test/fixtures/parse_file/toplevel_class.rb +0 -13
- data/test/fixtures/parse_file/toplevel_function.rb +0 -14
- data/test/fixtures/trace_test/trace_program_1.rb +0 -44
- data/test/implicit_inspect_test.rb +0 -33
- data/test/include_exclude_test.rb +0 -48
- data/test/prerecorded_trace_test.rb +0 -76
- data/test/trace_test.rb +0 -92
data/spec/rails_spec_helper.rb
CHANGED
|
@@ -3,7 +3,7 @@ require 'open3'
|
|
|
3
3
|
|
|
4
4
|
def wait_for_container(app_name)
|
|
5
5
|
start_time = Time.now
|
|
6
|
-
until
|
|
6
|
+
until `docker-compose ps -q --filter health=healthy #{app_name}`.strip != ''
|
|
7
7
|
elapsed = Time.now - start_time
|
|
8
8
|
raise "Timeout waiting for container #{app_name} to be ready" if elapsed > 10
|
|
9
9
|
|
|
@@ -12,31 +12,40 @@ def wait_for_container(app_name)
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def run_cmd(*cmd)
|
|
16
|
-
out,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
def run_cmd(*cmd, &failed)
|
|
16
|
+
out, status = Open3.capture2e(*cmd)
|
|
17
|
+
return [ out, status ] if status.success?
|
|
18
|
+
|
|
19
|
+
warn <<~WARNING
|
|
20
|
+
Command failed:
|
|
21
|
+
#{cmd}
|
|
22
|
+
<<< Output:
|
|
23
|
+
#{out}
|
|
24
|
+
>>> End of output
|
|
25
|
+
WARNING
|
|
26
|
+
failed&.call
|
|
27
|
+
raise 'Command failed'
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
shared_context 'Rails app pg database' do
|
|
30
31
|
before(:all) do
|
|
31
|
-
raise
|
|
32
|
-
|
|
32
|
+
raise 'you must set @fixure_dir' unless @fixture_dir
|
|
33
|
+
|
|
34
|
+
print_pg_logs = lambda do
|
|
35
|
+
logs, = run_cmd 'docker-compose logs pg'
|
|
36
|
+
puts "docker-compose logs for pg:"
|
|
37
|
+
puts
|
|
38
|
+
puts logs
|
|
39
|
+
end
|
|
40
|
+
|
|
33
41
|
Dir.chdir @fixture_dir do
|
|
42
|
+
run_cmd 'docker-compose down -v'
|
|
34
43
|
cmd = 'docker-compose up -d pg'
|
|
35
44
|
run_cmd cmd
|
|
36
45
|
wait_for_container 'pg'
|
|
37
46
|
|
|
38
47
|
cmd = 'docker-compose run --rm app ./create_app'
|
|
39
|
-
run_cmd cmd
|
|
48
|
+
run_cmd cmd, &print_pg_logs
|
|
40
49
|
end
|
|
41
50
|
end
|
|
42
51
|
|
data/spec/railtie_spec.rb
CHANGED
|
@@ -32,7 +32,7 @@ describe 'AppMap tracer via Railtie' do
|
|
|
32
32
|
describe 'with APPMAP=true' do
|
|
33
33
|
let(:env) { { 'APPMAP' => 'true' } }
|
|
34
34
|
it 'is enabled' do
|
|
35
|
-
expect(command_output).to
|
|
35
|
+
expect(command_output.split("\n")).to include('true')
|
|
36
36
|
end
|
|
37
37
|
context 'and RAILS_ENV=test' do
|
|
38
38
|
let(:env) { { 'APPMAP' => 'true', 'RAILS_ENV' => 'test' } }
|
|
@@ -3,13 +3,12 @@ require 'rails_spec_helper'
|
|
|
3
3
|
describe 'Record SQL queries in a Rails app' do
|
|
4
4
|
before(:all) { @fixture_dir = 'spec/fixtures/rails_users_app' }
|
|
5
5
|
include_context 'Rails app pg database'
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
around(:each) do |example|
|
|
8
8
|
FileUtils.rm_rf tmpdir
|
|
9
9
|
FileUtils.mkdir_p tmpdir
|
|
10
10
|
cmd = "docker-compose run --rm -e ORM_MODULE=#{orm_module} -e APPMAP=true -v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rspec spec/controllers/users_controller_api_spec.rb:#{test_line_number}"
|
|
11
11
|
run_cmd cmd, chdir: @fixture_dir
|
|
12
|
-
|
|
13
12
|
|
|
14
13
|
example.run
|
|
15
14
|
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
require 'rails_spec_helper'
|
|
2
|
+
require 'net/http'
|
|
3
|
+
require 'socket'
|
|
4
|
+
|
|
5
|
+
describe 'remote recording', :order => :defined do
|
|
6
|
+
before(:all) { @fixture_dir = 'spec/fixtures/rails_users_app' }
|
|
7
|
+
include_context 'Rails app pg database'
|
|
8
|
+
|
|
9
|
+
before(:all) do
|
|
10
|
+
start_cmd = 'docker-compose up -d app'
|
|
11
|
+
run_cmd({ 'ORM_MODULE' => 'sequel', 'APPMAP' => 'true' }, start_cmd, chdir: @fixture_dir)
|
|
12
|
+
Dir.chdir @fixture_dir do
|
|
13
|
+
wait_for_container 'app'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
port_cmd = 'docker-compose port app 3000'
|
|
17
|
+
port_out, = run_cmd port_cmd, chdir: @fixture_dir
|
|
18
|
+
@service_port = port_out.strip.split(':')[1]
|
|
19
|
+
|
|
20
|
+
service_running = false
|
|
21
|
+
retry_count = 0
|
|
22
|
+
uri = URI("http://localhost:#{@service_port}/health")
|
|
23
|
+
|
|
24
|
+
until service_running
|
|
25
|
+
sleep(0.25)
|
|
26
|
+
begin
|
|
27
|
+
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
|
28
|
+
http.request(Net::HTTP::Get.new(uri))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
status = res.response.code.to_i
|
|
32
|
+
service_running = true if status >= 200 && status < 300
|
|
33
|
+
|
|
34
|
+
# give up after a certain error threshold is met
|
|
35
|
+
# we don't want to wait forever if there's an unrecoverable issue
|
|
36
|
+
raise 'gave up waiting on fixture service' if (retry_count += 1) == 10
|
|
37
|
+
rescue Errno::ETIMEDOUT, Errno::ECONNRESET, EOFError
|
|
38
|
+
$stderr.print('.')
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def json_body(res)
|
|
44
|
+
JSON.parse(res.body).deep_symbolize_keys
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
after(:all) do
|
|
48
|
+
run_cmd 'docker-compose rm -fs app', chdir: @fixture_dir
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
let(:service_address) { URI("http://localhost:#{@service_port}") }
|
|
52
|
+
let(:users_path) { '/users' }
|
|
53
|
+
let(:record_path) { '/_appmap/record' }
|
|
54
|
+
|
|
55
|
+
it 'returns the recording status' do
|
|
56
|
+
res = Net::HTTP.start(service_address.hostname, service_address.port) { |http|
|
|
57
|
+
http.request(Net::HTTP::Get.new(record_path))
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
expect(res).to be_a(Net::HTTPOK)
|
|
61
|
+
expect(res['Content-Type']).to eq('application/json')
|
|
62
|
+
expect(json_body(res)).to eq(enabled: false)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'starts a new recording session' do
|
|
66
|
+
res = Net::HTTP.start(service_address.hostname, service_address.port) { |http|
|
|
67
|
+
http.request(Net::HTTP::Post.new(record_path))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
expect(res).to be_a(Net::HTTPOK)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'reflects the recording status' do
|
|
74
|
+
res = Net::HTTP.start(service_address.hostname, service_address.port) { |http|
|
|
75
|
+
http.request(Net::HTTP::Get.new(record_path))
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
expect(res).to be_a(Net::HTTPOK)
|
|
79
|
+
expect(res['Content-Type']).to eq('application/json')
|
|
80
|
+
expect(json_body(res)).to eq(enabled: true)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'fails to start a new recording session while recording is already active' do
|
|
84
|
+
res = Net::HTTP.start(service_address.hostname, service_address.port) { |http|
|
|
85
|
+
http.request(Net::HTTP::Post.new(record_path))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
expect(res).to be_a(Net::HTTPConflict)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it 'stops recording' do
|
|
92
|
+
# Generate some events
|
|
93
|
+
Net::HTTP.start(service_address.hostname, service_address.port) { |http|
|
|
94
|
+
http.request(Net::HTTP::Get.new(users_path) )
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
res = Net::HTTP.start(service_address.hostname, service_address.port) { |http|
|
|
98
|
+
http.request(Net::HTTP::Delete.new(record_path))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
expect(res).to be_a(Net::HTTPOK)
|
|
102
|
+
expect(res['Content-Type']).to eq('application/json')
|
|
103
|
+
|
|
104
|
+
data = json_body(res)
|
|
105
|
+
expect(data[:metadata]).to be_truthy
|
|
106
|
+
expect(data[:classMap].length).to be > 0
|
|
107
|
+
expect(data[:events].length).to be > 0
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it 'fails to stop recording if there is no active recording session' do
|
|
111
|
+
res = Net::HTTP.start(service_address.hostname, service_address.port) { |http|
|
|
112
|
+
http.request(Net::HTTP::Delete.new(record_path))
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
expect(res).to be_a(Net::HTTPNotFound)
|
|
116
|
+
end
|
|
117
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/test/cli_test.rb
CHANGED
|
@@ -13,40 +13,6 @@ class CLITest < Minitest::Test
|
|
|
13
13
|
FileUtils.rm_f STATS_OUTPUT_FILENAME
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def test_config_file_must_exist
|
|
17
|
-
output = `./exe/appmap -c foobar inspect 2>&1`
|
|
18
|
-
|
|
19
|
-
assert_equal 1, $CHILD_STATUS.exitstatus
|
|
20
|
-
assert_includes output, 'No such file or directory'
|
|
21
|
-
assert_includes output, 'foobar'
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def test_inspect_to_file
|
|
25
|
-
`./exe/appmap inspect -o #{OUTPUT_FILENAME}`
|
|
26
|
-
|
|
27
|
-
assert_equal 0, $CHILD_STATUS.exitstatus
|
|
28
|
-
assert File.file?(OUTPUT_FILENAME), "#{OUTPUT_FILENAME} does not exist"
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_inspect_to_stdout
|
|
32
|
-
output = `./exe/appmap inspect -o -`
|
|
33
|
-
|
|
34
|
-
assert !File.file?(OUTPUT_FILENAME), "#{OUTPUT_FILENAME} should not exist"
|
|
35
|
-
|
|
36
|
-
assert_equal 0, $CHILD_STATUS.exitstatus
|
|
37
|
-
assert !output.blank?, 'Output should exist in stdout'
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def test_inspect_fields
|
|
41
|
-
output = `./exe/appmap inspect -o -`
|
|
42
|
-
|
|
43
|
-
output = JSON.parse(output)
|
|
44
|
-
assert_includes output.keys, 'version'
|
|
45
|
-
assert_includes output.keys, 'classMap'
|
|
46
|
-
assert_includes output.keys, 'metadata'
|
|
47
|
-
assert !output.keys.include?('events')
|
|
48
|
-
end
|
|
49
|
-
|
|
50
16
|
def test_record
|
|
51
17
|
output = Dir.chdir 'test/fixtures/cli_record_test' do
|
|
52
18
|
`#{File.expand_path '../exe/appmap', __dir__} record -o #{OUTPUT_FILENAME} ./lib/cli_record_test/main.rb`.strip
|
|
@@ -141,18 +107,10 @@ class CLITest < Minitest::Test
|
|
|
141
107
|
end
|
|
142
108
|
|
|
143
109
|
assert_equal 0, $CHILD_STATUS.exitstatus
|
|
144
|
-
|
|
110
|
+
# Event path
|
|
111
|
+
assert_includes output, %("path":"lib/cli_record_test/main.rb")
|
|
112
|
+
# Function location
|
|
113
|
+
assert_includes output, %("location":"lib/cli_record_test/main.rb:3")
|
|
145
114
|
assert !File.file?(OUTPUT_FILENAME), "#{OUTPUT_FILENAME} should not exist"
|
|
146
115
|
end
|
|
147
|
-
|
|
148
|
-
def test_upload
|
|
149
|
-
`./exe/appmap inspect -o #{OUTPUT_FILENAME}`
|
|
150
|
-
|
|
151
|
-
upload_output = `./exe/appmap upload --no-open #{OUTPUT_FILENAME}`
|
|
152
|
-
assert_equal 0, $CHILD_STATUS.exitstatus
|
|
153
|
-
# Example: 93e1e07d-4b39-49ac-82bf-27d63e296cae
|
|
154
|
-
assert_match(/Scenario Id/, upload_output)
|
|
155
|
-
assert_match(/Batch Id/, upload_output)
|
|
156
|
-
assert_match(/[0-9a-f]+\-[0-9a-f\-]+/, upload_output)
|
|
157
|
-
end
|
|
158
116
|
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
|
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
|
|
data/test/test_helper.rb
CHANGED
|
@@ -2,45 +2,3 @@ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
|
|
2
2
|
require 'appmap'
|
|
3
3
|
|
|
4
4
|
require 'minitest/autorun'
|
|
5
|
-
|
|
6
|
-
FIXTURE_DIR = File.join(__dir__, 'fixtures')
|
|
7
|
-
PARSE_FILE_FIXTURE_DIR = File.join(FIXTURE_DIR, 'parse_file')
|
|
8
|
-
INSPECT_PACKAGE_FIXTURE_DIR = File.join(FIXTURE_DIR, 'inspect_package')
|
|
9
|
-
|
|
10
|
-
module FixturePath
|
|
11
|
-
def parse_fixture_file(path)
|
|
12
|
-
File.join(FIXTURE_DIR, 'parse_file', path)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
module FixtureFile
|
|
17
|
-
include FixturePath
|
|
18
|
-
|
|
19
|
-
def assert_fixture_features(strategy, path)
|
|
20
|
-
require 'appmap/inspect'
|
|
21
|
-
|
|
22
|
-
features = Array(AppMap::Inspect.inspect_file(strategy, file_path: parse_fixture_file(path)))
|
|
23
|
-
|
|
24
|
-
fixup_fixture_path = lambda do |a|
|
|
25
|
-
a.location = a.location.gsub(PARSE_FILE_FIXTURE_DIR, '$FIXTURE_DIR')
|
|
26
|
-
a.children.each(&fixup_fixture_path)
|
|
27
|
-
end
|
|
28
|
-
features.each(&fixup_fixture_path)
|
|
29
|
-
|
|
30
|
-
expectation = JSON.parse(`ruby #{parse_fixture_file(path)}`)
|
|
31
|
-
expectation = expectation[strategy.to_s] \
|
|
32
|
-
if expectation.is_a?(Hash) && expectation[strategy.to_s]
|
|
33
|
-
warn JSON.pretty_generate(features.map(&:to_h)) if ENV['DEBUG']
|
|
34
|
-
assert_equal JSON.pretty_generate(expectation),
|
|
35
|
-
JSON.pretty_generate(features.map(&:to_h))
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# Verify that the fixture files are valid
|
|
40
|
-
Dir.new(PARSE_FILE_FIXTURE_DIR)
|
|
41
|
-
.entries
|
|
42
|
-
.select { |e| File.file?(File.join(PARSE_FILE_FIXTURE_DIR, e)) && e.index('.rb') == e.size - 3 }
|
|
43
|
-
.each do |e|
|
|
44
|
-
fname = File.join(PARSE_FILE_FIXTURE_DIR, e)
|
|
45
|
-
raise "Fixture #{fname.inspect} is not valid" unless system("ruby #{fname} > /dev/null")
|
|
46
|
-
end
|
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.27.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-06-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -112,16 +112,16 @@ dependencies:
|
|
|
112
112
|
name: rake
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
|
-
- - "
|
|
115
|
+
- - ">="
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
117
|
+
version: 12.3.3
|
|
118
118
|
type: :development
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
|
-
- - "
|
|
122
|
+
- - ">="
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version:
|
|
124
|
+
version: 12.3.3
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
126
|
name: rdoc
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -136,6 +136,20 @@ dependencies:
|
|
|
136
136
|
- - ">="
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: rubocop
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
139
153
|
- !ruby/object:Gem::Dependency
|
|
140
154
|
name: climate_control
|
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,6 +164,20 @@ dependencies:
|
|
|
150
164
|
- - ">="
|
|
151
165
|
- !ruby/object:Gem::Version
|
|
152
166
|
version: '0'
|
|
167
|
+
- !ruby/object:Gem::Dependency
|
|
168
|
+
name: diffy
|
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - ">="
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: '0'
|
|
174
|
+
type: :development
|
|
175
|
+
prerelease: false
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - ">="
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: '0'
|
|
153
181
|
- !ruby/object:Gem::Dependency
|
|
154
182
|
name: launchy
|
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -210,7 +238,6 @@ description:
|
|
|
210
238
|
email:
|
|
211
239
|
- kgilpin@gmail.com
|
|
212
240
|
executables:
|
|
213
|
-
- _appmap-record-self
|
|
214
241
|
- appmap
|
|
215
242
|
extensions: []
|
|
216
243
|
extra_rdoc_files: []
|
|
@@ -235,36 +262,21 @@ files:
|
|
|
235
262
|
- examples/mock_webapp/lib/mock_webapp/controller.rb
|
|
236
263
|
- examples/mock_webapp/lib/mock_webapp/request.rb
|
|
237
264
|
- examples/mock_webapp/lib/mock_webapp/user.rb
|
|
238
|
-
- exe/_appmap-record-self
|
|
239
265
|
- exe/appmap
|
|
240
266
|
- lib/appmap.rb
|
|
241
267
|
- lib/appmap/algorithm/prune_class_map.rb
|
|
242
268
|
- lib/appmap/algorithm/stats.rb
|
|
243
|
-
- lib/appmap/
|
|
269
|
+
- lib/appmap/class_map.rb
|
|
244
270
|
- lib/appmap/command/record.rb
|
|
245
271
|
- lib/appmap/command/stats.rb
|
|
246
|
-
- lib/appmap/
|
|
247
|
-
- lib/appmap/
|
|
248
|
-
- lib/appmap/config/directory.rb
|
|
249
|
-
- lib/appmap/config/file.rb
|
|
250
|
-
- lib/appmap/config/named_function.rb
|
|
251
|
-
- lib/appmap/config/package_dir.rb
|
|
252
|
-
- lib/appmap/config/path.rb
|
|
253
|
-
- lib/appmap/feature.rb
|
|
254
|
-
- lib/appmap/inspect.rb
|
|
255
|
-
- lib/appmap/inspect/inspector.rb
|
|
256
|
-
- lib/appmap/inspect/parse_node.rb
|
|
257
|
-
- lib/appmap/inspect/parser.rb
|
|
272
|
+
- lib/appmap/event.rb
|
|
273
|
+
- lib/appmap/hook.rb
|
|
258
274
|
- lib/appmap/middleware/remote_recording.rb
|
|
259
|
-
- lib/appmap/parser.rb
|
|
260
275
|
- lib/appmap/rails/action_handler.rb
|
|
261
276
|
- lib/appmap/rails/sql_handler.rb
|
|
262
277
|
- lib/appmap/railtie.rb
|
|
263
278
|
- lib/appmap/rspec.rb
|
|
264
|
-
- lib/appmap/
|
|
265
|
-
- lib/appmap/rspec/parser.rb
|
|
266
|
-
- lib/appmap/trace/event_handler/rack_handler_webrick.rb
|
|
267
|
-
- lib/appmap/trace/tracer.rb
|
|
279
|
+
- lib/appmap/trace.rb
|
|
268
280
|
- lib/appmap/version.rb
|
|
269
281
|
- lore/pages/2019-05-21-install-and-record/index.pug
|
|
270
282
|
- lore/pages/2019-05-21-install-and-record/install_example_appmap.png
|
|
@@ -287,6 +299,12 @@ files:
|
|
|
287
299
|
- package.json
|
|
288
300
|
- spec/abstract_controller4_base_spec.rb
|
|
289
301
|
- spec/abstract_controller_base_spec.rb
|
|
302
|
+
- spec/config_spec.rb
|
|
303
|
+
- spec/fixtures/hook/attr_accessor.rb
|
|
304
|
+
- spec/fixtures/hook/class_method.rb
|
|
305
|
+
- spec/fixtures/hook/constructor.rb
|
|
306
|
+
- spec/fixtures/hook/exception_method.rb
|
|
307
|
+
- spec/fixtures/hook/instance_method.rb
|
|
290
308
|
- spec/fixtures/rack_users_app/.dockerignore
|
|
291
309
|
- spec/fixtures/rack_users_app/.gitignore
|
|
292
310
|
- spec/fixtures/rack_users_app/Dockerfile
|
|
@@ -378,7 +396,6 @@ files:
|
|
|
378
396
|
- spec/fixtures/rails_users_app/app/views/layouts/application.html.haml
|
|
379
397
|
- spec/fixtures/rails_users_app/app/views/users/index.html.haml
|
|
380
398
|
- spec/fixtures/rails_users_app/appmap.yml
|
|
381
|
-
- spec/fixtures/rails_users_app/bin/_appmap-record-self
|
|
382
399
|
- spec/fixtures/rails_users_app/bin/appmap
|
|
383
400
|
- spec/fixtures/rails_users_app/bin/byebug
|
|
384
401
|
- spec/fixtures/rails_users_app/bin/gli
|
|
@@ -427,59 +444,25 @@ files:
|
|
|
427
444
|
- spec/fixtures/rails_users_app/spec/rails_helper.rb
|
|
428
445
|
- spec/fixtures/rails_users_app/spec/spec_helper.rb
|
|
429
446
|
- spec/fixtures/rails_users_app/users_app/.gitignore
|
|
430
|
-
- spec/
|
|
447
|
+
- spec/hook_spec.rb
|
|
431
448
|
- spec/rails_spec_helper.rb
|
|
432
449
|
- spec/railtie_spec.rb
|
|
433
450
|
- spec/record_sql_rails4_pg_spec.rb
|
|
434
451
|
- spec/record_sql_rails_pg_spec.rb
|
|
452
|
+
- spec/remote_recording_spec.rb
|
|
435
453
|
- spec/rspec_feature_metadata_spec.rb
|
|
436
454
|
- spec/spec_helper.rb
|
|
437
455
|
- test/cli_test.rb
|
|
438
|
-
- test/config_test.rb
|
|
439
|
-
- test/explict_inspect_test.rb
|
|
440
|
-
- test/fixtures/active_record_like/active_record.rb
|
|
441
|
-
- test/fixtures/active_record_like/active_record/aggregations.rb
|
|
442
|
-
- test/fixtures/active_record_like/active_record/association.rb
|
|
443
|
-
- test/fixtures/active_record_like/active_record/associations/join_dependency.rb
|
|
444
|
-
- test/fixtures/active_record_like/active_record/associations/join_dependency/join_base.rb
|
|
445
|
-
- test/fixtures/active_record_like/active_record/associations/join_dependency/join_part.rb
|
|
446
|
-
- test/fixtures/active_record_like/active_record/caps/caps.rb
|
|
447
456
|
- test/fixtures/cli_record_test/appmap.yml
|
|
448
457
|
- test/fixtures/cli_record_test/lib/cli_record_test/main.rb
|
|
449
|
-
- test/fixtures/ignore_non_ruby_file/class.rb
|
|
450
|
-
- test/fixtures/ignore_non_ruby_file/non-ruby.txt
|
|
451
|
-
- test/fixtures/includes_excludes/lib/a/a_1.rb
|
|
452
|
-
- test/fixtures/includes_excludes/lib/a/a_2.rb
|
|
453
|
-
- test/fixtures/includes_excludes/lib/a/x/x_1.rb
|
|
454
|
-
- test/fixtures/includes_excludes/lib/b/b_1.rb
|
|
455
|
-
- test/fixtures/includes_excludes/lib/root_1.rb
|
|
456
|
-
- test/fixtures/inspect_multiple_subdirs/module_a.rb
|
|
457
|
-
- test/fixtures/inspect_multiple_subdirs/module_a/class_a.rb
|
|
458
|
-
- test/fixtures/inspect_multiple_subdirs/module_b.rb
|
|
459
|
-
- test/fixtures/inspect_multiple_subdirs/module_b/class_b.rb
|
|
460
|
-
- test/fixtures/inspect_multiple_subdirs/module_b/class_c.rb
|
|
461
|
-
- test/fixtures/inspect_package/module_a/module_b/class_in_module.rb
|
|
462
|
-
- test/fixtures/parse_file/defs_static_function.rb
|
|
463
|
-
- test/fixtures/parse_file/function_within_class.rb
|
|
464
|
-
- test/fixtures/parse_file/include_public_methods.rb
|
|
465
|
-
- test/fixtures/parse_file/instance_function.rb
|
|
466
|
-
- test/fixtures/parse_file/modules.rb
|
|
467
|
-
- test/fixtures/parse_file/sclass_static_function.rb
|
|
468
|
-
- test/fixtures/parse_file/toplevel_class.rb
|
|
469
|
-
- test/fixtures/parse_file/toplevel_function.rb
|
|
470
458
|
- test/fixtures/rspec_recorder/Gemfile
|
|
471
459
|
- test/fixtures/rspec_recorder/appmap.yml
|
|
472
460
|
- test/fixtures/rspec_recorder/lib/hello.rb
|
|
473
461
|
- test/fixtures/rspec_recorder/spec/decorated_hello_spec.rb
|
|
474
462
|
- test/fixtures/rspec_recorder/spec/labeled_hello_spec.rb
|
|
475
463
|
- test/fixtures/rspec_recorder/spec/plain_hello_spec.rb
|
|
476
|
-
- test/fixtures/trace_test/trace_program_1.rb
|
|
477
|
-
- test/implicit_inspect_test.rb
|
|
478
|
-
- test/include_exclude_test.rb
|
|
479
|
-
- test/prerecorded_trace_test.rb
|
|
480
464
|
- test/rspec_test.rb
|
|
481
465
|
- test/test_helper.rb
|
|
482
|
-
- test/trace_test.rb
|
|
483
466
|
homepage: https://github.com/applandinc/appmap-ruby
|
|
484
467
|
licenses:
|
|
485
468
|
- MIT
|