sapience 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14d3cb7ced5f31db60bee83527aa91fa14054562
4
- data.tar.gz: cbdbeb2b580049917ff6914f30750ca757ba953d
3
+ metadata.gz: f7b5d7d43e746d5abccc148e541f032cbda6a42b
4
+ data.tar.gz: fc275d17ec3bddeeda9463ba48264fe17882a7b2
5
5
  SHA512:
6
- metadata.gz: d6a2d9d9e32281d0c8f74c8ba387a721e287aacbc33d4e7d3d896db74340ea9af40ca52b5defc95f6b3fe50cf9239ad582fb9544deef783e5c960312f74a9ced
7
- data.tar.gz: feff9250b817af7363881bdba3311ea0b0c1c02b701e441e793840424bb7393615522b7b8570e43d5c726f2e70cdc872babf1611151736e9b4c9b4f426f97cb6
6
+ metadata.gz: 100d9f3e28c98c0f75645708f66c112a858112c990f980ac433314c9d53df4ab0312a055e34b45a336bf531e17c672841d0117de81e92d0e40afc873d69e5c5b
7
+ data.tar.gz: df7b7e7659ad62d2dc60e1347f9d0928774a5f5e14a898f526ce6d6085903aa2fa9f2de8ef66ce721b3e647d0f20184f9744c76be1c2b3759aada6741221df41
data/bin/rake ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bash
2
+
3
+ current_dir="$(pwd)"
4
+ function finish {
5
+ cd $current_dir
6
+ }
7
+ trap finish EXIT
8
+
9
+ bundle install
10
+ bundle exec rake
11
+ [ $? -ne 0 ] && exit $?
12
+
13
+ pushd test_apps/grape
14
+ bundle install
15
+ bundle appraisal install
16
+ bundle exec appraisal rake
17
+ [ $? -ne 0 ] && exit $?
18
+ popd
19
+
20
+ pushd test_apps/rails
21
+ bundle install
22
+ bundle exec rake
23
+ [ $? -ne 0 ] && exit $?
24
+ popd
25
+
26
+ bundle exec rake coverage:merge
27
+ [ $? -ne 0 ] && exit $?
@@ -28,13 +28,20 @@ module Sapience
28
28
 
29
29
  protected
30
30
 
31
+ # TODO: Is NoMethodError :[] equal to `404`?
32
+ def response
33
+ super
34
+ rescue
35
+ nil
36
+ end
37
+
31
38
  def parameters # rubocop:disable AbcSize
