gris 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -10
- data/gris.gemspec +0 -1
- data/lib/gris.rb +0 -1
- data/lib/gris/cli.rb +0 -2
- data/lib/gris/generators/templates/scaffold/.gitignore.tt +0 -1
- data/lib/gris/generators/templates/scaffold/config/boot.rb +0 -2
- data/lib/gris/generators/templates/scaffold/config/database.yml.tt +10 -14
- data/lib/gris/generators/templates/scaffold/config/secrets.yml.tt +15 -0
- data/lib/gris/generators/templates/scaffold/spec/support/app_helper.rb +1 -2
- data/lib/gris/grape_extensions/authentication_helpers.rb +1 -1
- data/lib/gris/identity.rb +2 -2
- data/lib/gris/setup.rb +16 -6
- data/lib/gris/version.rb +1 -1
- data/spec/generators/scaffold_generator_spec.rb +0 -12
- data/spec/grape_extensions/authentication_helpers_spec.rb +1 -1
- data/spec/identity_spec.rb +4 -16
- metadata +3 -23
- data/lib/gris/generators/templates/scaffold/.env.example.tt +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9a3d232cdfdbe4192901e7b09af1be47d757fa6
|
4
|
+
data.tar.gz: 9cba6a4558f7c4af0948c9282a81e1e98aa9e621
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 174a24dab870ccb72d89d50bbb12542d5816a173cf408127999c52b0f2853bf364908df77df78bc5ce48b220ef5d03b9c63ad17e5d7ed5f21a19b907ff2f973a
|
7
|
+
data.tar.gz: 99c07b949ff431a604bf688da3bc83386d65c4490d08634d3bcba8446d2000f3aaae19f1aedf446305242cc219990213e1ad0868d09f7d240e247b220f95424c
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gris (0.
|
4
|
+
gris (0.3.0)
|
5
5
|
activesupport (~> 4.2, >= 4.2.0)
|
6
6
|
chronic (~> 0.10.0)
|
7
7
|
dalli (~> 2.7)
|
8
|
-
dotenv (~> 2.0, >= 2.0)
|
9
8
|
git (~> 1.2, >= 1.2.8)
|
10
9
|
grape (~> 0.11.0, >= 0.11.0)
|
11
10
|
grape-roar (~> 0.3.0, >= 0.3.0)
|
@@ -58,7 +57,6 @@ GEM
|
|
58
57
|
descendants_tracker (0.0.4)
|
59
58
|
thread_safe (~> 0.3, >= 0.3.1)
|
60
59
|
diff-lcs (1.2.5)
|
61
|
-
dotenv (2.0.1)
|
62
60
|
equalizer (0.0.11)
|
63
61
|
faraday (0.9.1)
|
64
62
|
multipart-post (>= 1.2, < 3)
|
@@ -94,7 +92,7 @@ GEM
|
|
94
92
|
grape-swagger (0.10.1)
|
95
93
|
grape (>= 0.8.0)
|
96
94
|
grape-entity
|
97
|
-
hashie (3.4.
|
95
|
+
hashie (3.4.2)
|
98
96
|
hashie-forbidden_attributes (0.1.1)
|
99
97
|
hashie (>= 3.0)
|
100
98
|
hyperclient (0.7.0)
|
@@ -107,20 +105,20 @@ GEM
|
|
107
105
|
uri_template (~> 0.5)
|
108
106
|
i18n (0.7.0)
|
109
107
|
ice_nine (0.11.1)
|
110
|
-
json (1.8.
|
108
|
+
json (1.8.3)
|
111
109
|
little-plugger (1.1.3)
|
112
110
|
logging (2.0.0)
|
113
111
|
little-plugger (~> 1.1)
|
114
112
|
multi_json (~> 1.10)
|
115
113
|
mini_portile (0.6.2)
|
116
|
-
minitest (5.
|
114
|
+
minitest (5.7.0)
|
117
115
|
multi_json (1.11.0)
|
118
116
|
multi_xml (0.5.5)
|
119
117
|
multipart-post (2.0.0)
|
120
118
|
net-http-digest_auth (1.4)
|
121
119
|
nokogiri (1.6.6.2)
|
122
120
|
mini_portile (~> 0.6.0)
|
123
|
-
parser (2.2.2.
|
121
|
+
parser (2.2.2.5)
|
124
122
|
ast (>= 1.1, < 3.0)
|
125
123
|
powerpack (0.1.1)
|
126
124
|
rack (1.6.1)
|
@@ -135,7 +133,7 @@ GEM
|
|
135
133
|
rack-test (>= 0.5)
|
136
134
|
rainbow (2.0.0)
|
137
135
|
rake (10.4.2)
|
138
|
-
representable (2.2.
|
136
|
+
representable (2.2.2)
|
139
137
|
multi_json
|
140
138
|
nokogiri
|
141
139
|
uber (~> 0.0.7)
|
@@ -161,9 +159,9 @@ GEM
|
|
161
159
|
rainbow (>= 1.99.1, < 3.0)
|
162
160
|
ruby-progressbar (~> 1.4)
|
163
161
|
ruby-progressbar (1.7.5)
|
164
|
-
ruby_parser (3.
|
162
|
+
ruby_parser (3.7.0)
|
165
163
|
sexp_processor (~> 4.1)
|
166
|
-
sexp_processor (4.
|
164
|
+
sexp_processor (4.6.0)
|
167
165
|
sqlite3 (1.3.10)
|
168
166
|
thor (0.19.1)
|
169
167
|
thread_safe (0.3.5)
|
data/gris.gemspec
CHANGED
@@ -22,7 +22,6 @@ 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', '~> 2.0', '>= 2.0'
|
26
25
|
s.add_runtime_dependency 'logging', '~> 2.0'
|
27
26
|
s.add_runtime_dependency 'grape', '~> 0.11.0', '>= 0.11.0'
|
28
27
|
s.add_runtime_dependency 'grape-roar', '~> 0.3.0', '>= 0.3.0'
|
data/lib/gris.rb
CHANGED
data/lib/gris/cli.rb
CHANGED
@@ -1,20 +1,16 @@
|
|
1
|
-
|
2
|
-
encoding: unicode
|
1
|
+
default: &default
|
3
2
|
adapter: postgresql
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
pool:
|
9
|
-
|
10
|
-
production:
|
11
|
-
<<: *defaults
|
3
|
+
encoding: unicode
|
4
|
+
host: localhost
|
5
|
+
username: <%%= ENV['DB_USER'] %>
|
6
|
+
password: <%%= ENV['DB_PASS'] %>
|
7
|
+
pool: 5
|
12
8
|
|
13
9
|
development:
|
14
|
-
<<: *
|
10
|
+
<<: *default
|
11
|
+
database: <%= app_name %>_development
|
15
12
|
|
16
13
|
test:
|
17
|
-
<<: *
|
14
|
+
<<: *default
|
15
|
+
database: <%= app_name %>_test
|
18
16
|
|
19
|
-
staging:
|
20
|
-
<<: *defaults
|
@@ -0,0 +1,15 @@
|
|
1
|
+
default: &:default
|
2
|
+
service_name: <%= app_name %>
|
3
|
+
permitted_tokens: replace-me
|
4
|
+
base_url: <%%= ENV['BASE_URL'] || 'http://localhost:9292' %>
|
5
|
+
|
6
|
+
development:
|
7
|
+
<<: *default
|
8
|
+
|
9
|
+
test:
|
10
|
+
<<: *default
|
11
|
+
|
12
|
+
production:
|
13
|
+
<<: *default
|
14
|
+
permitted_tokens: <%%= ENV['PERMITTED_TOKENS'] %>
|
15
|
+
|
@@ -3,11 +3,10 @@ shared_context 'with a running app' do
|
|
3
3
|
end
|
4
4
|
|
5
5
|
shared_context 'with token authorization' do
|
6
|
+
let(:permitted_token) { Gris.secrets.permitted_tokens }
|
6
7
|
before(:each) do
|
7
|
-
permitted_token = ENV['PERMITTED_TOKENS'].split(',').first if ENV['PERMITTED_TOKENS']
|
8
8
|
header 'Http-Authorization', permitted_token
|
9
9
|
end
|
10
|
-
let(:permitted_token) { ENV['PERMITTED_TOKENS'].split(',').first }
|
11
10
|
end
|
12
11
|
|
13
12
|
shared_context 'with a running app and client' do
|
data/lib/gris/identity.rb
CHANGED
data/lib/gris/setup.rb
CHANGED
@@ -1,13 +1,7 @@
|
|
1
1
|
require 'active_support'
|
2
|
-
require 'dotenv'
|
3
2
|
|
4
3
|
module Gris
|
5
4
|
class << self
|
6
|
-
def load_environment
|
7
|
-
env_file = Gris.env.test? ? '.env.test' : '.env'
|
8
|
-
Dotenv.overload env_file
|
9
|
-
end
|
10
|
-
|
11
5
|
def env
|
12
6
|
@_env ||= ActiveSupport::StringInquirer.new(ENV['RACK_ENV'] || 'development')
|
13
7
|
end
|
@@ -16,6 +10,22 @@ module Gris
|
|
16
10
|
@_env = ActiveSupport::StringInquirer.new(environment)
|
17
11
|
end
|
18
12
|
|
13
|
+
# adapted from https://github.com/rails/rails/blob/master/railties/lib/rails/application.rb
|
14
|
+
# Returns secrets added to config/secrets.yml.
|
15
|
+
def secrets
|
16
|
+
@secrets ||= begin
|
17
|
+
secrets = ActiveSupport::OrderedOptions.new
|
18
|
+
yaml = 'config/secrets.yml'
|
19
|
+
if File.exist?(yaml)
|
20
|
+
require 'erb'
|
21
|
+
all_secrets = YAML.load(ERB.new(IO.read(yaml)).result) || {}
|
22
|
+
env_secrets = all_secrets[Gris.env]
|
23
|
+
secrets.merge!(env_secrets.symbolize_keys) if env_secrets
|
24
|
+
end
|
25
|
+
secrets
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
19
29
|
def db_connection_details
|
20
30
|
YAML.load(ERB.new(File.read('./config/database.yml')).result)[Gris.env]
|
21
31
|
end
|
data/lib/gris/version.rb
CHANGED
@@ -33,24 +33,12 @@ describe Gris::Generators::ScaffoldGenerator do
|
|
33
33
|
expect(Dir).to exist(app_path)
|
34
34
|
end
|
35
35
|
|
36
|
-
it 'creates a .env.example file with with a development database name' do
|
37
|
-
expect(File).to exist("#{app_path}/.env.example")
|
38
|
-
env_file = File.read("#{app_path}/.env.example")
|
39
|
-
expect(env_file).to match(/#{app_name}_development/)
|
40
|
-
end
|
41
|
-
|
42
36
|
it 'creates a Procfile file with puma ' do
|
43
37
|
expect(File).to exist("#{app_path}/Procfile")
|
44
38
|
env_file = File.read("#{app_path}/Procfile")
|
45
39
|
expect(env_file).to match(/web: bundle exec puma/)
|
46
40
|
end
|
47
41
|
|
48
|
-
it 'creates a .env.example file with a development database name' do
|
49
|
-
expect(File).to exist("#{app_path}/.env.example")
|
50
|
-
env_test_file = File.read("#{app_path}/.env.example")
|
51
|
-
expect(env_test_file).to match(/#{app_name}_development/)
|
52
|
-
end
|
53
|
-
|
54
42
|
it 'selects postgresql as the default database adapter' do
|
55
43
|
database_config_file = File.read("#{app_path}/config/database.yml")
|
56
44
|
expect(database_config_file).to match(/adapter: postgresql/)
|
@@ -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
|
-
|
6
|
+
Gris.secrets.permitted_tokens = 'my-token,another-token'
|
7
7
|
@helper = SpecApiAuthHelper.new
|
8
8
|
end
|
9
9
|
|
data/spec/identity_spec.rb
CHANGED
@@ -33,14 +33,8 @@ describe Gris::Identity do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
context '#name' do
|
36
|
-
it
|
37
|
-
|
38
|
-
expect(Gris::Identity.name).to eq('api-service')
|
39
|
-
end
|
40
|
-
|
41
|
-
it "returns the ENV['SERVICE_NAME'] when specified" do
|
42
|
-
ENV['SERVICE_NAME'] = nil
|
43
|
-
ENV['SERVICE_NAME'] = 'my-service'
|
36
|
+
it 'returns the Gris.secrets.service_name when specified' do
|
37
|
+
Gris.secrets.service_name = 'my-service'
|
44
38
|
expect(Gris::Identity.name).to eq('my-service')
|
45
39
|
end
|
46
40
|
end
|
@@ -72,14 +66,8 @@ describe Gris::Identity do
|
|
72
66
|
end
|
73
67
|
|
74
68
|
context '#base_url' do
|
75
|
-
it 'returns
|
76
|
-
|
77
|
-
expect(Gris::Identity.base_url).to eq('http://localhost:9292')
|
78
|
-
end
|
79
|
-
|
80
|
-
it "returns the env['BASE_URL'] when specied" do
|
81
|
-
ENV['BASE_URL'] = nil
|
82
|
-
ENV['BASE_URL'] = 'my-base-url'
|
69
|
+
it 'returns the Gris.secrets.base_url when specied' do
|
70
|
+
Gris.secrets.base_url = 'my-base-url'
|
83
71
|
expect(Gris::Identity.base_url).to eq('my-base-url')
|
84
72
|
end
|
85
73
|
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.
|
4
|
+
version: 0.3.0
|
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-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -90,26 +90,6 @@ dependencies:
|
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 1.2.8
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: dotenv
|
95
|
-
requirement: !ruby/object:Gem::Requirement
|
96
|
-
requirements:
|
97
|
-
- - "~>"
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '2.0'
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '2.0'
|
103
|
-
type: :runtime
|
104
|
-
prerelease: false
|
105
|
-
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '2.0'
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '2.0'
|
113
93
|
- !ruby/object:Gem::Dependency
|
114
94
|
name: logging
|
115
95
|
requirement: !ruby/object:Gem::Requirement
|
@@ -358,7 +338,6 @@ files:
|
|
358
338
|
- lib/gris/generators/templates/api/spec/models/%name_underscore%_spec.rb.tt
|
359
339
|
- lib/gris/generators/templates/create_table_migration/%migration_filename%.rb.tt
|
360
340
|
- lib/gris/generators/templates/migration/%migration_filename%.rb.tt
|
361
|
-
- lib/gris/generators/templates/scaffold/.env.example.tt
|
362
341
|
- lib/gris/generators/templates/scaffold/.gitignore.tt
|
363
342
|
- lib/gris/generators/templates/scaffold/.rspec.tt
|
364
343
|
- lib/gris/generators/templates/scaffold/.rubocop.yml
|
@@ -376,6 +355,7 @@ files:
|
|
376
355
|
- lib/gris/generators/templates/scaffold/config/database.yml.tt
|
377
356
|
- lib/gris/generators/templates/scaffold/config/initializers/active_record.rb
|
378
357
|
- lib/gris/generators/templates/scaffold/config/puma.rb
|
358
|
+
- lib/gris/generators/templates/scaffold/config/secrets.yml.tt
|
379
359
|
- lib/gris/generators/templates/scaffold/db/schema.rb
|
380
360
|
- lib/gris/generators/templates/scaffold/spec/endpoints/cors_spec.rb.tt
|
381
361
|
- lib/gris/generators/templates/scaffold/spec/spec_helper.rb
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# Uncomment when using Gris::Middleware::Authentication
|
2
|
-
# HEADER_PASSWORD=''
|
3
|
-
|
4
|
-
SERVICE_NAME=<%= app_name %>
|
5
|
-
|
6
|
-
DATABASE_USER='postgres'
|
7
|
-
DATABASE_PASSWORD=''
|
8
|
-
DATABASE_HOST=localhost
|
9
|
-
DATABASE_NAME=<%= app_name.underscore %>_development
|
10
|
-
BASE_URL=http://127.0.0.1:9393
|
11
|
-
PERMITTED_TOKENS=replace-me
|