trogdir_api 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6747aa49dbca2d58802537c5a03a95d849c1f403
4
- data.tar.gz: 50353a13d624313d3ce5444769045ac10ab44f4f
3
+ metadata.gz: fa354b0a9be8229e46f22496967be07d4fa106f9
4
+ data.tar.gz: 9ec3fc1078b827dd3987ac01df784e6bc7d979c6
5
5
  SHA512:
6
- metadata.gz: 9f5ab9c8990169bc31e37fe69418cc20ed5b3055429c33575e2b59eb3ec400640e2ef5258c1ddef02fa3b2f9aad8bbcc9feb8573812a89b2f60a262ba2306e9f
7
- data.tar.gz: 2fb23b084aac4ccfbc006fff404d5aeb4172782059d1c5ac1e8346d9821150af1bab0d7ed323654b522e6518a08cbbc3d659232ce1ad8412bb3aeabadaf575de
6
+ metadata.gz: ce6b94b61bb78cb579d5aedfb725055674fde6d53bc0c479914f7aa7730e4c6307cec61f3bebafcf5eb06325b6b88b49a4642a504b816e93b7eb102606529d09
7
+ data.tar.gz: 276f15973b60ab55e4f28dd9b838777165f4647bb7bdc4b97aa2df4e1f84423be7e52829f1e0d5764d7803a9311dcff0a477d06e87cd8c9b0022aed53768a2ec
data/README.md CHANGED
@@ -15,23 +15,14 @@ git clone git@github.com:biola/trogdir-api.git
15
15
  cd trogdir-api
16
16
  bundle install
17
17
  cp config/mongoid.yml.example config/mongoid.yml
18
- cp config/blazing.rb.example config/blazing.rb
19
18
  cp config/newrelic.yml.example config/newrelic.yml
