gris 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/Rakefile +8 -5
- data/gris.gemspec +1 -1
- data/lib/gris/generators/templates/scaffold/.env.test.tt +1 -1
- data/lib/gris/generators/templates/scaffold/.env.tt +1 -1
- data/lib/gris/generators/templates/scaffold/Rakefile +0 -1
- data/lib/gris/generators/templates/scaffold/spec/support/app_helper.rb.tt +1 -1
- data/lib/gris/grape_extensions/authentication_helpers.rb +1 -1
- data/lib/gris/setup.rb +2 -1
- data/lib/gris/version.rb +1 -1
- data/spec/grape_extensions/authentication_helpers_spec.rb +17 -1
- metadata +14 -15
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ef5f60c714ffb37c1cee757a9f948a7be8cc565
|
4
|
+
data.tar.gz: aa30d373204592b972d76be94ecd3d5bb6026c96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed7f285cd67b0465818cd73d56777c824ffa8715d9461f337e17ce7df8d5d6c52207874e1aa740c6b3692ce5ad6cf0a6d0d4af692383d5697ca90c7d99d1918e
|
7
|
+
data.tar.gz: b5637b878507394ec58524598ca861be1fb92d991ab30ffb482a4f25c18a0b4037cd6be329fa9a274a92343c686b12beb913b3b9f920dd4690701539f463222e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Gris is a framework for building Rack-based hypermedia APIs using Grape, Roar and ActiveRecord.
|
4
4
|
|
5
|
+
[![Build Status](https://semaphoreci.com/api/v1/projects/37371083-45b6-4c6f-a887-b631ca0fbe5c/381675/badge.png)](https://semaphoreci.com/dylanfareed/gris)
|
6
|
+
|
5
7
|
It is derived from/inspired by the stellar and more sophisticated [Napa framework by Bellycard Inc.](https://github.com/bellycard/napa).
|
6
8
|
|
7
9
|
Gris aims to provide generators and middleware common to API microservices. For the moment, however, it is in development and primarily exploratory. Note that the ground may shift.
|
data/Rakefile
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'rake/testtask'
|
4
3
|
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'rubocop/rake_task'
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
RSpec::Core::RakeTask.new
|
8
|
+
|
9
|
+
desc 'Run RuboCop'
|
10
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
11
|
+
task.fail_on_error = true
|
9
12
|
end
|
10
13
|
|
11
|
-
task default: :spec
|
14
|
+
task default: [:rubocop, :spec]
|
data/gris.gemspec
CHANGED
@@ -22,9 +22,9 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_runtime_dependency 'activesupport', '~> 4.2', '>= 4.2.0'
|
23
23
|
s.add_runtime_dependency 'rake', '~> 10.4', '>= 10.4.2'
|
24
24
|
s.add_runtime_dependency 'git', '~> 1.2', '>= 1.2.8'
|
25
|
+
s.add_runtime_dependency 'dotenv', '~> 1.0.2', '>= 1.0.2'
|
25
26
|
|
26
27
|
s.add_dependency 'logging'
|
27
|
-
s.add_dependency 'dotenv', '~> 1.0.2', '>= 1.0.2'
|
28
28
|
s.add_dependency 'grape', '~> 0.11.0', '>= 0.11.0'
|
29
29
|
s.add_dependency 'grape-roar', '~> 0.3.0', '>= 0.3.0'
|
30
30
|
|
@@ -4,7 +4,7 @@ end
|
|
4
4
|
|
5
5
|
shared_context 'with token authorization' do
|
6
6
|
before(:each) do
|
7
|
-
permitted_token = ENV['PERMITTED_TOKENS'].
|
7
|
+
permitted_token = ENV['PERMITTED_TOKENS'].split(',').first if ENV['PERMITTED_TOKENS']
|
8
8
|
header 'Http-Authorization', permitted_token
|
9
9
|
end
|
10
10
|
end
|
data/lib/gris/setup.rb
CHANGED
data/lib/gris/version.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Gris::AuthenticationHelpers do
|
4
4
|
context 'without permitted token' do
|
5
5
|
before(:each) do
|
6
|
-
stub_const 'ENV', 'PERMITTED_TOKENS' =>
|
6
|
+
stub_const 'ENV', 'PERMITTED_TOKENS' => 'my-token,another-token'
|
7
7
|
@helper = SpecApiAuthHelper.new
|
8
8
|
end
|
9
9
|
|
@@ -23,6 +23,14 @@ describe Gris::AuthenticationHelpers do
|
|
23
23
|
expect(@helper.token_authentication!).to be_nil
|
24
24
|
end
|
25
25
|
end
|
26
|
+
context 'with blank params token' do
|
27
|
+
it 'returns a 401 Forbidden error' do
|
28
|
+
allow(@helper).to receive(:params).and_return(token: '')
|
29
|
+
allow(@helper).to receive_message_chain(:request, :headers).and_return('Http-Authorization' => nil)
|
30
|
+
@helper.token_authentication!
|
31
|
+
expect(@helper.message).to eq(message: 'Forbidden', status: 401)
|
32
|
+
end
|
33
|
+
end
|
26
34
|
context 'with included request header token' do
|
27
35
|
it 'returns nil' do
|
28
36
|
allow(@helper).to receive(:params).and_return(token: nil)
|
@@ -30,6 +38,14 @@ describe Gris::AuthenticationHelpers do
|
|
30
38
|
expect(@helper.token_authentication!).to be_nil
|
31
39
|
end
|
32
40
|
end
|
41
|
+
context 'with blank header token' do
|
42
|
+
it 'returns a 401 Forbidden error' do
|
43
|
+
allow(@helper).to receive(:params).and_return(token: nil)
|
44
|
+
allow(@helper).to receive_message_chain(:request, :headers).and_return('Http-Authorization' => '')
|
45
|
+
@helper.token_authentication!
|
46
|
+
expect(@helper.message).to eq(message: 'Forbidden', status: 401)
|
47
|
+
end
|
48
|
+
end
|
33
49
|
end
|
34
50
|
end
|
35
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Fareed
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -91,39 +91,39 @@ dependencies:
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 1.2.8
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
|
-
name:
|
94
|
+
name: dotenv
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 1.0.2
|
97
100
|
- - ">="
|
98
101
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
102
|
+
version: 1.0.2
|
100
103
|
type: :runtime
|
101
104
|
prerelease: false
|
102
105
|
version_requirements: !ruby/object:Gem::Requirement
|
103
106
|
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.0.2
|
104
110
|
- - ">="
|
105
111
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
112
|
+
version: 1.0.2
|
107
113
|
- !ruby/object:Gem::Dependency
|
108
|
-
name:
|
114
|
+
name: logging
|
109
115
|
requirement: !ruby/object:Gem::Requirement
|
110
116
|
requirements:
|
111
|
-
- - "~>"
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version: 1.0.2
|
114
117
|
- - ">="
|
115
118
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
119
|
+
version: '0'
|
117
120
|
type: :runtime
|
118
121
|
prerelease: false
|
119
122
|
version_requirements: !ruby/object:Gem::Requirement
|
120
123
|
requirements:
|
121
|
-
- - "~>"
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: 1.0.2
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
126
|
+
version: '0'
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: grape
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -303,7 +303,6 @@ files:
|
|
303
303
|
- ".rubocop_todo.yml"
|
304
304
|
- ".ruby-gemset"
|
305
305
|
- ".ruby-version"
|
306
|
-
- ".travis.yml"
|
307
306
|
- Gemfile
|
308
307
|
- Gemfile.lock
|
309
308
|
- Guardfile
|