appmap 0.37.2 → 0.41.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -1
  3. data/.travis.yml +2 -23
  4. data/CHANGELOG.md +23 -0
  5. data/CONTRIBUTING.md +22 -0
  6. data/README.md +102 -54
  7. data/Rakefile +3 -3
  8. data/lib/appmap/class_map.rb +25 -8
  9. data/lib/appmap/config.rb +54 -26
  10. data/lib/appmap/hook.rb +18 -3
  11. data/lib/appmap/hook/method.rb +18 -12
  12. data/lib/appmap/rails/request_handler.rb +17 -3
  13. data/lib/appmap/railtie.rb +1 -5
  14. data/lib/appmap/trace.rb +18 -7
  15. data/lib/appmap/version.rb +2 -2
  16. data/spec/abstract_controller_base_spec.rb +125 -64
  17. data/spec/config_spec.rb +1 -0
  18. data/spec/fixtures/hook/exclude.rb +15 -0
  19. data/spec/fixtures/hook/labels.rb +6 -0
  20. data/spec/fixtures/rails5_users_app/Gemfile +3 -4
  21. data/spec/fixtures/rails5_users_app/app/controllers/users_controller.rb +8 -0
  22. data/spec/fixtures/rails5_users_app/appmap.yml +5 -1
  23. data/spec/fixtures/rails5_users_app/config/application.rb +2 -0
  24. data/spec/fixtures/rails5_users_app/config/routes.rb +1 -1
  25. data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_api_spec.rb +1 -1
  26. data/spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb +27 -0
  27. data/spec/fixtures/rails6_users_app/Gemfile +3 -4
  28. data/spec/fixtures/rails6_users_app/app/controllers/users_controller.rb +8 -0
  29. data/spec/fixtures/rails6_users_app/appmap.yml +6 -1
  30. data/spec/fixtures/rails6_users_app/config/application.rb +2 -0
  31. data/spec/fixtures/rails6_users_app/config/routes.rb +1 -1
  32. data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb +1 -1
  33. data/spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb +27 -0
  34. data/spec/hook_spec.rb +69 -47
  35. data/spec/rails_spec_helper.rb +2 -2
  36. data/spec/record_sql_rails_pg_spec.rb +1 -1
  37. data/spec/rspec_feature_metadata_spec.rb +1 -1
  38. data/spec/spec_helper.rb +1 -0
  39. metadata +7 -68
  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
@@ -5,7 +5,7 @@ describe 'SQL events' do
5
5
  around(:each) do |example|
6
6
  FileUtils.rm_rf tmpdir
7
7
  FileUtils.mkdir_p tmpdir
8
- 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}"
8
+ cmd = "docker-compose run --rm -e ORM_MODULE=#{orm_module} -e RAILS_ENV=test -e APPMAP=true -v #{File.absolute_path tmpdir}:/app/tmp app ./bin/rspec spec/controllers/users_controller_api_spec.rb:#{test_line_number}"
9
9
  run_cmd cmd, chdir: fixture_dir
10
10
 
11
11
  example.run
@@ -7,7 +7,7 @@ describe 'RSpec feature and feature group metadata' do
7
7
  around(:each) do |example|
8
8
  FileUtils.rm_rf tmpdir
9
9
  FileUtils.mkdir_p tmpdir
10
- cmd = "docker-compose run --rm -e APPMAP=true -v #{File.absolute_path(tmpdir).shellescape}:/app/tmp app ./bin/rspec spec/models/user_spec.rb"
10
+ cmd = "docker-compose run --rm -e RAILS_ENV=test -e APPMAP=true -v #{File.absolute_path(tmpdir).shellescape}:/app/tmp app ./bin/rspec spec/models/user_spec.rb"
11
11
  run_cmd cmd, chdir: fixture_dir
12
12
 
13
13
  example.run
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,7 @@ require 'net/http'
3
3
  require 'json'
4
4
  require 'yaml'
5
5
  require 'English'
6
+ require 'byebug'
6
7
  require 'webdrivers/chromedriver'
7
8
 
8
9
  # Disable default initialization of AppMap
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.37.2
4
+ version: 0.41.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-19 00:00:00.000000000 Z
11
+ date: 2021-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -319,6 +319,7 @@ files:
319
319
  - ".rubocop.yml"
