trogdir_api 0.6.0 → 0.7.0

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: 2607438e5dd0fa7f2cdea97665e149d141f4725d
4
- data.tar.gz: e1bda9d84c9a77a6379a312a580621b148301bd0
3
+ metadata.gz: 3b96dcf58c993eeaedd44c6d05e7c471a1cd438b
4
+ data.tar.gz: 268630ff8529a3fdd32fd04c84792a077b37aad1
5
5
  SHA512:
6
- metadata.gz: 97c1a400287dcd49c8983bb12e646582e23941153e9e7710be1d6a7bef91d8220f24947ace28279177abe6a31b7091b3a051a3f261c35b234203b796041aa0de
7
- data.tar.gz: 16f405e2a307a2f33f9425f57f5a258e3de3ecd9ab0f5d1d82f2bd2e83b7024ea415106eb17db95ada31072a876194b9dec4a978139653e88a289fac4eb0f1af
6
+ metadata.gz: 517e658757b3f1bcacc9fd09e72fd9b2251f7bfb1a76247495de259cabdd4cb534202cd39ac3ce9334a1a0df09a632324748d35774505b48910f9e607f5fdb56
7
+ data.tar.gz: 0d97f114ae53ff1bc58d3774eb7bc9cd92673ffef628e047123b76d4b47aa571e932d9ac927e8c76b00cb8073ba08828a718bc68b4e1ae81522373972e26f7b8
data/config.ru CHANGED
@@ -1,4 +1,5 @@
1
- require ::File.expand_path('../config/environment', __FILE__)
1
+ require 'logger'
2
+ require ::File.expand_path('../config/environment', __FILE__)
2
3
 
3
4
  env = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
4
5
 
@@ -9,7 +10,13 @@ end
9
10
 
10
11
  file = File.new("./log/#{env}.log", 'a+')
11
12
  file.sync = true
12
- use Rack::CommonLogger, file
13
+
14
+ # create a global logger that we can use in the app
15
+ ::Logger.class_eval { alias :write :'<<' }
16
+ $logger = ::Logger.new(file)
17
+
18
+ # use the same logger for rack logging
19
+ use Rack::CommonLogger, $logger
13
20
 
14
21
  require 'pinglish'
15
22
  pinglish_path = "#{ENV['PUMA_RELATIVE_URL_ROOT']}/_ping"
@@ -0,0 +1,37 @@
1
+ development:
2
+ clients:
3
+ default:
4
+ database: trogdir
5
+ hosts:
6
+ - localhost:27017
7
+
8
+ test:
9
+ clients:
10
+ default:
11
+ database: trogdir_test
12
+ hosts:
13
+ - localhost:27017
14
+
15
+ staging:
16
+ clients:
17
+ default:
18
+ database: trogdir
19
+ hosts:
20
+ - mongo1.staging.biola.edu:27017
21
+ - mongo2.staging.biola.edu:27017
22
+ - mongo3.staging.biola.edu:27017
23
+ options:
24
+ user: trogdir
25
+ password: "*************"
26
+
27
+ production:
28
+ clients:
29
+ default:
30
+ database: trogdir
31
+ hosts:
32
+ - mongo1.prod.biola.edu:27017
33
+ - mongo2.prod.biola.edu:27017
34
+ - mongo3.prod.biola.edu:27017
35
+ options:
36
+ user: trogdir
37
+ password: "*************"
data/lib/trogdir/api.rb CHANGED
@@ -4,7 +4,12 @@ module Trogdir
4
4
  class API < Grape::API
5
5
  helpers ResponseHelpers
6
6
  format :json
7
- rescue_from :all
7
+
8
+ rescue_from :all do |e|
9
+ $logger.error("\n#{e.message} at #{e.backtrace.join(' ')}\n")
10
+ error = { error: e.message }.to_json
11
+ Rack::Response.new([ error ], 500, { 'Content-type' => 'text/error' }).finish
12
+ end
8
13
 
9
14
  use Rack::Turnout
10
15
 
data/lib/trogdir_api.rb CHANGED
@@ -22,6 +22,7 @@ module TrogdirAPI
22
22
  mongoid_yml_path = File.expand_path('../../config/mongoid.yml', __FILE__)
23
23
  mongoid_yml_path = "#{mongoid_yml_path}.example" if !File.exists? mongoid_yml_path
24
24
  Mongoid.load! mongoid_yml_path
25
+ Mongoid.logger.level = Logger::DEBUG
25
26
 
26
27
  if defined? Raven
27
28
  Raven.configure do |config|
@@ -1,3 +1,3 @@
1
1
  module TrogdirAPI
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.7.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trogdir_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Crownoble
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-14 00:00:00.000000000 Z
11
+ date: 2017-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api-auth
@@ -146,6 +146,7 @@ files:
146
146
  - README.md
147
147
  - config.ru
148
148
  - config/environment.rb
149
+ - config/mongoid.yml
149
150
  - config/mongoid.yml.example
150
151
  - config/settings.local.yml
151
152
  - config/settings.local.yml.example
@@ -195,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
196
  version: '0'
196
197
  requirements: []
197
198
  rubyforge_project:
198
- rubygems_version: 2.6.6
199
+ rubygems_version: 2.2.3
199
200
  signing_key:
200
201
  specification_version: 4
201
202
  summary: Trogdir directory API