appmap 0.38.1 → 0.41.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -1
  3. data/.travis.yml +2 -23
  4. data/CHANGELOG.md +26 -1
  5. data/CONTRIBUTING.md +22 -0
  6. data/README.md +119 -53
  7. data/Rakefile +3 -3
  8. data/lib/appmap/class_map.rb +25 -8
  9. data/lib/appmap/config.rb +41 -21
  10. data/lib/appmap/event.rb +14 -4
  11. data/lib/appmap/hook.rb +18 -3
  12. data/lib/appmap/rails/request_handler.rb +17 -3
  13. data/lib/appmap/railtie.rb +1 -5
  14. data/lib/appmap/version.rb +2 -2
  15. data/spec/abstract_controller_base_spec.rb +116 -86
  16. data/spec/config_spec.rb +1 -0
  17. data/spec/fixtures/hook/exclude.rb +15 -0
  18. data/spec/fixtures/hook/labels.rb +6 -0
  19. data/spec/fixtures/rails5_users_app/Gemfile +2 -3
  20. data/spec/fixtures/rails5_users_app/app/controllers/users_controller.rb +8 -0
  21. data/spec/fixtures/rails5_users_app/appmap.yml +4 -1
  22. data/spec/fixtures/rails5_users_app/config/application.rb +2 -0
  23. data/spec/fixtures/rails5_users_app/config/routes.rb +1 -1
  24. data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb +11 -0
  25. data/spec/fixtures/rails6_users_app/Gemfile +2 -3
  26. data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +8 -0
  27. data/spec/fixtures/rails6_users_app/appmap.yml +4 -1
  28. data/spec/fixtures/rails6_users_app/config/application.rb +2 -0
  29. data/spec/fixtures/rails6_users_app/config/routes.rb +1 -1
  30. data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb +11 -0
  31. data/spec/hook_spec.rb +41 -41
  32. data/spec/rails_spec_helper.rb +2 -2
  33. data/spec/record_sql_rails_pg_spec.rb +1 -1
  34. data/spec/rspec_feature_metadata_spec.rb +1 -1
  35. data/spec/spec_helper.rb +1 -0
  36. data/test/fixtures/gem_test/appmap.yml +1 -1
  37. data/test/fixtures/gem_test/test/parser_test.rb +12 -0
  38. data/test/gem_test.rb +4 -4
  39. metadata +6 -69
  40. data/spec/abstract_controller4_base_spec.rb +0 -66
  41. data/spec/fixtures/rails4_users_app/.gitignore +0 -13
  42. data/spec/fixtures/rails4_users_app/.rbenv-gemsets +0 -2
  43. data/spec/fixtures/rails4_users_app/.ruby-version +0 -1
  44. data/spec/fixtures/rails4_users_app/Dockerfile +0 -30
  45. data/spec/fixtures/rails4_users_app/Dockerfile.pg +0 -3
  46. data/spec/fixtures/rails4_users_app/Gemfile +0 -77
  47. data/spec/fixtures/rails4_users_app/README.rdoc +0 -28
  48. data/spec/fixtures/rails4_users_app/Rakefile +0 -6
  49. data/spec/fixtures/rails4_users_app/app/assets/images/.keep +0 -0
  50. data/spec/fixtures/rails4_users_app/app/assets/javascripts/application.js +0 -16
  51. data/spec/fixtures/rails4_users_app/app/assets/stylesheets/application.css +0 -15
  52. data/spec/fixtures/rails4_users_app/app/controllers/api/users_controller.rb +0 -27
  53. data/spec/fixtures/rails4_users_app/app/controllers/application_controller.rb +0 -5
  54. data/spec/fixtures/rails4_users_app/app/controllers/concerns/.keep +0 -0
  55. data/spec/fixtures/rails4_users_app/app/controllers/health_controller.rb +0 -5
  56. data/spec/fixtures/rails4_users_app/app/controllers/users_controller.rb +0 -5
  57. data/spec/fixtures/rails4_users_app/app/helpers/application_helper.rb +0 -2
  58. data/spec/fixtures/rails4_users_app/app/mailers/.keep +0 -0
  59. data/spec/fixtures/rails4_users_app/app/models/.keep +0 -0
  60. data/spec/fixtures/rails4_users_app/app/models/concerns/.keep +0 -0
  61. data/spec/fixtures/rails4_users_app/app/models/user.rb +0 -18
  62. data/spec/fixtures/rails4_users_app/app/views/layouts/application.html.haml +0 -7
  63. data/spec/fixtures/rails4_users_app/app/views/users/index.html.haml +0 -7
  64. data/spec/fixtures/rails4_users_app/appmap.yml +0 -3
  65. data/spec/fixtures/rails4_users_app/bin/rails +0 -9
  66. data/spec/fixtures/rails4_users_app/bin/setup +0 -29
  67. data/spec/fixtures/rails4_users_app/bin/spring +0 -17
  68. data/spec/fixtures/rails4_users_app/config.ru +0 -4
  69. data/spec/fixtures/rails4_users_app/config/application.rb +0 -26
  70. data/spec/fixtures/rails4_users_app/config/boot.rb +0 -3
  71. data/spec/fixtures/rails4_users_app/config/database.yml +0 -18
  72. data/spec/fixtures/rails4_users_app/config/environment.rb +0 -5
  73. data/spec/fixtures/rails4_users_app/config/environments/development.rb +0 -41
  74. data/spec/fixtures/rails4_users_app/config/environments/production.rb +0 -79
  75. data/spec/fixtures/rails4_users_app/config/environments/test.rb +0 -42
  76. data/spec/fixtures/rails4_users_app/config/initializers/assets.rb +0 -11
  77. data/spec/fixtures/rails4_users_app/config/initializers/backtrace_silencers.rb +0 -7
  78. data/spec/fixtures/rails4_users_app/config/initializers/cookies_serializer.rb +0 -3
  79. data/spec/fixtures/rails4_users_app/config/initializers/filter_parameter_logging.rb +0 -4
  80. data/spec/fixtures/rails4_users_app/config/initializers/inflections.rb +0 -16
  81. data/spec/fixtures/rails4_users_app/config/initializers/mime_types.rb +0 -4
  82. data/spec/fixtures/rails4_users_app/config/initializers/session_store.rb +0 -3
  83. data/spec/fixtures/rails4_users_app/config/initializers/to_time_preserves_timezone.rb +0 -10
  84. data/spec/fixtures/rails4_users_app/config/initializers/wrap_parameters.rb +0 -14
  85. data/spec/fixtures/rails4_users_app/config/locales/en.yml +0 -23
  86. data/spec/fixtures/rails4_users_app/config/routes.rb +0 -12
  87. data/spec/fixtures/rails4_users_app/config/secrets.yml +0 -22
  88. data/spec/fixtures/rails4_users_app/create_app +0 -23
  89. data/spec/fixtures/rails4_users_app/db/migrate/20191127112304_create_users.rb +0 -10
  90. data/spec/fixtures/rails4_users_app/db/schema.rb +0 -26
  91. data/spec/fixtures/rails4_users_app/db/seeds.rb +0 -7
  92. data/spec/fixtures/rails4_users_app/docker-compose.yml +0 -26
  93. data/spec/fixtures/rails4_users_app/lib/assets/.keep +0 -0
  94. data/spec/fixtures/rails4_users_app/lib/tasks/.keep +0 -0
  95. data/spec/fixtures/rails4_users_app/log/.keep +0 -0
  96. data/spec/fixtures/rails4_users_app/public/404.html +0 -67
  97. data/spec/fixtures/rails4_users_app/public/422.html +0 -67
  98. data/spec/fixtures/rails4_users_app/public/500.html +0 -66
  99. data/spec/fixtures/rails4_users_app/public/favicon.ico +0 -0
  100. data/spec/fixtures/rails4_users_app/public/robots.txt +0 -5
  101. data/spec/fixtures/rails4_users_app/spec/controllers/users_controller_api_spec.rb +0 -49
  102. data/spec/fixtures/rails4_users_app/spec/rails_helper.rb +0 -95
  103. data/spec/fixtures/rails4_users_app/spec/spec_helper.rb +0 -96
  104. data/spec/fixtures/rails4_users_app/test/fixtures/users.yml +0 -9
  105. data/spec/record_sql_rails4_pg_spec.rb +0 -75
  106. data/test/fixtures/gem_test/test/to_param_test.rb +0 -14