320
320
  - ".travis.yml"
321
321
  - CHANGELOG.md
322
+ - CONTRIBUTING.md
322
323
  - Dockerfile.appmap
323
324
  - Gemfile
324
325
  - LICENSE.txt
@@ -378,7 +379,6 @@ files:
378
379
  - lore/public/stylesheets/style.css
379
380
  - package-lock.json
380
381
  - package.json
381
- - spec/abstract_controller4_base_spec.rb
382
382
  - spec/abstract_controller_base_spec.rb
383
383
  - spec/class_map_spec.rb
384
384
  - spec/config_spec.rb
@@ -386,7 +386,9 @@ files:
386
386
  - spec/fixtures/hook/compare.rb
387
387
  - spec/fixtures/hook/constructor.rb
388
388
  - spec/fixtures/hook/exception_method.rb
389
+ - spec/fixtures/hook/exclude.rb
389
390
  - spec/fixtures/hook/instance_method.rb
391
+ - spec/fixtures/hook/labels.rb
390
392
  - spec/fixtures/hook/singleton_method.rb
391
393
  - spec/fixtures/rack_users_app/.dockerignore
392
394
  - spec/fixtures/rack_users_app/.gitignore
@@ -396,70 +398,6 @@ files:
396
398
  - spec/fixtures/rack_users_app/config.ru
397
399
  - spec/fixtures/rack_users_app/docker-compose.yml
398
400
  - spec/fixtures/rack_users_app/lib/app.rb
399
- - spec/fixtures/rails4_users_app/.gitignore
400
- - spec/fixtures/rails4_users_app/.rbenv-gemsets
401
- - spec/fixtures/rails4_users_app/.ruby-version
402
- - spec/fixtures/rails4_users_app/Dockerfile
403
- - spec/fixtures/rails4_users_app/Dockerfile.pg
404
- - spec/fixtures/rails4_users_app/Gemfile
405
- - spec/fixtures/rails4_users_app/README.rdoc
406
- - spec/fixtures/rails4_users_app/Rakefile
407
- - spec/fixtures/rails4_users_app/app/assets/images/.keep
408
- - spec/fixtures/rails4_users_app/app/assets/javascripts/application.js
409
- - spec/fixtures/rails4_users_app/app/assets/stylesheets/application.css
410
- - spec/fixtures/rails4_users_app/app/controllers/api/users_controller.rb
411
- - spec/fixtures/rails4_users_app/app/controllers/application_controller.rb
412
- - spec/fixtures/rails4_users_app/app/controllers/concerns/.keep
413
- - spec/fixtures/rails4_users_app/app/controllers/health_controller.rb
414
- - spec/fixtures/rails4_users_app/app/controllers/users_controller.rb
415
- - spec/fixtures/rails4_users_app/app/helpers/application_helper.rb
416
- - spec/fixtures/rails4_users_app/app/mailers/.keep
417
- - spec/fixtures/rails4_users_app/app/models/.keep
418
- - spec/fixtures/rails4_users_app/app/models/concerns/.keep
419
- - spec/fixtures/rails4_users_app/app/models/user.rb
420
- - spec/fixtures/rails4_users_app/app/views/layouts/application.html.haml
421
- - spec/fixtures/rails4_users_app/app/views/users/index.html.haml
422
- - spec/fixtures/rails4_users_app/appmap.yml
423
- - spec/fixtures/rails4_users_app/bin/rails
424
- - spec/fixtures/rails4_users_app/bin/setup
425
- - spec/fixtures/rails4_users_app/bin/spring
426
- - spec/fixtures/rails4_users_app/config.ru
427
- - spec/fixtures/rails4_users_app/config/application.rb
428
- - spec/fixtures/rails4_users_app/config/boot.rb
429
- - spec/fixtures/rails4_users_app/config/database.yml
430
- - spec/fixtures/rails4_users_app/config/environment.rb
431
- - spec/fixtures/rails4_users_app/config/environments/development.rb
432
- - spec/fixtures/rails4_users_app/config/environments/production.rb
433
- - spec/fixtures/rails4_users_app/config/environments/test.rb
434
- - spec/fixtures/rails4_users_app/config/initializers/assets.rb
435
- - spec/fixtures/rails4_users_app/config/initializers/backtrace_silencers.rb
436
- - spec/fixtures/rails4_users_app/config/initializers/cookies_serializer.rb
437
- - spec/fixtures/rails4_users_app/config/initializers/filter_parameter_logging.rb
438
- - spec/fixtures/rails4_users_app/config/initializers/inflections.rb
439
- - spec/fixtures/rails4_users_app/config/initializers/mime_types.rb
440
- - spec/fixtures/rails4_users_app/config/initializers/session_store.rb
441
- - spec/fixtures/rails4_users_app/config/initializers/to_time_preserves_timezone.rb
442
- - spec/fixtures/rails4_users_app/config/initializers/wrap_parameters.rb
443
- - spec/fixtures/rails4_users_app/config/locales/en.yml
444
- - spec/fixtures/rails4_users_app/config/routes.rb
445
- - spec/fixtures/rails4_users_app/config/secrets.yml
446
- - spec/fixtures/rails4_users_app/create_app
447
- - spec/fixtures/rails4_users_app/db/migrate/20191127112304_create_users.rb
448
- - spec/fixtures/rails4_users_app/db/schema.rb
449
- - spec/fixtures/rails4_users_app/db/seeds.rb
450
- - spec/fixtures/rails4_users_app/docker-compose.yml
451
- - spec/fixtures/rails4_users_app/lib/assets/.keep
452
- - spec/fixtures/rails4_users_app/lib/tasks/.keep
453
- - spec/fixtures/rails4_users_app/log/.keep
454
- - spec/fixtures/rails4_users_app/public/404.html
455
- - spec/fixtures/rails4_users_app/public/422.html
456
- - spec/fixtures/rails4_users_app/public/500.html
457
- - spec/fixtures/rails4_users_app/public/favicon.ico
458
- - spec/fixtures/rails4_users_app/public/robots.txt
459
- - spec/fixtures/rails4_users_app/spec/controllers/users_controller_api_spec.rb
460
- - spec/fixtures/rails4_users_app/spec/rails_helper.rb
461
- - spec/fixtures/rails4_users_app/spec/spec_helper.rb
462
- - spec/fixtures/rails4_users_app/test/fixtures/users.yml
463
401
  - spec/fixtures/rails5_users_app/.dockerignore