32
39
  {
33
40
  method: request.request_method,
34
41
  request_path: request.path,
35
42
  format: "json",
36
- status: response.try(:status),
37
- class_name: env['api.endpoint'].options[:for].to_s,
43
+ status: response.try(:status) || 404,
44
+ class_name: env["api.endpoint"].options[:for].to_s,
38
45
  action: "index",
39
46
  host: request.host,
40
47
  ip: (request.env["HTTP_X_FORWARDED_FOR"] || request.env["REMOTE_ADDR"]),
@@ -370,7 +370,7 @@ module Sapience
370
370
  end
371
371
 
372
372
  def self.constantize_symbol(symbol, namespace = "Sapience::Appender")
373
- class_name = "#{namespace}::#{symbol.camelize}"
373
+ class_name = "#{namespace}::#{symbol.to_sym.camelize}"
374
374
  constantize(class_name)
375
375
  end
376
376
 
@@ -1,3 +1,3 @@
1
1
  module Sapience
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -0,0 +1,9 @@
1
+ appraise "grape-0.17.0" do
2
+ gem "grape", "0.17.0"
3
+ end
4
+
5
+ appraise "grape-0.16.2" do
6
+ gem "grape", "0.16.2"
7
+ gem "activesupport", "4.2.6"
8
+ gem "rack", "1.6.4"
9
+ end
@@ -11,7 +11,6 @@ gem "puma", "~> 3.0"
11
11
  gem "sapience", path: "../.."
12
12
  gem "sentry-raven"
13
13
  gem "statsd-ruby"
14
- gem "active_model_serializers"
15
14
 
16
15
  group :development, :test do
17
16
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
@@ -20,6 +19,7 @@ group :development, :test do
20
19
  gem "pry-byebug", platform: :mri
21
20
  gem "rspec"
22
21
  gem "racksh"
22
+ gem "appraisal"
23
23
  end
24
24
 
25
25
  group :test do
File without changes
@@ -0,0 +1,26 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "grape", "0.16.2"
6
+ gem "puma", "~> 3.0"
7
+ gem "sapience", :path => "../../.."
8
+ gem "sentry-raven"
9
+ gem "statsd-ruby"
10
+ gem "activesupport", "4.2.6"
11
+ gem "rack", "1.6.4"
12
+
13
+ group :development, :test do
14
+ gem "byebug", :platform => :mri
15
+ gem "pry-byebug", :platform => :mri
16
+ gem "rspec"
17
+ gem "racksh"
18
+ gem "appraisal"
19
+ end
20
+
21
+ group :test do
22
+ gem "rspec-its"
23
+ gem "simplecov"
24
+ gem "simplecov-json"
25
+ gem "fuubar"
26
+ end
@@ -0,0 +1,140 @@
1
+ PATH
2
+ remote: ../../..
3
+ specs:
4
+ sapience (0.2.8)
5
+ concurrent-ruby (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (4.2.6)
11
+ i18n (~> 0.7)
12
+ json (~> 1.7, >= 1.7.7)
13
+ minitest (~> 5.1)
14
+ thread_safe (~> 0.3, >= 0.3.4)
15
+ tzinfo (~> 1.1)
16
+ appraisal (2.1.0)
17
+ bundler
18
+ rake
19
+ thor (>= 0.14.0)
20
+ axiom-types (0.1.1)
21
+ descendants_tracker (~> 0.0.4)
22
+ ice_nine (~> 0.11.0)
23
+ thread_safe (~> 0.3, >= 0.3.1)
24
+ builder (3.2.2)
25
+ byebug (9.0.5)
26
+ coderay (1.1.1)
27
+ coercible (1.0.0)
28
+ descendants_tracker (~> 0.0.1)
29
+ concurrent-ruby (1.0.2)
30
+ descendants_tracker (0.0.4)
31
+ thread_safe (~> 0.3, >= 0.3.1)
32
+ diff-lcs (1.2.5)
33
+ docile (1.1.5)
34
+ enumerable-lazy (0.0.1)
35
+ equalizer (0.0.11)
36
+ faraday (0.9.2)
37
+ multipart-post (>= 1.2, < 3)
38
+ fuubar (2.2.0)
39
+ rspec-core (~> 3.0)
40
+ ruby-progressbar (~> 1.4)
41
+ grape (0.16.2)
42
+ activesupport
43
+ builder
44
+ hashie (>= 2.1.0)
45
+ multi_json (>= 1.3.2)
46
+ multi_xml (>= 0.5.2)
47
+ mustermann19 (~> 0.4.3)
48
+ rack (>= 1.3.0)
49
+ rack-accept
50
+ virtus (>= 1.0.0)
51
+ hashie (3.4.4)
52
+ i18n (0.7.0)
53
+ ice_nine (0.11.2)
54
+ json (1.8.3)
55
+ method_source (0.8.2)
56
+ minitest (5.9.0)
57
+ multi_json (1.12.1)
58
+ multi_xml (0.5.5)
59
+ multipart-post (2.0.0)
60
+ mustermann19 (0.4.4)
61
+ enumerable-lazy
62
+ pry (0.10.4)
63
+ coderay (~> 1.1.0)
64
+ method_source (~> 0.8.1)
65
+ slop (~> 3.4)
66
+ pry-byebug (3.4.0)
67
+ byebug (~> 9.0)
68
+ pry (~> 0.10)
69
+ puma (3.6.0)
70
+ rack (1.6.4)
71
+ rack-accept (0.4.5)
72
+ rack (>= 0.4)
73
+ rack-test (0.6.3)
74
+ rack (>= 1.0)
75
+ racksh (1.0.0)
76
+ rack (>= 1.0)
77
+ rack-test (>= 0.5)
78
+ rake (11.2.2)
79
+ rspec (3.5.0)
80
+ rspec-core (~> 3.5.0)
81
+ rspec-expectations (~> 3.5.0)
82
+ rspec-mocks (~> 3.5.0)
83
+ rspec-core (3.5.3)
84
+ rspec-support (~> 3.5.0)
85
+ rspec-expectations (3.5.0)
86
+ diff-lcs (>= 1.2.0, < 2.0)
87
+ rspec-support (~> 3.5.0)
88
+ rspec-its (1.2.0)
89
+ rspec-core (>= 3.0.0)
90
+ rspec-expectations (>= 3.0.0)
91
+ rspec-mocks (3.5.0)
92
+ diff-lcs (>= 1.2.0, < 2.0)
93
+ rspec-support (~> 3.5.0)
94
+ rspec-support (3.5.0)
95
+ ruby-progressbar (1.8.1)
96
+ sentry-raven (1.2.3)
97
+ faraday (>= 0.7.6, < 0.10.x)
98
+ simplecov (0.12.0)
99
+ docile (~> 1.1.0)
100
+ json (>= 1.8, < 3)
101
+ simplecov-html (~> 0.10.0)
102
+ simplecov-html (0.10.0)
103
+ simplecov-json (0.2)
104
+ json
105
+ simplecov
106
+ slop (3.6.0)
107
+ statsd-ruby (1.3.0)
108
+ thor (0.19.1)
109
+ thread_safe (0.3.5)
110
+ tzinfo (1.2.2)
111
+ thread_safe (~> 0.1)
112
+ virtus (1.0.5)
113
+ axiom-types (~> 0.1)
114
+ coercible (~> 1.0)
115
+ descendants_tracker (~> 0.0, >= 0.0.3)
116
+ equalizer (~> 0.0, >= 0.0.9)
117
+
118
+ PLATFORMS
119
+ ruby
120
+
121
+ DEPENDENCIES
122
+ activesupport (= 4.2.6)
123
+ appraisal
124
+ byebug
125
+ fuubar
126
+ grape (= 0.16.2)
127
+ pry-byebug
128
+ puma (~> 3.0)
129
+ rack (= 1.6.4)
130
+ racksh
131
+ rspec
132
+ rspec-its
133
+ sapience!
134
+ sentry-raven
135
+ simplecov
136
+ simplecov-json
137
+ statsd-ruby
138
+
139
+ BUNDLED WITH
140
+ 1.12.5
@@ -0,0 +1,24 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "grape", "0.17.0"
6
+ gem "puma", "~> 3.0"
7
+ gem "sapience", :path => "../../.."
8
+ gem "sentry-raven"
9
+ gem "statsd-ruby"
10
+
11
+ group :development, :test do
12
+ gem "byebug", :platform => :mri
13
+ gem "pry-byebug", :platform => :mri
14
+ gem "rspec"
15
+ gem "racksh"
16
+ gem "appraisal"
17
+ end
18
+
19
+ group :test do
20
+ gem "rspec-its"
21
+ gem "simplecov"
22
+ gem "simplecov-json"
23
+ gem "fuubar"
24
+ end
@@ -0,0 +1,137 @@
1
+ PATH
2
+ remote: ../../..
3
+ specs:
4
+ sapience (0.2.8)
5
+ concurrent-ruby (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (5.0.0.1)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (~> 0.7)
13
+ minitest (~> 5.1)
14
+ tzinfo (~> 1.1)
15
+ appraisal (2.1.0)
16
+ bundler
17
+ rake
18
+ thor (>= 0.14.0)
19
+ axiom-types (0.1.1)
20
+ descendants_tracker (~> 0.0.4)
21
+ ice_nine (~> 0.11.0)
22
+ thread_safe (~> 0.3, >= 0.3.1)
23
+ builder (3.2.2)
24
+ byebug (9.0.5)
25
+ coderay (1.1.1)
26
+ coercible (1.0.0)
27
+ descendants_tracker (~> 0.0.1)
28
+ concurrent-ruby (1.0.2)
29
+ descendants_tracker (0.0.4)
30
+ thread_safe (~> 0.3, >= 0.3.1)
31
+ diff-lcs (1.2.5)
32
+ docile (1.1.5)
33
+ enumerable-lazy (0.0.1)
34
+ equalizer (0.0.11)
35
+ faraday (0.9.2)
36
+ multipart-post (>= 1.2, < 3)
37
+ fuubar (2.2.0)
38
+ rspec-core (~> 3.0)
39
+ ruby-progressbar (~> 1.4)
40
+ grape (0.17.0)
41
+ activesupport
42
+ builder
43
+ hashie (>= 2.1.0)
44
+ multi_json (>= 1.3.2)
45
+ multi_xml (>= 0.5.2)
46
+ mustermann19 (~> 0.4.3)
47
+ rack (>= 1.3.0)
48
+ rack-accept
49
+ virtus (>= 1.0.0)
50
+ hashie (3.4.4)
51
+ i18n (0.7.0)
52
+ ice_nine (0.11.2)
53
+ json (2.0.2)
54
+ method_source (0.8.2)
55
+ minitest (5.9.0)
56
+ multi_json (1.12.1)
57
+ multi_xml (0.5.5)
58
+ multipart-post (2.0.0)
59
+ mustermann19 (0.4.4)
60
+ enumerable-lazy
61
+ pry (0.10.4)
62
+ coderay (~> 1.1.0)
63
+ method_source (~> 0.8.1)
64
+ slop (~> 3.4)
65
+ pry-byebug (3.4.0)
66
+ byebug (~> 9.0)
67
+ pry (~> 0.10)
68
+ puma (3.6.0)
69
+ rack (2.0.1)
70
+ rack-accept (0.4.5)
71
+ rack (>= 0.4)
72
+ rack-test (0.6.3)
73
+ rack (>= 1.0)
74
+ racksh (1.0.0)
75
+ rack (>= 1.0)
76
+ rack-test (>= 0.5)
77
+ rake (11.2.2)
78
+ rspec (3.5.0)
79
+ rspec-core (~> 3.5.0)
80
+ rspec-expectations (~> 3.5.0)
81
+ rspec-mocks (~> 3.5.0)
82
+ rspec-core (3.5.3)
83
+ rspec-support (~> 3.5.0)
84
+ rspec-expectations (3.5.0)
85
+ diff-lcs (>= 1.2.0, < 2.0)
86
+ rspec-support (~> 3.5.0)
87
+ rspec-its (1.2.0)
88
+ rspec-core (>= 3.0.0)
89
+ rspec-expectations (>= 3.0.0)
90
+ rspec-mocks (3.5.0)
91
+ diff-lcs (>= 1.2.0, < 2.0)
92
+ rspec-support (~> 3.5.0)
93
+ rspec-support (3.5.0)
94
+ ruby-progressbar (1.8.1)
95
+ sentry-raven (1.2.3)
96
+ faraday (>= 0.7.6, < 0.10.x)
97
+ simplecov (0.12.0)
98
+ docile (~> 1.1.0)
99
+ json (>= 1.8, < 3)
100
+ simplecov-html (~> 0.10.0)
101
+ simplecov-html (0.10.0)
102
+ simplecov-json (0.2)
103
+ json
104
+ simplecov
105
+ slop (3.6.0)
106
+ statsd-ruby (1.3.0)
107
+ thor (0.19.1)
108
+ thread_safe (0.3.5)
109
+ tzinfo (1.2.2)
110
+ thread_safe (~> 0.1)
111
+ virtus (1.0.5)
112
+ axiom-types (~> 0.1)
113
+ coercible (~> 1.0)
114
+ descendants_tracker (~> 0.0, >= 0.0.3)
115
+ equalizer (~> 0.0, >= 0.0.9)
116
+
117
+ PLATFORMS
118
+ ruby
119
+
120
+ DEPENDENCIES
121
+ appraisal
122
+ byebug
123
+ fuubar
124
+ grape (= 0.17.0)
125
+ pry-byebug
126
+ puma (~> 3.0)
127
+ racksh
128
+ rspec
129
+ rspec-its
130
+ sapience!
131
+ sentry-raven
132
+ simplecov
133
+ simplecov-json
134
+ statsd-ruby
135
+
136
+ BUNDLED WITH
137
+ 1.12.5
@@ -8,6 +8,10 @@ module Ping
8
8
  use Sapience::Extensions::Grape::Middleware::Logging, logger: Grape::API.logger
9
9
  prefix :api
10
10
 
11
+ route :any, "*path" do
12
+ error!({ error: "No route found", status: 404 }, 404)
13
+ end
14
+
11
15
  desc "Returns pong."
12
16
  get :ping do
13
17
  { ping: "PONG" }
@@ -1,4 +1,5 @@
1
1
  require "spec_helper"
2
+ require "rack/test"
2
3
 
3
4
  describe Ping::API do
4
5
  include Rack::Test::Methods
@@ -34,8 +35,33 @@ describe Ping::API do
34
35
  db: kind_of(Float),
35
36
  ),
36
37
  )
38
+
37
39
  get "/api/ping"
40
+ end
41
+
42
+ context "no routes defined" do
43
+ it "logs something" do
44
+ expect(logger).to receive(:info).with(
45
+ method: "GET",
46
+ request_path: "/api/404",
47
+ format: "json",
48
+ status: 404,
49
+ class_name: "Ping::API",
50
+ action: "index",
51
+ host: "example.org",
52
+ ip: "127.0.0.1",
53
+ ua: nil,
54
+ tags: [],
55
+ params: {},
56
+ runtimes: a_hash_including(
57
+ total: kind_of(Float),
58
+ view: kind_of(Float),
59
+ db: kind_of(Float),
60
+ ),
61
+ )
38
62
 
63
+ get "/api/404"
64
+ end
39
65
  end
40
66
  end
41
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sapience
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
@@ -255,6 +255,7 @@ email:
255
255
  - alex.malkov@reevoo.com
256
256
  executables:
257
257
  - console
258
+ - rake
258
259
  - setup
259
260
  extensions: []
260
261
  extra_rdoc_files: []
@@ -272,6 +273,7 @@ files:
272
273
  - README.md
273
274
  - Rakefile
274
275
  - bin/console
276
+ - bin/rake
275
277
  - bin/setup
276
278
  - config/default.yml
277
279
  - dev-entrypoint.sh
@@ -321,9 +323,14 @@ files:
321
323
  - sapience.gemspec
322
324
  - test_apps/grape/.gitignore
323
325
  - test_apps/grape/.simplecov
326
+ - test_apps/grape/Appraisals
324
327
  - test_apps/grape/Gemfile
325
- - test_apps/grape/Rakefile.rb
328
+ - test_apps/grape/Rakefile
326
329
  - test_apps/grape/config.ru
330
+ - test_apps/grape/gemfiles/grape_0.16.2.gemfile
331
+ - test_apps/grape/gemfiles/grape_0.16.2.gemfile.lock
332
+ - test_apps/grape/gemfiles/grape_0.17.0.gemfile
333
+ - test_apps/grape/gemfiles/grape_0.17.0.gemfile.lock
327
334
  - test_apps/grape/lib/ping.rb
328
335
  - test_apps/grape/lib/ping/api.rb
329
336
  - test_apps/grape/spec/lib/ping/api_spec.rb