appmap 0.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.dockerignore +5 -0
- data/.gitignore +17 -0
- data/.rubocop.yml +18 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +100 -0
- data/Dockerfile.appmap +5 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +133 -0
- data/Rakefile +117 -0
- data/appmap.gemspec +41 -0
- data/appmap.yml +8 -0
- data/examples/install.rb +76 -0
- data/examples/mock_webapp/Gemfile +1 -0
- data/examples/mock_webapp/appmap.yml +2 -0
- data/examples/mock_webapp/exe/mock_webapp_request +12 -0
- data/examples/mock_webapp/lib/mock_webapp/controller.rb +23 -0
- data/examples/mock_webapp/lib/mock_webapp/request.rb +12 -0
- data/examples/mock_webapp/lib/mock_webapp/user.rb +18 -0
- data/exe/_appmap-record-self +49 -0
- data/exe/appmap +168 -0
- data/lib/appmap/algorithm/prune_class_map.rb +65 -0
- data/lib/appmap/command/inspect.rb +11 -0
- data/lib/appmap/command/record.rb +91 -0
- data/lib/appmap/command/upload.rb +103 -0
- data/lib/appmap/config/directory.rb +65 -0
- data/lib/appmap/config/file.rb +13 -0
- data/lib/appmap/config/named_function.rb +21 -0
- data/lib/appmap/config/package_dir.rb +52 -0
- data/lib/appmap/config/path.rb +25 -0
- data/lib/appmap/config.rb +65 -0
- data/lib/appmap/feature.rb +262 -0
- data/lib/appmap/inspect/inspector.rb +99 -0
- data/lib/appmap/inspect/parse_node.rb +170 -0
- data/lib/appmap/inspect/parser.rb +15 -0
- data/lib/appmap/inspect.rb +91 -0
- data/lib/appmap/middleware/remote_recording.rb +122 -0
- data/lib/appmap/parser.rb +60 -0
- data/lib/appmap/rails/action_handler.rb +77 -0
- data/lib/appmap/rails/sql_handler.rb +148 -0
- data/lib/appmap/railtie.rb +32 -0
- data/lib/appmap/rspec/parse_node.rb +41 -0
- data/lib/appmap/rspec/parser.rb +15 -0
- data/lib/appmap/rspec.rb +288 -0
- data/lib/appmap/trace/event_handler/rack_handler_webrick.rb +65 -0
- data/lib/appmap/trace/tracer.rb +347 -0
- data/lib/appmap/version.rb +5 -0
- data/lib/appmap.rb +26 -0
- data/lore/pages/2019-05-21-install-and-record/index.pug +51 -0
- data/lore/pages/2019-05-21-install-and-record/install_example_appmap.png +0 -0
- data/lore/pages/2019-05-21-install-and-record/metadata.yml +5 -0
- data/lore/pages/layout.pug +66 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.css +1912 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.css.map +1 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.min.css +7 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-grid.min.css.map +1 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.css +331 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.css.map +1 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.min.css +8 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap-reboot.min.css.map +1 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.css +9030 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.css.map +1 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.min.css +7 -0
- data/lore/public/lib/bootstrap-4.1.3/css/bootstrap.min.css.map +1 -0
- data/lore/public/stylesheets/style.css +8 -0
- data/package-lock.json +1066 -0
- data/package.json +24 -0
- data/spec/abstract_controller4_base_spec.rb +58 -0
- data/spec/abstract_controller_base_spec.rb +59 -0
- data/spec/fixtures/rack_users_app/.dockerignore +2 -0
- data/spec/fixtures/rack_users_app/.gitignore +2 -0
- data/spec/fixtures/rack_users_app/Dockerfile +32 -0
- data/spec/fixtures/rack_users_app/Gemfile +10 -0
- data/spec/fixtures/rack_users_app/appmap.yml +3 -0
- data/spec/fixtures/rack_users_app/config.ru +2 -0
- data/spec/fixtures/rack_users_app/docker-compose.yml +9 -0
- data/spec/fixtures/rack_users_app/lib/app.rb +36 -0
- data/spec/fixtures/rails4_users_app/.gitignore +13 -0
- data/spec/fixtures/rails4_users_app/.rbenv-gemsets +2 -0
- data/spec/fixtures/rails4_users_app/.ruby-version +1 -0
- data/spec/fixtures/rails4_users_app/Dockerfile +30 -0
- data/spec/fixtures/rails4_users_app/Dockerfile.pg +3 -0
- data/spec/fixtures/rails4_users_app/Gemfile +77 -0
- data/spec/fixtures/rails4_users_app/README.rdoc +28 -0
- data/spec/fixtures/rails4_users_app/Rakefile +6 -0
- data/spec/fixtures/rails4_users_app/app/assets/images/.keep +0 -0
- data/spec/fixtures/rails4_users_app/app/assets/javascripts/application.js +16 -0
- data/spec/fixtures/rails4_users_app/app/assets/stylesheets/application.css +15 -0
- data/spec/fixtures/rails4_users_app/app/controllers/api/users_controller.rb +27 -0
- data/spec/fixtures/rails4_users_app/app/controllers/application_controller.rb +5 -0
- data/spec/fixtures/rails4_users_app/app/controllers/concerns/.keep +0 -0
- data/spec/fixtures/rails4_users_app/app/controllers/health_controller.rb +5 -0
- data/spec/fixtures/rails4_users_app/app/controllers/users_controller.rb +5 -0
- data/spec/fixtures/rails4_users_app/app/helpers/application_helper.rb +2 -0
- data/spec/fixtures/rails4_users_app/app/mailers/.keep +0 -0
- data/spec/fixtures/rails4_users_app/app/models/.keep +0 -0
- data/spec/fixtures/rails4_users_app/app/models/concerns/.keep +0 -0
- data/spec/fixtures/rails4_users_app/app/models/user.rb +18 -0
- data/spec/fixtures/rails4_users_app/app/views/layouts/application.html.haml +7 -0
- data/spec/fixtures/rails4_users_app/app/views/users/index.html.haml +7 -0
- data/spec/fixtures/rails4_users_app/appmap.yml +3 -0
- data/spec/fixtures/rails4_users_app/bin/rails +9 -0
- data/spec/fixtures/rails4_users_app/bin/setup +29 -0
- data/spec/fixtures/rails4_users_app/bin/spring +17 -0
- data/spec/fixtures/rails4_users_app/config/application.rb +26 -0
- data/spec/fixtures/rails4_users_app/config/boot.rb +3 -0
- data/spec/fixtures/rails4_users_app/config/database.yml +17 -0
- data/spec/fixtures/rails4_users_app/config/environment.rb +5 -0
- data/spec/fixtures/rails4_users_app/config/environments/development.rb +41 -0
- data/spec/fixtures/rails4_users_app/config/environments/production.rb +79 -0
- data/spec/fixtures/rails4_users_app/config/environments/test.rb +42 -0
- data/spec/fixtures/rails4_users_app/config/initializers/assets.rb +11 -0
- data/spec/fixtures/rails4_users_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails4_users_app/config/initializers/cookies_serializer.rb +3 -0
- data/spec/fixtures/rails4_users_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/fixtures/rails4_users_app/config/initializers/inflections.rb +16 -0
- data/spec/fixtures/rails4_users_app/config/initializers/mime_types.rb +4 -0
- data/spec/fixtures/rails4_users_app/config/initializers/session_store.rb +3 -0
- data/spec/fixtures/rails4_users_app/config/initializers/to_time_preserves_timezone.rb +10 -0
- data/spec/fixtures/rails4_users_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/fixtures/rails4_users_app/config/locales/en.yml +23 -0
- data/spec/fixtures/rails4_users_app/config/routes.rb +12 -0
- data/spec/fixtures/rails4_users_app/config/secrets.yml +22 -0
- data/spec/fixtures/rails4_users_app/config.ru +4 -0
- data/spec/fixtures/rails4_users_app/create_app +23 -0
- data/spec/fixtures/rails4_users_app/db/migrate/20191127112304_create_users.rb +10 -0
- data/spec/fixtures/rails4_users_app/db/schema.rb +26 -0
- data/spec/fixtures/rails4_users_app/db/seeds.rb +7 -0
- data/spec/fixtures/rails4_users_app/docker-compose.yml +24 -0
- data/spec/fixtures/rails4_users_app/lib/assets/.keep +0 -0
- data/spec/fixtures/rails4_users_app/lib/tasks/.keep +0 -0
- data/spec/fixtures/rails4_users_app/log/.keep +0 -0
- data/spec/fixtures/rails4_users_app/public/404.html +67 -0
- data/spec/fixtures/rails4_users_app/public/422.html +67 -0
- data/spec/fixtures/rails4_users_app/public/500.html +66 -0
- data/spec/fixtures/rails4_users_app/public/favicon.ico +0 -0
- data/spec/fixtures/rails4_users_app/public/robots.txt +5 -0
- data/spec/fixtures/rails4_users_app/spec/controllers/users_controller_api_spec.rb +49 -0
- data/spec/fixtures/rails4_users_app/spec/rails_helper.rb +95 -0
- data/spec/fixtures/rails4_users_app/spec/spec_helper.rb +96 -0
- data/spec/fixtures/rails4_users_app/test/fixtures/users.yml +9 -0
- data/spec/fixtures/rails_users_app/.dockerignore +1 -0
- data/spec/fixtures/rails_users_app/.gitignore +39 -0
- data/spec/fixtures/rails_users_app/.rspec +1 -0
- data/spec/fixtures/rails_users_app/.ruby-version +1 -0
- data/spec/fixtures/rails_users_app/Dockerfile +29 -0
- data/spec/fixtures/rails_users_app/Dockerfile.pg +3 -0
- data/spec/fixtures/rails_users_app/Gemfile +51 -0
- data/spec/fixtures/rails_users_app/Rakefile +6 -0
- data/spec/fixtures/rails_users_app/app/controllers/api/users_controller.rb +27 -0
- data/spec/fixtures/rails_users_app/app/controllers/application_controller.rb +2 -0
- data/spec/fixtures/rails_users_app/app/controllers/concerns/.keep +0 -0
- data/spec/fixtures/rails_users_app/app/controllers/health_controller.rb +5 -0
- data/spec/fixtures/rails_users_app/app/controllers/users_controller.rb +5 -0
- data/spec/fixtures/rails_users_app/app/models/activerecord/user.rb +18 -0
- data/spec/fixtures/rails_users_app/app/models/concerns/.keep +0 -0
- data/spec/fixtures/rails_users_app/app/models/sequel/user.rb +25 -0
- data/spec/fixtures/rails_users_app/app/views/layouts/application.html.haml +7 -0
- data/spec/fixtures/rails_users_app/app/views/users/index.html.haml +7 -0
- data/spec/fixtures/rails_users_app/appmap.yml +3 -0
- data/spec/fixtures/rails_users_app/bin/_appmap-record-self +29 -0
- data/spec/fixtures/rails_users_app/bin/appmap +29 -0
- data/spec/fixtures/rails_users_app/bin/byebug +29 -0
- data/spec/fixtures/rails_users_app/bin/gli +29 -0
- data/spec/fixtures/rails_users_app/bin/htmldiff +29 -0
- data/spec/fixtures/rails_users_app/bin/ldiff +29 -0
- data/spec/fixtures/rails_users_app/bin/nokogiri +29 -0
- data/spec/fixtures/rails_users_app/bin/rackup +29 -0
- data/spec/fixtures/rails_users_app/bin/rails +4 -0
- data/spec/fixtures/rails_users_app/bin/rake +29 -0
- data/spec/fixtures/rails_users_app/bin/rspec +29 -0
- data/spec/fixtures/rails_users_app/bin/ruby-parse +29 -0
- data/spec/fixtures/rails_users_app/bin/ruby-rewrite +29 -0
- data/spec/fixtures/rails_users_app/bin/sequel +29 -0
- data/spec/fixtures/rails_users_app/bin/setup +25 -0
- data/spec/fixtures/rails_users_app/bin/sprockets +29 -0
- data/spec/fixtures/rails_users_app/bin/thor +29 -0
- data/spec/fixtures/rails_users_app/bin/update +25 -0
- data/spec/fixtures/rails_users_app/config/application.rb +51 -0
- data/spec/fixtures/rails_users_app/config/boot.rb +3 -0
- data/spec/fixtures/rails_users_app/config/credentials.yml.enc +1 -0
- data/spec/fixtures/rails_users_app/config/database.yml +17 -0
- data/spec/fixtures/rails_users_app/config/environment.rb +5 -0
- data/spec/fixtures/rails_users_app/config/environments/development.rb +40 -0
- data/spec/fixtures/rails_users_app/config/environments/production.rb +68 -0
- data/spec/fixtures/rails_users_app/config/environments/test.rb +36 -0
- data/spec/fixtures/rails_users_app/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/fixtures/rails_users_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/fixtures/rails_users_app/config/initializers/cors.rb +16 -0
- data/spec/fixtures/rails_users_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/fixtures/rails_users_app/config/initializers/inflections.rb +16 -0
- data/spec/fixtures/rails_users_app/config/initializers/mime_types.rb +4 -0
- data/spec/fixtures/rails_users_app/config/initializers/record_button.rb +3 -0
- data/spec/fixtures/rails_users_app/config/initializers/wrap_parameters.rb +9 -0
- data/spec/fixtures/rails_users_app/config/locales/en.yml +33 -0
- data/spec/fixtures/rails_users_app/config/routes.rb +11 -0
- data/spec/fixtures/rails_users_app/config.ru +5 -0
- data/spec/fixtures/rails_users_app/create_app +11 -0
- data/spec/fixtures/rails_users_app/db/migrate/20190728211408_create_users.rb +9 -0
- data/spec/fixtures/rails_users_app/db/schema.rb +23 -0
- data/spec/fixtures/rails_users_app/docker-compose.yml +24 -0
- data/spec/fixtures/rails_users_app/lib/tasks/.keep +0 -0
- data/spec/fixtures/rails_users_app/log/.keep +0 -0
- data/spec/fixtures/rails_users_app/public/robots.txt +1 -0
- data/spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb +29 -0
- data/spec/fixtures/rails_users_app/spec/models/user_spec.rb +39 -0
- data/spec/fixtures/rails_users_app/spec/rails_helper.rb +66 -0
- data/spec/fixtures/rails_users_app/spec/spec_helper.rb +96 -0
- data/spec/fixtures/rails_users_app/users_app/.gitignore +20 -0
- data/spec/rack_handler_webrick_spec.rb +59 -0
- data/spec/rails_spec_helper.rb +34 -0
- data/spec/railtie_spec.rb +35 -0
- data/spec/record_sql_rails4_pg_spec.rb +76 -0
- data/spec/record_sql_rails_pg_spec.rb +68 -0
- data/spec/rspec_feature_metadata_spec.rb +30 -0
- data/spec/spec_helper.rb +6 -0
- data/test/cli_test.rb +81 -0
- data/test/config_test.rb +149 -0
- data/test/explict_inspect_test.rb +29 -0
- data/test/fixtures/active_record_like/active_record/aggregations.rb +4 -0
- data/test/fixtures/active_record_like/active_record/association.rb +4 -0
- data/test/fixtures/active_record_like/active_record/associations/join_dependency/join_base.rb +8 -0
- data/test/fixtures/active_record_like/active_record/associations/join_dependency/join_part.rb +8 -0
- data/test/fixtures/active_record_like/active_record/associations/join_dependency.rb +6 -0
- data/test/fixtures/active_record_like/active_record/caps/caps.rb +4 -0
- data/test/fixtures/active_record_like/active_record.rb +2 -0
- data/test/fixtures/cli_record_test/appmap.yml +2 -0
- data/test/fixtures/cli_record_test/lib/cli_record_test/main.rb +7 -0
- data/test/fixtures/ignore_non_ruby_file/class.rb +3 -0
- data/test/fixtures/ignore_non_ruby_file/non-ruby.txt +1 -0
- data/test/fixtures/includes_excludes/lib/a/a_1.rb +6 -0
- data/test/fixtures/includes_excludes/lib/a/a_2.rb +6 -0
- data/test/fixtures/includes_excludes/lib/a/x/x_1.rb +8 -0
- data/test/fixtures/includes_excludes/lib/b/b_1.rb +6 -0
- data/test/fixtures/includes_excludes/lib/root_1.rb +4 -0
- data/test/fixtures/inspect_multiple_subdirs/module_a/class_a.rb +5 -0
- data/test/fixtures/inspect_multiple_subdirs/module_a.rb +2 -0
- data/test/fixtures/inspect_multiple_subdirs/module_b/class_b.rb +5 -0
- data/test/fixtures/inspect_multiple_subdirs/module_b/class_c.rb +5 -0
- data/test/fixtures/inspect_multiple_subdirs/module_b.rb +2 -0
- data/test/fixtures/inspect_package/module_a/module_b/class_in_module.rb +6 -0
- data/test/fixtures/parse_file/defs_static_function.rb +96 -0
- data/test/fixtures/parse_file/function_within_class.rb +36 -0
- data/test/fixtures/parse_file/include_public_methods.rb +127 -0
- data/test/fixtures/parse_file/instance_function.rb +17 -0
- data/test/fixtures/parse_file/modules.rb +71 -0
- data/test/fixtures/parse_file/sclass_static_function.rb +88 -0
- data/test/fixtures/parse_file/toplevel_class.rb +13 -0
- data/test/fixtures/parse_file/toplevel_function.rb +14 -0
- data/test/fixtures/rspec_recorder/Gemfile +5 -0
- data/test/fixtures/rspec_recorder/appmap.yml +3 -0
- data/test/fixtures/rspec_recorder/lib/hello.rb +5 -0
- data/test/fixtures/rspec_recorder/spec/hello_spec.rb +9 -0
- data/test/fixtures/trace_test/trace_program_1.rb +44 -0
- data/test/implicit_inspect_test.rb +33 -0
- data/test/include_exclude_test.rb +48 -0
- data/test/prerecorded_trace_test.rb +76 -0
- data/test/rspec_test.rb +22 -0
- data/test/test_helper.rb +46 -0
- data/test/trace_test.rb +92 -0
- metadata +501 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 536929649e77a1a136aabc2ffbf8df4b43a1f51420334b4d556f5978aa205e06
|
4
|
+
data.tar.gz: b052fa2b3853f962932216a21f2c0d07052e7288695787bc60fccba4ed97cf1f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fca12acdd2d3a096cc1ecb8bb8d5e19fb5f88ad91e67de83aa71d59e9cdaa0a70733d1904e4d29078ea94eddbc3005d1cb33ea4e86f0fad95270ec7b3bd35e67
|
7
|
+
data.tar.gz: 395891a44f2d185bcb5bd447bbe39d1d16a07c30c065c6fb7a45ea5979f54f7c1b30efab1baf6043838a9e9d166e1f14ff4412b9a04743d03c8a818a4c082b15
|
data/.dockerignore
ADDED
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Style/MultilineBlockChain:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Style/NumericPredicate:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Layout/SpaceInsideArrayLiteralBrackets:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
# We have squiggly heredocs
|
11
|
+
Layout/IndentHeredoc:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
Style/AndOr:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Metrics/LineLength:
|
18
|
+
Max: 120
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.2
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# v0.18.1
|
2
|
+
|
3
|
+
* Now tested with Rails 4, 5, and 6.
|
4
|
+
* Now tested with Ruby 2.5 and 2.6.
|
5
|
+
* `explain_sql` is no longer collected.
|
6
|
+
* `appmap/railtie` is automatically required when running in a Rails environment.
|
7
|
+
|
8
|
+
# v0.17.0
|
9
|
+
|
10
|
+
**WARNING** Breaking changes
|
11
|
+
|
12
|
+
* **appmap upload** expects arguments `user` and `org`.
|
13
|
+
* **appmap upload** receives and retransmits the scenario batch id
|
14
|
+
* assigned by the server.
|
15
|
+
|
16
|
+
# v0.16.0
|
17
|
+
|
18
|
+
**WARNING** Breaking changes
|
19
|
+
|
20
|
+
* **Record button** removed. Frontend interactions are now recorded with a browser extension.
|
21
|
+
As a result, `AppMap::Middleware::RecordButton` has been renamed to
|
22
|
+
`AppMap::Middleware::RemoteRecording`
|
23
|
+
|
24
|
+
# v0.15.1
|
25
|
+
|
26
|
+
* **Record button** moved to the bottom of the window.
|
27
|
+
|
28
|
+
# v0.15.0
|
29
|
+
|
30
|
+
**WARNING** Breaking changes
|
31
|
+
|
32
|
+
* **AppMap version** updated to 1.1
|
33
|
+
* **Event `parameters`** are reported as an array rather than a map, so that parameter order is preserved.
|
34
|
+
* **Event `receiver`** reports the `receiver/this/self` parameter of each method call.
|
35
|
+
|
36
|
+
# v0.14.1
|
37
|
+
|
38
|
+
* **RSpec recorder** won't try to modify a frozen string.
|
39
|
+
|
40
|
+
# v0.14.0
|
41
|
+
|
42
|
+
* **SQL queries** are reported for SQLite.
|
43
|
+
|
44
|
+
# v0.13.0
|
45
|
+
|
46
|
+
* **SQL queries** are reported for ActiveRecord.
|
47
|
+
|
48
|
+
# v0.12.0
|
49
|
+
|
50
|
+
* **Record button** integrates into any HTML UI and provides a button to record and upload AppMaps.
|
51
|
+
|
52
|
+
# v0.11.0
|
53
|
+
|
54
|
+
* Information about `language` and `frameworks` is provided in the AppMap `metadata`.
|
55
|
+
|
56
|
+
# v0.10.0
|
57
|
+
|
58
|
+
* **`AppMap::Algorithm::PruneClassMap`** prunes a class map so that only functions, classes and packages which are
|
59
|
+
referenced by some event are retained.
|
60
|
+
|
61
|
+
# v0.9.0
|
62
|
+
|
63
|
+
* **`appmap/rspec`** only records trace events which happen during an example block. `before` and `after` events are
|
64
|
+
excluded from the AppMap.
|
65
|
+
* **`appmap/rspec`** exports `feature` and `feature_group` attributes to the AppMap `metadata`
|
66
|
+
section.
|
67
|
+
|
68
|
+
# v0.8.0
|
69
|
+
|
70
|
+
* **`appmap upload`** accepts multiple arguments, to upload multiple files in one command.
|
71
|
+
|
72
|
+
# v0.7.0
|
73
|
+
|
74
|
+
* **`appmap/railtie`** is provided to integrate AppMap recording into Rails apps.
|
75
|
+
* Use `gem :appmap, require: %w[appmap appmap/railtie]` to activate.
|
76
|
+
* Set Rails configuration setting `config.appmap.enabled = true` to enable recording of the app via the Railtie, and
|
77
|
+
to enable recording of RSpec tests via `appmap/rspec`.
|
78
|
+
* In a non-Rails environment, set `APPMAP=true` to to enable recording of RSpec tests.
|
79
|
+
* **SQL queries** are reported as AppMap event `sql_query` data.
|
80
|
+
* **`self` attribute** is removed from `call` events.
|
81
|
+
|
82
|
+
# v0.6.0
|
83
|
+
|
84
|
+
* **Web server requests and responses** through WEBrick are reported as AppMap event `http_server_request` data.
|
85
|
+
* **Rails `params` hash** is reported as an AppMap event `message` data.
|
86
|
+
* **Rails `request`** is reported as an AppMap event `http_server_request` data.
|
87
|
+
|
88
|
+
# v0.5.1
|
89
|
+
|
90
|
+
* **RSpec** test recorder is added.
|
91
|
+
|
92
|
+
# v0.5.0
|
93
|
+
|
94
|
+
* **'inspect', 'record' and 'upload' commands** are converted into a unified 'appmap' command with subcommands.
|
95
|
+
* **Config file name** is changed from .appmap.yml to appmap.yml.
|
96
|
+
* **`appmap.yml`** configuration format is updated.
|
97
|
+
|
98
|
+
# v0.4.0
|
99
|
+
|
100
|
+
Initial release.
|
data/Dockerfile.appmap
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Kevin Gilpin
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
- [About](#about)
|
2
|
+
- [Installation](#installation)
|
3
|
+
- [Configuration](#configuration)
|
4
|
+
- [`packages`](#packages)
|
5
|
+
- [Running](#running)
|
6
|
+
- [RSpec](#rspec)
|
7
|
+
- [Rails](#rails)
|
8
|
+
- [Uploading](#uploading)
|
9
|
+
- [Build status](#build-status)
|
10
|
+
|
11
|
+
# About
|
12
|
+
|
13
|
+
`appmap-ruby` is a Ruby client for recording and uploading [AppMap](https://github.com/applandinc/appmap) data.
|
14
|
+
|
15
|
+
AppMap is a data format which records code structure (modules, classes, and methods), code execution events
|
16
|
+
(function calls and returns), and code metadata (repo name, repo URL, commit SHA, etc).
|
17
|
+
|
18
|
+
The normal usage of an AppMap client is to run a test case (such as an RSpec test) with AppMap instrumentation enabled.
|
19
|
+
The AppMap client will observe and record information about the code execution, and store it in an AppMap file.
|
20
|
+
|
21
|
+
The command `appmap upload` is then used to upload the AppMap file to the App.Land server, which processes the file into
|
22
|
+
useful displays such as graphical depiction of the code structure and execution.
|
23
|
+
|
24
|
+
# Installation
|
25
|
+
|
26
|
+
Add `gem 'appmap'` to your Gemfile just as you would any other dependency. You can place the gem in the `test` group.
|
27
|
+
|
28
|
+
Then install with `bundle`.
|
29
|
+
|
30
|
+
# Configuration
|
31
|
+
|
32
|
+
When you run the AppMap client, it will look for configuration settings in `appmap.yml`. Here's a sample configuration
|
33
|
+
file for a typical Rails project:
|
34
|
+
|
35
|
+
```yaml
|
36
|
+
name: MyProject
|
37
|
+
packages:
|
38
|
+
- path: app/controllers
|
39
|
+
- path: app/models
|
40
|
+
```
|
41
|
+
|
42
|
+
* **name** Provides the project name (required)
|
43
|
+
* **packages** A list of source code directories which should be instrumented.
|
44
|
+
* **files** A list of individual files which should be instrumented. This is only used for files which are
|
45
|
+
not part of the `packages` list.
|
46
|
+
|
47
|
+
## `packages`
|
48
|
+
|
49
|
+
Each entry in the `packages` list is a YAML object which has the following keys:
|
50
|
+
|
51
|
+
* **path** The path to the source code directory. The path may be relative to the current working directory, or it may
|
52
|
+
be an absolute path.
|
53
|
+
* **name** A name for the code package. By default, the package name will be the name of the directory in which the code
|
54
|
+
is located. In the example above, "controllers" or "models".
|
55
|
+
* **excludes** A list of files and directories which will be ignored. By default, all modules, classes and public
|
56
|
+
functions are inspected.
|
57
|
+
|
58
|
+
# Running
|
59
|
+
|
60
|
+
## RSpec
|
61
|
+
|
62
|
+
To instrument RSpec tests, follow these steps:
|
63
|
+
|
64
|
+
1) Include the `appmap` gem in your Gemfile
|
65
|
+
2) Require `appmap/rspec` in your `spec_helper.rb` or `rails_helper.rb`
|
66
|
+
3) Add `appmap: true` to the tests you want to instrument
|
67
|
+
4) Add `feature: '<feature name>'` and `feature_group: '<feature group name>'` to your
|
68
|
+
examples.
|
69
|
+
5) Export the environment variable `APPMAP=true`
|
70
|
+
|
71
|
+
Here's an example of an appmap-enabled RSpec test:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
describe Hello, feature_group: 'Greeting' do
|
75
|
+
it 'says hello', feature: 'Print a greeting to the console', appmap: true do
|
76
|
+
expect(Hello.new.say_hello).to eq('Hello!')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
Then run the tests:
|
82
|
+
|
83
|
+
```sh-session
|
84
|
+
$ APPMAP=true bundle exec rspec
|
85
|
+
```
|
86
|
+
|
87
|
+
Each RSpec test will output a data file into the directory `tmp/appmap/rspec`. For example:
|
88
|
+
|
89
|
+
```
|
90
|
+
$ find tmp/appmap/rspec
|
91
|
+
Hello says hello.json
|
92
|
+
```
|
93
|
+
|
94
|
+
If you include the `feature` and `feature_group` metadata, these attributes will be exported to the AppMap file in the
|
95
|
+
`metadata` section. It will look something like this:
|
96
|
+
|
97
|
+
```json
|
98
|
+
|
99
|
+
```
|
100
|
+
|
101
|
+
## Rails
|
102
|
+
|
103
|
+
To capture ad-hoc AppMaps of your Rails app, use the AppMap Railtie.
|
104
|
+
|
105
|
+
1) Include the `appmap` gem in your Gemfile and require both `appmap` and `appmap/railtie`, like this:
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
gem "appmap", require: %w[appmap appmap/railtie]
|
109
|
+
```
|
110
|
+
|
111
|
+
2) Export `APPMAP=true` when you start your Rails application server. For example:
|
112
|
+
|
113
|
+
```sh-session
|
114
|
+
$ APPMAP=true bundle exec rails server
|
115
|
+
```
|
116
|
+
|
117
|
+
When the Rails app exits, an `appmap.json` file will be written to the project root directory. You can upload it using
|
118
|
+
the `appmap upload` command.
|
119
|
+
|
120
|
+
# Uploading
|
121
|
+
|
122
|
+
To upload an AppMap file to App.Land, run the `appmap upload` command. For example:
|
123
|
+
|
124
|
+
```sh-session
|
125
|
+
$ appmap upload tmp/appmap/rspec/Hello says hello.json
|
126
|
+
Full classMap contains 1 classes
|
127
|
+
Pruned classMap contains 1 classes
|
128
|
+
Uploaded new scenario: d49f3d16-e9f2-4775-a731-6cb95193927e
|
129
|
+
```
|
130
|
+
|
131
|
+
# Build status
|
132
|
+
|
133
|
+
![Build status](https://travis-ci.org/applandinc/appmap-ruby.svg?branch=master)
|
data/Rakefile
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'appmap/version'
|
2
|
+
GEM_VERSION = AppMap::VERSION
|
3
|
+
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rdoc/task'
|
6
|
+
|
7
|
+
namespace 'gem' do
|
8
|
+
require 'bundler/gem_tasks'
|
9
|
+
end
|
10
|
+
|
11
|
+
RUBY_VERSIONS=%w[2.5 2.6]
|
12
|
+
FIXTURE_APPS=%w[rack_users_app rails_users_app rails4_users_app]
|
13
|
+
|
14
|
+
def build_base_image(ruby_version)
|
15
|
+
system "docker build" \
|
16
|
+
" --build-arg RUBY_VERSION=#{ruby_version} --build-arg GEM_VERSION=#{GEM_VERSION}" \
|
17
|
+
" -t appmap:#{GEM_VERSION} -f Dockerfile.appmap ." \
|
18
|
+
or raise 'Docker build failed'
|
19
|
+
end
|
20
|
+
|
21
|
+
def build_app_image(app, ruby_version)
|
22
|
+
Dir.chdir "spec/fixtures/#{app}" do
|
23
|
+
system "env RUBY_VERSION=#{ruby_version} GEM_VERSION=#{GEM_VERSION}" \
|
24
|
+
" docker-compose build" \
|
25
|
+
" --build-arg RUBY_VERSION=#{ruby_version}" \
|
26
|
+
" --build-arg GEM_VERSION=#{GEM_VERSION}" \
|
27
|
+
or raise 'docker-compose build failed'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
namespace :build do
|
32
|
+
namespace :base do
|
33
|
+
RUBY_VERSIONS.each do |ruby_version|
|
34
|
+
desc ruby_version
|
35
|
+
task ruby_version => ["gem:build"] do
|
36
|
+
build_base_image(ruby_version)
|
37
|
+
end.tap do |t|
|
38
|
+
desc "Build all images"
|
39
|
+
task all: t
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
namespace :fixtures do
|
45
|
+
RUBY_VERSIONS.each do |ruby_version|
|
46
|
+
namespace ruby_version do
|
47
|
+
desc "build:fixtures:#{ruby_version}"
|
48
|
+
FIXTURE_APPS.each do |app|
|
49
|
+
desc app
|
50
|
+
task app => ["base:#{ruby_version}"] do
|
51
|
+
build_app_image(app, ruby_version)
|
52
|
+
end.tap do |t|
|
53
|
+
desc "Build all fixture images for #{ruby_version}"
|
54
|
+
task all: t
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Build all fixture images"
|
60
|
+
task all: ["#{ruby_version}:all"]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
task all: ["fixtures:all"]
|
65
|
+
end
|
66
|
+
|
67
|
+
def run_specs(ruby_version, task_args)
|
68
|
+
require 'rspec/core/rake_task'
|
69
|
+
require 'climate_control'
|
70
|
+
# Define an rspec rake task for the specified Ruby version. It's hidden (i.e. doesn't have a
|
71
|
+
# description), because it's not intended to be invoked directly
|
72
|
+
RSpec::Core::RakeTask.new("rspec_#{ruby_version}", [:specs]) do |task, args|
|
73
|
+
task.exclude_pattern = 'spec/fixtures/**/*_spec.rb'
|
74
|
+
if args.count > 0
|
75
|
+
# There doesn't appear to be a value for +pattern+ that will
|
76
|
+
# cause it to be ignored. Setting it to '' or +nil+ causes an
|
77
|
+
# empty argument to get passed to rspec, which confuses it.
|
78
|
+
task.pattern = 'never match this'
|
79
|
+
task.rspec_opts = '-f doc '
|
80
|
+
task.rspec_opts += args.to_a.join(' ')
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Set up the environment, then execute the rspec task we
|
85
|
+
# created above.
|
86
|
+
ClimateControl.modify(RUBY_VERSION: ruby_version) do
|
87
|
+
Rake::Task["rspec_#{ruby_version}"].execute(task_args)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
namespace :spec do
|
92
|
+
RUBY_VERSIONS.each do |ruby_version|
|
93
|
+
desc ruby_version
|
94
|
+
task ruby_version, [:specs] => ["build:fixtures:#{ruby_version}:all"] do |_, task_args|
|
95
|
+
run_specs(ruby_version, task_args)
|
96
|
+
end.tap do|t|
|
97
|
+
desc "Run all specs"
|
98
|
+
task :all, [:specs] => t
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
Rake::RDocTask.new do |rd|
|
104
|
+
rd.main = 'README.rdoc'
|
105
|
+
rd.rdoc_files.include(%w[README.rdoc lib/**/*.rb exe/**/*])
|
106
|
+
rd.title = 'AppMap'
|
107
|
+
end
|
108
|
+
|
109
|
+
Rake::TestTask.new(:minitest) do |t|
|
110
|
+
t.libs << 'test'
|
111
|
+
t.libs << 'lib'
|
112
|
+
t.test_files = FileList['test/**/*_test.rb']
|
113
|
+
end
|
114
|
+
|
115
|
+
task test: %i[spec:all minitest]
|
116
|
+
|
117
|
+
task default: :test
|
data/appmap.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'appmap/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'appmap'
|
8
|
+
spec.version = AppMap::VERSION
|
9
|
+
spec.authors = ['Kevin Gilpin']
|
10
|
+
spec.email = ['kgilpin@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{Inspect and trace your Ruby code, generating a JSON data file.}
|
13
|
+
spec.homepage = 'https://github.com/kgilpin/appmap-ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = `git ls-files --no-deleted`.split("
|
19
|
+
")
|
20
|
+
spec.bindir = 'exe'
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_dependency 'activesupport'
|
25
|
+
spec.add_dependency 'faraday'
|
26
|
+
spec.add_dependency 'gli'
|
27
|
+
spec.add_dependency 'parser'
|
28
|
+
|
29
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
30
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
31
|
+
spec.add_development_dependency 'pry-byebug'
|
32
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
33
|
+
spec.add_development_dependency 'rdoc'
|
34
|
+
|
35
|
+
# Testing
|
36
|
+
spec.add_development_dependency 'climate_control'
|
37
|
+
spec.add_development_dependency 'launchy'
|
38
|
+
spec.add_development_dependency 'rspec'
|
39
|
+
spec.add_development_dependency 'selenium-webdriver'
|
40
|
+
spec.add_development_dependency 'webdrivers', '~> 4.0'
|
41
|
+
end
|
data/appmap.yml
ADDED
data/examples/install.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(__dir__)
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Command
|
7
|
+
def run_command command
|
8
|
+
`#{command}`.tap do |_|
|
9
|
+
raise "Command failed: #{command}" unless $? == 0
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class InProjectDirectory
|
15
|
+
attr_reader :project_dir
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
@project_dir = File.expand_path('../tmp/install', __dir__)
|
19
|
+
end
|
20
|
+
|
21
|
+
def perform(&block)
|
22
|
+
FileUtils.rm_rf project_dir
|
23
|
+
FileUtils.mkdir_p project_dir
|
24
|
+
Dir.chdir project_dir, &block
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class InstallExampleCode
|
29
|
+
def perform
|
30
|
+
FileUtils.cp_r File.join(__dir__, 'mock_webapp'), '.'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class InExampleDirectory
|
35
|
+
def perform(&block)
|
36
|
+
Dir.chdir 'mock_webapp', &block
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class InstallAppmapGem
|
41
|
+
include Command
|
42
|
+
|
43
|
+
def perform
|
44
|
+
run_command 'bundle --local > /dev/null'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class InspectExampleProject
|
49
|
+
include Command
|
50
|
+
|
51
|
+
def perform
|
52
|
+
FileUtils.mkdir_p '.appmap'
|
53
|
+
run_command "bundle exec #{File.expand_path('../exe/appmap', __dir__)} inspect -o appmap.json"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class PrintInventory
|
58
|
+
def initialize(inventory)
|
59
|
+
@inventory = inventory
|
60
|
+
end
|
61
|
+
|
62
|
+
def perform
|
63
|
+
puts @inventory
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
InProjectDirectory.new.perform do
|
68
|
+
InstallExampleCode.new.perform
|
69
|
+
InExampleDirectory.new.perform do
|
70
|
+
InstallAppmapGem.new.perform
|
71
|
+
|
72
|
+
inventory = InspectExampleProject.new.perform
|
73
|
+
PrintInventory.new(inventory).perform
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
gem 'appmap', git: '../..', branch: `git rev-parse --abbrev-ref HEAD`.strip
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
|
4
|
+
|
5
|
+
require 'json'
|
6
|
+
require 'mock_webapp/user'
|
7
|
+
require 'mock_webapp/request'
|
8
|
+
require 'mock_webapp/controller'
|
9
|
+
|
10
|
+
include MockWebapp
|
11
|
+
|
12
|
+
puts JSON.pretty_generate Controller.instance.process(Request.new(id: 'alice'))
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module MockWebapp
|
2
|
+
# Mock controller.
|
3
|
+
# @appmap
|
4
|
+
class Controller
|
5
|
+
@controller = nil
|
6
|
+
|
7
|
+
class << self
|
8
|
+
# Singleton factory method.
|
9
|
+
#
|
10
|
+
# @appmap
|
11
|
+
def instance
|
12
|
+
@controller ||= Controller.new
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# @appmap
|
17
|
+
def process(request)
|
18
|
+
id = request.params[:id]
|
19
|
+
user = User.find(id)
|
20
|
+
user.to_h
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module MockWebapp
|
2
|
+
UserStruct = Struct.new(:login)
|
3
|
+
|
4
|
+
# Mock model object.
|
5
|
+
# @appmap
|
6
|
+
class User < UserStruct
|
7
|
+
USERS = {
|
8
|
+
'alice' => User.new('alice')
|
9
|
+
}.freeze
|
10
|
+
|
11
|
+
class << self
|
12
|
+
# @appmap
|
13
|
+
def find(id)
|
14
|
+
USERS[id] || raise("No such user #{id}")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|