464
402
  - spec/fixtures/rails5_users_app/.gitignore
465
403
  - spec/fixtures/rails5_users_app/.rspec
@@ -527,6 +465,7 @@ files:
527
465
  - spec/fixtures/rails5_users_app/log/.keep
528
466
  - spec/fixtures/rails5_users_app/public/robots.txt
529
467
  - spec/fixtures/rails5_users_app/spec/controllers/users_controller_api_spec.rb
468
+ - spec/fixtures/rails5_users_app/spec/controllers/users_controller_spec.rb
530
469
  - spec/fixtures/rails5_users_app/spec/models/user_spec.rb
531
470
  - spec/fixtures/rails5_users_app/spec/rails_helper.rb
532
471
  - spec/fixtures/rails5_users_app/spec/spec_helper.rb
@@ -598,6 +537,7 @@ files:
598
537
  - spec/fixtures/rails6_users_app/log/.keep
599
538
  - spec/fixtures/rails6_users_app/public/robots.txt
600
539
  - spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb
540
+ - spec/fixtures/rails6_users_app/spec/controllers/users_controller_spec.rb
601
541
  - spec/fixtures/rails6_users_app/spec/models/user_spec.rb
602
542
  - spec/fixtures/rails6_users_app/spec/rails_helper.rb
603
543
  - spec/fixtures/rails6_users_app/spec/spec_helper.rb
@@ -606,7 +546,6 @@ files:
606
546
  - spec/open_spec.rb
607
547
  - spec/rails_spec_helper.rb
608
548
  - spec/railtie_spec.rb
609
- - spec/record_sql_rails4_pg_spec.rb
610
549
  - spec/record_sql_rails_pg_spec.rb
611
550
  - spec/remote_recording_spec.rb
612
551
  - spec/rspec_feature_metadata_spec.rb
@@ -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