gris 0.4.4 → 0.4.5

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: 6718fa8810cdc849424f62dfad2e12c47c3b9d38
4
- data.tar.gz: 82de9f1d439386614bcf8a037382c0c8a40eee24
3
+ metadata.gz: 7b4abfeb569455ac1557220759fed00d91b12698
4
+ data.tar.gz: 5a07d55604ba7d0f070a03e3d1066796ceab5f60
5
5
  SHA512:
6
- metadata.gz: d4afc70c3a4e8f2c74283e8f9b8b4edca4c417327774d0efe1fe4fc850f681d0ab955b3def9da585580165ecbd0b8ca71a5fe312a74079559f6f5d371fc0b60c
7
- data.tar.gz: 4fa100baca239ebe31e2a2f79862c98d4fd83ded2c1136b1741122e8b6ff1b8285282471ba8d09a64290a5f99982a918969fec401551cc6f6e3e391694738a57
6
+ metadata.gz: df3b86ca754667587d31fe5d70cb079c890009f0c31ee8588425e12e058bea9514e9848326476d582856e9f312d235df6e380ad7e32672a7e70f47d8685335e3
7
+ data.tar.gz: 57159e0bec4873868f9437f49c14694720775730af8210b623f4866a3b53ba5dce81349c68fae28f95ac12cd57b7ee467941f864acaea2f19f8dd52080f268e0
data/Gemfile CHANGED
@@ -14,4 +14,5 @@ end
14
14
  group :test do
15
15
  gem 'childprocess'
16
16
  gem 'hyperclient'
17
+ gem 'fakefs'
17
18
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gris (0.4.4)
4
+ gris (0.4.5)
5
5
  activesupport (~> 4.2, >= 4.2.0)
6
6
  chronic (~> 0.10.0)
7
7
  dalli (~> 2.7)
@@ -59,6 +59,7 @@ GEM
59
59
  thread_safe (~> 0.3, >= 0.3.1)
60
60
  diff-lcs (1.2.5)
61
61
  equalizer (0.0.11)
62
+ fakefs (0.6.7)
62
63
  faraday (0.9.1)
63
64
  multipart-post (>= 1.2, < 3)
64
65
  faraday-digestauth (0.2.1)
@@ -90,7 +91,7 @@ GEM
90
91
  grape-roar (0.3.0)
91
92
  grape
92
93
  roar (>= 1.0)
93
- grape-swagger (0.10.1)
94
+ grape-swagger (0.10.2)
94
95
  grape (>= 0.8.0)
95
96
  grape-entity
96
97
  hashie (3.4.2)
@@ -182,6 +183,7 @@ DEPENDENCIES
182
183
  bundler (~> 1)
183
184
  byebug
184
185
  childprocess
186
+ fakefs
185
187
  fasterer
186
188
  gris!
187
189
  hyperclient
data/README.md CHANGED
@@ -34,6 +34,13 @@ $ bundle install
34
34
 
35
35
  ---
36
36
 