@@ -1,66 +0,0 @@
1
- require 'rails_spec_helper'
2
-
3
- describe 'AbstractControllerBase' do
4
- include_context 'Rails app pg database', 'spec/fixtures/rails4_users_app' do
5
- around(:each) do |example|
6
- FileUtils.rm_rf tmpdir
7
- FileUtils.mkdir_p tmpdir
8
- cmd = "docker-compose run --rm -e APPMAP=true -v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rspec spec/controllers/users_controller_api_spec.rb:8"
9
- run_cmd cmd, chdir: fixture_dir
10
-
11
- example.run
12
- end
13
-
14
- let(:tmpdir) { 'tmp/spec/AbstractControllerBase' }
15
- let(:appmap_json) { File.join(tmpdir, 'appmap/rspec/Api_UsersController_POST_api_users_with_required_parameters_creates_a_user.appmap.json') }
16
-
17
- describe 'testing with rspec' do
18
- it 'Message fields are recorded in the appmap' do
19
- expect(File).to exist(appmap_json)
20
- appmap = JSON.parse(File.read(appmap_json)).to_yaml
21
-
22
- expect(appmap).to include(<<-MESSAGE.strip)
23
- message:
24
- - name: login
25
- class: String
26
- value: alice
27
- object_id:
28
- MESSAGE
29
-
30
- expect(appmap).to include(<<-MESSAGE.strip)
31
- - name: password
32
- class: String
33
- value: "[FILTERED]"
34
- object_id:
35
- MESSAGE
36
-
37
- expect(appmap).to include(<<-SERVER_REQUEST.strip)
38
- http_server_request:
39
- request_method: POST
40
- path_info: "/api/users"
41
- SERVER_REQUEST
42
- end
43
- it 'Properly captures method parameters in the appmap' do
44
- expect(File).to exist(appmap_json)
45
- appmap = JSON.parse(File.read(appmap_json)).to_yaml
46
-
47
- expect(appmap).to match(<<-CREATE_CALL.strip)
48
- event: call
49
- thread_id: .*
50
- defined_class: Api::UsersController
51
- method_id: build_user
52
- path: app/controllers/api/users_controller.rb
53
- lineno: 23
54
- static: false
55
- parameters:
56
- - name: params
57
- class: Hash
58
- object_id: .*
59
- value: '{"login"=>"alice"}'
60
- kind: req
61
- receiver:
62
- CREATE_CALL
63
- end
64
- end
65
- end
66
- end
@@ -1,13 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
- #
3
- # If you find yourself ignoring temporary files generated by your text editor
4
- # or operating system, you probably want to add a global ignore instead:
5
- # git config --global core.excludesfile '~/.gitignore_global'
6
-
7
- # Ignore bundler config.
8
- /.bundle
9
-
10
- # Ignore all logfiles and tempfiles.
11
- /log/*
12
- !/log/.keep
13
- /tmp
@@ -1,2 +0,0 @@
1
- rails4_users_app
2
-
@@ -1 +0,0 @@
1
- 2.5.1
@@ -1,30 +0,0 @@
1
- ARG GEM_VERSION
2
- ARG RUBY_VERSION
3
-
4
- FROM appmap:${GEM_VERSION} as appmap
5
-
6
- FROM ruby:${RUBY_VERSION}
7
- RUN apt-get update && apt-get install -y vim less
8
- RUN apt-get install -y postgresql-client
9
-
10
- RUN mkdir /app
11
- WORKDIR /app
12
-
13
- RUN gem install -v '~> 1.17' -N bundler
14
-
15
- COPY Gemfile .
16
-
17
- RUN bundle
18
- RUN bundle binstubs --force \
19
- bundler rake rspec-core
20
-
21
- COPY . .
22
-
23
- COPY --from=appmap /pkg/appmap.gem /tmp/
24
- RUN gem install /tmp/appmap.gem && \
25
- bundle update --local appmap && \
26
- bundle binstubs appmap --force
27
-
28
- EXPOSE 3000
29
-
30
- HEALTHCHECK --interval=1s --retries=10 CMD curl --fail http://localhost:3000/health || exit 1
@@ -1,3 +0,0 @@
1
- FROM postgres:9.6
2
-
3
- HEALTHCHECK --interval=1s --retries=10 CMD psql -U postgres -c "select 1" || exit 1
@@ -1,77 +0,0 @@
1
- source 'https://rubygems.org'
2
- git_source(:github) { |name| "https://github.com/#{name}.git" }
3
-
4
- # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
- gem 'rails', '4.2.11'
6
- gem 'haml-rails'
7
-
8
- # Use postgresql as the database for Active Record
9
- gem 'pg', '~> 0.15'
10
- # Use SCSS for stylesheets
11
- gem 'sass-rails', '~> 5.0'
12
- # Use Uglifier as compressor for JavaScript assets
13
- # gem 'uglifier', '>= 1.3.0'
14
- # Use CoffeeScript for .coffee assets and views
15
- # gem 'coffee-rails', '~> 4.1.0'
16
- # See https://github.com/rails/execjs#readme for more supported runtimes
17
- # gem 'therubyracer', platforms: :ruby
18
-
19
- # Use jquery as the JavaScript library
20
- # gem 'jquery-rails'
21
- # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
22
- gem 'turbolinks'
23
- # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
24
- gem 'jbuilder', '~> 2.0'
25
- # bundle exec rake doc:rails generates the API under doc/api.
26
- gem 'sdoc', '~> 0.4.0', group: :doc
27
-
28
- # Use ActiveModel has_secure_password
29
- gem 'bcrypt', '~> 3.1.7'
30
-
31
- # Use Unicorn as the app server
32
- # gem 'unicorn'
33
-
34
- # Use Capistrano for deployment
35
- # gem 'capistrano-rails', group: :development
36
-
37
- appmap_path = \
38
- # Support debugging inside the container with volume-mounted source
39
- if File.directory?('/src/appmap-ruby')
40
- '/src/appmap-ruby'
41
- elsif File.exist?('../../../appmap.gemspec')
42
- '../../..'
43
- end
44
-
45
- if appmap_path
46
- # Set the branch parameter, so that 'bundle config local.appmap' will work
47
- appmap_branch = Dir.chdir appmap_path do
48
- `git rev-parse --abbrev-ref HEAD`.strip
49
- end
50
- end
51
-
52
- appmap_options = \
53
- if appmap_path && appmap_branch
54
- { git: appmap_path, branch: appmap_branch }
55
- elsif appmap_path
56
- { path: appmap_path }
57
- else
58
- {}
59
- end.merge(require: %w[appmap appmap/railtie])
60
-
61
- gem 'appmap', appmap_options
62
-
63
- group :development, :test do
64
- gem 'rspec-rails'
65
- gem 'database_cleaner'
66
-
67
- gem 'pry-byebug'
68
- end
69
-
70
- group :development do
71
- # Access an IRB console on exception pages or by using <%= console %> in views
72
- gem 'web-console', '~> 2.0'
73
-
74
- # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
75
- gem 'spring'
76
- end
77
-
@@ -1,28 +0,0 @@
1
- == README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
25
-
26
-
27
- Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('../config/application', __FILE__)
5
-
6
- Rails.application.load_tasks
@@ -1,16 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require turbolinks
16
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,27 +0,0 @@
1
- module Api
2
- class UsersController < ApplicationController
3
- def index
4
- @users = User.all
5
- render json: @users
6
- end
7
-
8
- def create
9
- @user = build_user(params.slice(:login).to_unsafe_h)
10
- unless @user.valid?
11
- error = {
12
- code: 'invalid',
13
- target: 'User',
14
- message: @user.errors.full_messages.join(', '),
15
- details: @user.errors.map { |k, v| { code: 'invalid', target: k, message: Array(v).join(', ') } }
16
- }
17
- return render json: error, status: :unprocessable_entity
18
- end
19
- @user.save
20
- render json: @user, status: :created
21
- end
22
-
23
- def build_user(params)
24
- User.new(params)
25
- end
26
- end
27
- end
@@ -1,5 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :exception
5
- end
@@ -1,5 +0,0 @@
1
- class HealthController < ApplicationController
2
- def show
3
- render nothing: true, status: 204
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class UsersController < ApplicationController
2
- def index
3
- @users = User.all
4
- end
5
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
File without changes
File without changes
@@ -1,18 +0,0 @@
1
- class User < ActiveRecord::Base
2
- has_secure_password validations: false
3
- validates_presence_of :login
4
- validates_confirmation_of :password, if: -> { password_provided? }
5
-
6
- def authenticate(unencrypted)
7
- # Just be extra sure that empty passwords aren't accepted
8
- return false if unencrypted.blank? || password.blank?
9
-
10
- super
11
- end
12
-
13
- protected
14
-
15
- def password_provided?
16
- !(password.blank? && password_confirmation.blank?)
17
- end
18
- end
@@ -1,7 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
5
- %title Rails Users App
6
- %body
7
- = yield
@@ -1,7 +0,0 @@
1
- %h1{style: 'margin-top: 2em'}
2
- = pluralize @users.size, 'user'
3
-
4
- %ul
5
- - for user in @users
6
- %li
7
- = user.login
@@ -1,3 +0,0 @@
1
- name: rails4_users_app
2
- packages:
3
- - path: app
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- begin
3
- load File.expand_path('../spring', __FILE__)
4
- rescue LoadError => e
5
- raise unless e.message.include?('spring')
6
- end
7
- APP_PATH = File.expand_path('../../config/application', __FILE__)
8
- require_relative '../config/boot'
9
- require 'rails/commands'
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
-
4
- # path to your application root.
5
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
-
7
- Dir.chdir APP_ROOT do
8
- # This script is a starting point to setup your application.
9
- # Add necessary setup steps to this file:
10
-
11
- puts "== Installing dependencies =="
12
- system "gem install bundler --conservative"
13
- system "bundle check || bundle install"
14
-
15
- # puts "\n== Copying sample files =="
16
- # unless File.exist?("config/database.yml")
17
- # system "cp config/database.yml.sample config/database.yml"
18
- # end
19
-
20
- puts "\n== Preparing database =="
21
- system "bin/rake db:setup"
22
-
23
- puts "\n== Removing old logs and tempfiles =="
24
- system "rm -f log/*"
25
- system "rm -rf tmp/cache"
26
-
27
- puts "\n== Restarting application server =="
28
- system "touch tmp/restart.txt"
29
- end
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This file loads Spring without using Bundler, in order to be fast.
4
- # It gets overwritten when you run the `spring binstub` command.
5
-
6
- unless defined?(Spring)
7
- require 'rubygems'
8
- require 'bundler'
9
-
10
- lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11
- spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
12
- if spring
13
- Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14
- gem 'spring', spring.version
15
- require 'spring/binstub'
16
- end
17
- end