20
19
  ```
21
20
 
22
21
  Configuration
23
22
  -------------
24
23
  - Edit `config/mongoid.yml` accordingly.
25
- - Edit `config/blazing.rb` accordingly.
26
24
  - Edit `config/newrelic.yml` accordingly.
27
25
 
28
- Deployment
29
- ----------
30
- ```bash
31
- blazing setup [target name in blazing.rb]
32
- git push [target name in blazing.rb]
33
- ```
34
-
35
26
  Console
36
27
  -------
37
28
  To launch a console, `cd` into the app directory and run `irb -r ./config/environment.rb`
data/config/mongoid.yml CHANGED
@@ -1,35 +1,37 @@
1
1
  development:
2
- sessions:
2
+ clients:
3
3
  default:
4
4
  database: trogdir_development
5
5
  hosts:
6
6
  - localhost:27017
7
7
 
8
8
  test:
9
- sessions:
9
+ clients:
10
10
  default:
11
11
  database: trogdir_test
12
12
  hosts:
13
13
  - localhost:27017
14
14
 
15
15
  staging:
16
- sessions:
16
+ clients:
17
17
  default:
18
18
  database: trogdir
19
19
  hosts:
20
20
  - mongo1.staging.biola.edu:27017
21
21
  - mongo2.staging.biola.edu:27017
22
22
  - mongo3.staging.biola.edu:27017
23
- username: trogdir
23
+ options:
24
+ user: trogdir
24
25
  password: "*************"
25
26
 
26
27
  production:
27
- sessions:
28
+ clients:
28
29
  default:
29
30
  database: trogdir
30
31
  hosts:
31
32
  - mongo1.prod.biola.edu:27017
32
33
  - mongo2.prod.biola.edu:27017
33
34
  - mongo3.prod.biola.edu:27017
34
- username: trogdir
35
- password: "*************"
35
+ options:
36
+ user: trogdir
37
+ password: "*************"
@@ -1,35 +1,37 @@
1
1
  development:
2
- sessions:
2
+ clients:
3
3
  default:
4
4
  database: trogdir_development
5
5
  hosts:
6
6
  - localhost:27017
7
7
 
8
8
  test:
9
- sessions:
9
+ clients:
10
10
  default:
11
11
  database: trogdir_test
12
12
  hosts:
13
13
  - localhost:27017
14
14
 
15
15
  staging:
16
- sessions:
16
+ clients:
17
17
  default:
18
18
  database: trogdir
19
19
  hosts:
20
20
  - mongo1.staging.biola.edu:27017
21
21
  - mongo2.staging.biola.edu:27017
22
22
  - mongo3.staging.biola.edu:27017
23
- username: trogdir
24
- password: "*************"
23
+ options:
24
+ user: trogdir
25
+ password: "*************"
25
26
 
26
27
  production:
27
- sessions:
28
+ clients:
28
29
  default:
29
30
  database: trogdir
30
31
  hosts:
31
32
  - mongo1.prod.biola.edu:27017
32
33
  - mongo2.prod.biola.edu:27017
33
34
  - mongo3.prod.biola.edu:27017
34
- username: trogdir
35
- password: "*************"
35
+ options:
36
+ user: trogdir
37
+ password: "*************"
@@ -0,0 +1,3 @@
1
+ sentry:
2
+ url:
3
+
@@ -0,0 +1,2 @@
1
+ sentry:
2
+ url:
@@ -0,0 +1,2 @@
1
+ sentry:
2
+ url: # set in settings.local.yml
@@ -58,4 +58,4 @@ module Trogdir
58
58
  end
59
59
  end
60
60
  end
61
- end
61
+ end
@@ -9,7 +9,12 @@ module Trogdir
9
9
  helpers AuthenticationHelpers
10
10
 
11
11
  before do
12
+ # Verify HMAC signiture for the given request
12
13
  authenticate!
14
+
15
+ # Mongoid::Userstamp::User gets mixed into the Syncinator class
16
+ # which provides methods for setting the current syncinator for
17
+ # the each request
13
18
  Syncinator.current = current_syncinator
14
19
  end
15
20
 
data/lib/trogdir_api.rb CHANGED
@@ -3,12 +3,19 @@ require 'grape-entity'
3
3
  require 'hashie-forbidden_attributes'
4
4
  require 'oj'
5
5
  require 'api_auth'
6
+ require 'config'
6
7
  require 'trogdir_models'
7
8
  require 'turnout'
8
9
 
9
10
  module TrogdirAPI
11
+ def self.environment
12
+ (ENV['RACK_ENV'] || ENV['RAILS_ENV'] || :development).to_sym
13
+ end
14
+
10
15
  def self.initialize!
11
- ENV['RACK_ENV'] ||= 'development'
16
+ ENV['RACK_ENV'] ||= environment.to_s
17
+
18
+ Config.load_and_set_settings('./config/settings.yml', "./config/settings.#{environment}.yml", './config/settings.local.yml')
12
19
 
13
20
  MultiJson.use :oj
14
21
 
@@ -16,6 +23,12 @@ module TrogdirAPI
16
23
  mongoid_yml_path = "#{mongoid_yml_path}.example" if !File.exists? mongoid_yml_path
17
24
  Mongoid.load! mongoid_yml_path
18
25
 
26
+ if defined? Raven
27
+ Raven.configure do |config|
28
+ config.dsn = Settings.sentry.url
29
+ end
30
+ end
31
+
19
32
  Turnout.configure do |config|
20
33
  config.named_maintenance_file_paths.merge! server: '/tmp/turnout.yml'
21
34
  config.default_maintenance_page = Turnout::MaintenancePage::JSON
@@ -41,4 +41,4 @@ class ApiNewRelicInstrumenter < Grape::Middleware::Base
41
41
  path = route.route_path.gsub(/^.+:version\/|^\/|:|\(.+\)/, '').tr('/', '-')
42
42
  "api.#{route.route_version}.#{path}"
43
43
  end
44
- end
44
+ end
@@ -1,3 +1,3 @@
1
1
  module TrogdirAPI
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
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.5.0
4
+ version: 0.5.1
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-04-29 00:00:00.000000000 Z
11
+ date: 2016-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api-auth
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: config
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: grape
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -145,12 +159,13 @@ files:
145
159
  - MIT-LICENSE
146
160
  - README.md
147
161
  - config.ru
148
- - config/blazing.rb
149
- - config/blazing.rb.example
150
162
  - config/environment.rb
151
163
  - config/mongoid.yml
152
164
  - config/mongoid.yml.example
153
165
  - config/newrelic.yml.example
166
+ - config/settings.local.yml
167
+ - config/settings.local.yml.example
168
+ - config/settings.yml
154
169
  - lib/trogdir/api.rb
155
170
  - lib/trogdir/helpers/authentication_helpers.rb
156
171
  - lib/trogdir/helpers/request_helpers.rb
data/config/blazing.rb DELETED
@@ -1,6 +0,0 @@
1
- target :'proda', 'devinh1@ruby5a.prod.biola.edu:/srv/rack/trogdir-api', rails_env: 'production'
2
- target :'prodb', 'devinh1@ruby5b.prod.biola.edu:/srv/rack/trogdir-api', rails_env: 'production'
3
-
4
- env_script '/etc/profile'
5
-
6
- rake :post_deploy
@@ -1,7 +0,0 @@
1
- target :'ruby2.staging', 'johnd0@ruby2.staging.biola.edu:/srv/rack/trogdir-api', rails_env: 'staging'
2
- target :'ruby3a.prod', 'johnd0@ruby3a.prod.biola.edu:/srv/rack/trogdir-api', rails_env: 'production'
3
- target :'ruby3b.prod', 'johnd0@ruby3b.prod.biola.edu:/srv/rack/trogdir-api', rails_env: 'production'
4
-
5
- env_script '/etc/profile'
6
-
7
- rake :post_deploy