37
+ ### Quickstart Demo(s)
38
+
39
+ You can find example pull requests providing walkthroughs of new app set up here:
40
+ [https://github.com/artsy/gris-demo/pulls](https://github.com/artsy/gris-demo/pulls)
41
+
42
+ ---
43
+
37
44
  ### Usage
38
45
 
39
46
  ##### CLI & Generators
@@ -74,4 +81,6 @@ or, if you have an instance, use
74
81
 
75
82
  ### The name
76
83
 
77
- Gris is named for [Juan Gris](https://www.artsy.net/artist/juan-gris) (but also works in the wine-based word context of Grape and Napa). Cleverness!
84
+ Gris is named for the Cubist painter [Juan Gris](https://www.artsy.net/artist/juan-gris).
85
+
86
+ ![juan-gris-bottles-and-bowl-1911](https://cloud.githubusercontent.com/assets/197336/9348124/5ef5531c-4600-11e5-8318-4858076d7c6d.jpg)
data/lib/gris/setup.rb CHANGED
@@ -14,14 +14,11 @@ module Gris
14
14
  # Returns secrets added to config/secrets.yml.
15
15
  def secrets
16
16
  @secrets ||= begin
17
- secrets = ActiveSupport::OrderedOptions.new
17
+ secrets = Hashie::Mash.new
18
18
  yaml = 'config/secrets.yml'
19
- if File.exist?(yaml)
20
- require 'erb'
21
- # safe_load yaml, whitelist_classes = [], whitelist_symbols = [], aliases = false, filename = nil
22
- all_secrets = YAML.safe_load(ERB.new(IO.read(yaml)).result, [], [], true) || {}
23
- env_secrets = all_secrets[Gris.env]
24
- secrets.merge!(env_secrets.symbolize_keys) if env_secrets
19
+ if File.exist? yaml
20
+ env_secrets = Hashie::Mash.load(yaml)[Gris.env]
21
+ secrets.merge!(env_secrets) if env_secrets
25
22
  end
26
23
  secrets
27
24
  end
data/lib/gris/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Gris
2
- VERSION = '0.4.4'
2
+ VERSION = '0.4.5'
3
3
 
4
4
  class Version
5
5
  class << self
@@ -0,0 +1,8 @@
1
+ default: &default
2
+ service_name: my_default_app
3
+ base_url: https://www.youtube.com/watch?v=RI6973HNh8Y
4
+ permitted_tokens: my-token,another-token
5
+
6
+ test:
7
+ <<: *default
8
+ service_name: my_test_app
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Gris::AuthenticationHelpers do
4
+ include_context 'with secrets from config/secrets.yml'
4
5
  context 'without permitted token' do
5
6
  before(:each) do
6
- Gris.secrets.permitted_tokens = 'my-token,another-token'
7
7
  @helper = SpecApiAuthHelper.new
8
8
  end
9
9
 
@@ -1,7 +1,8 @@
1
1
  require 'spec_helper'
2
- require 'gris/identity'
3
2
 
4
3
  describe Gris::Identity do
4
+ include_context 'with secrets from config/secrets.yml'
5
+
5
6
  before do
6
7
  allow(Process).to receive(:pid).and_return(123)
7
8
  allow(Gris::Identity).to receive(:hostname).and_return('system-hostname')
@@ -10,65 +11,63 @@ describe Gris::Identity do
10
11
 
11
12
  context '#health' do
12
13
  it 'includes name' do
13
- expect(Gris::Identity.health[:name]).to eq(Gris::Identity.name)
14
+ expect(Gris::Identity.health[:name]).to eq Gris::Identity.name
14
15
  end
15
16
  it 'includes base_url' do
16
- expect(Gris::Identity.health[:base_url]).to eq(Gris::Identity.base_url)
17
+ expect(Gris::Identity.health[:base_url]).to eq Gris::Identity.base_url
17
18
  end
18
19
  it 'includes hostname' do
19
- expect(Gris::Identity.health[:hostname]).to eq(Gris::Identity.hostname)
20
+ expect(Gris::Identity.health[:hostname]).to eq Gris::Identity.hostname
20
21
  end
21
22
  it 'includes revision' do
22
- expect(Gris::Identity.health[:revision]).to eq(Gris::Identity.revision)
23
+ expect(Gris::Identity.health[:revision]).to eq Gris::Identity.revision
23
24
  end
24
25
  it 'includes pid' do
25
- expect(Gris::Identity.health[:pid]).to eq(Gris::Identity.pid)
26
+ expect(Gris::Identity.health[:pid]).to eq Gris::Identity.pid
26
27
  end
27
28
  it 'includes parent_pid' do
28
- expect(Gris::Identity.health[:parent_pid]).to eq(Gris::Identity.parent_pid)
29
+ expect(Gris::Identity.health[:parent_pid]).to eq Gris::Identity.parent_pid
29
30
  end
30
31
  it 'includes platform' do
31
- expect(Gris::Identity.health[:platform]).to eq(Gris::Identity.platform)
32
+ expect(Gris::Identity.health[:platform]).to eq Gris::Identity.platform
32
33
  end
33
34
  end
34
35
 
35
36
  context '#name' do
36
37
  it 'returns the Gris.secrets.service_name when specified' do
37
- Gris.secrets.service_name = 'my-service'
38
- expect(Gris::Identity.name).to eq('my-service')
38
+ expect(Gris::Identity.name).to eq 'my_test_app'
39
39
  end
40
40
  end
41
41
 
42
42
  context '#hostname' do
43
43
  it 'returns the value of the hostname system call and doesn\'t make a second system call' do
44
44
  expect(Gris::Identity).to_not receive(:`).with('hostname')
45
- expect(Gris::Identity.hostname).to eq('system-hostname')
45
+ expect(Gris::Identity.hostname).to eq 'system-hostname'
46
46
  end
47
47
  end
48
48
 
49
49
  context '#revision' do
50
50
  it 'returns the value of the \'git rev-parse HEAD\' system call and doesn\'t make a second system call' do
51
51
  expect(Gris::Identity).to_not receive(:`).with('git rev-parse HEAD')
52
- expect(Gris::Identity.revision).to eq('12345')
52
+ expect(Gris::Identity.revision).to eq '12345'
53
53
  end
54
54
  end
55
55
 
56
56
  context '#pid' do
57
57
  it 'returns the process ID value' do
58
- expect(Gris::Identity.pid).to eq(123)
58
+ expect(Gris::Identity.pid).to eq 123
59
59
  end
60
60
  end
61
61
 
62
62
  context '#platform_revision' do
63
63
  it 'returns the current version of the platform gem' do
64
- expect(Gris::Identity.platform_revision).to eq(Gris::VERSION)
64
+ expect(Gris::Identity.platform_revision).to eq Gris::VERSION
65
65
  end
66
66
  end
67
67
 
68
68
  context '#base_url' do
69
- it 'returns the Gris.secrets.base_url when specied' do
70
- Gris.secrets.base_url = 'my-base-url'
71
- expect(Gris::Identity.base_url).to eq('my-base-url')
69
+ it 'returns the Gris.secrets.base_url when specified' do
70
+ expect(Gris::Identity.base_url).to eq 'https://www.youtube.com/watch?v=RI6973HNh8Y'
72
71
  end
73
72
  end
74
73
  end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Gris.secrets' do
4
+ context 'with a local yaml file' do
5
+ include_context 'with secrets from config/secrets.yml'
6
+
7
+ it 'sets the secret property corresponding to the current Gris.env' do
8
+ expect(Gris.secrets.service_name).to eq 'my_test_app'
9
+ end
10
+
11
+ it 'sets the secret property corresponding to the default value' do
12
+ expect(Gris.secrets.base_url).to eq 'https://www.youtube.com/watch?v=RI6973HNh8Y'
13
+ end
14
+ end
15
+
16
+ context 'without a local yaml file' do
17
+ [true, 1, 0, 'anystring'].each do |value|
18
+ it "returns true when value is #{value.inspect}" do
19
+ Gris.secrets.notifications_enabled = value
20
+ expect(Gris.secrets.notifications_enabled?).to be_truthy
21
+ end
22
+ end
23
+
24
+ [false, nil].each do |value|
25
+ it "returns false when value is #{value.inspect}" do
26
+ Gris.secrets.notifications_enabled = value
27
+ expect(Gris.secrets.notifications_enabled?).to_not be_truthy
28
+ end
29
+ end
30
+ end
31
+ end
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,7 @@ require 'childprocess'
5
5
  require 'gris'
6
6
  require 'gris/cli'
7
7
  require 'rack/test'
8
+ require 'fakefs/spec_helpers'
8
9
 
9
10
  # Requires supporting ruby files with custom matchers and macros, etc,
10
11
  # in spec/support/ and its subdirectories.
@@ -0,0 +1,11 @@
1
+ shared_context 'with secrets from config/secrets.yml' do
2
+ include FakeFS::SpecHelpers
3
+
4
+ before do
5
+ content = IO.read 'spec/fixtures/secrets.yml'
6
+ FileUtils.mkdir_p 'config'
7
+ File.open('config/secrets.yml', 'w+') do |file|
8
+ file.write content
9
+ end
10
+ end
11
+ 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.4
4
+ version: 0.4.5
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-08-17 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -385,6 +385,7 @@ files:
385
385
  - lib/tasks/routes.rake
386
386
  - spec/cache_spec.rb
387
387
  - spec/caching_spec.rb
388
+ - spec/fixtures/secrets.yml
388
389
  - spec/generators/api_generator_spec.rb
389
390
  - spec/generators/migration_generator_spec.rb
390
391
  - spec/generators/scaffold_generator_spec.rb
@@ -396,6 +397,7 @@ files:
396
397
  - spec/integration/application_error_response_spec.rb
397
398
  - spec/integration/token_authentication_spec.rb
398
399
  - spec/output_formatters/root_presenter_spec.rb
400
+ - spec/secrets_spec.rb
399
401
  - spec/spec_helper.rb
400
402
  - spec/support/caching_helper.rb
401
403
  - spec/support/integration_setup.rb
@@ -403,6 +405,7 @@ files:
403
405
  - spec/support/spec_api_error_helper.rb
404
406
  - spec/support/spec_crud_helper.rb
405
407
  - spec/support/spec_generators_helper.rb
408
+ - spec/support/spec_secrets_helper.rb
406
409
  - spec/version_spec.rb
407
410
  homepage: http://github.com/artsy/gris/
408
411
  licenses:
@@ -431,6 +434,7 @@ summary: A simple api microservice generator framework.
431
434
  test_files:
432
435
  - spec/cache_spec.rb
433
436
  - spec/caching_spec.rb
437
+ - spec/fixtures/secrets.yml
434
438
  - spec/generators/api_generator_spec.rb
435
439
  - spec/generators/migration_generator_spec.rb
436
440
  - spec/generators/scaffold_generator_spec.rb
@@ -442,6 +446,7 @@ test_files:
442
446
  - spec/integration/application_error_response_spec.rb
443
447
  - spec/integration/token_authentication_spec.rb
444
448
  - spec/output_formatters/root_presenter_spec.rb
449
+ - spec/secrets_spec.rb
445
450
  - spec/spec_helper.rb
446
451
  - spec/support/caching_helper.rb
447
452
  - spec/support/integration_setup.rb
@@ -449,4 +454,5 @@ test_files:
449
454
  - spec/support/spec_api_error_helper.rb
450
455
  - spec/support/spec_crud_helper.rb
451
456
  - spec/support/spec_generators_helper.rb
457
+ - spec/support/spec_secrets_helper.rb
452
458
  - spec/version_spec.rb