credentials_for_rails_env 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 7c299974881105b0076df8ba2f9353c5caa97d17acb2e574dce2a7a5d3bc74a1
4
- data.tar.gz: 97f3a3df0c98e41bcbec107afbf6191b03963ec88ced15748fd742f811c41336
3
+ metadata.gz: 9aff582c5235a95b2f69881a44ccf9ce60952f550e597e6fc65860ccdc535978
4
+ data.tar.gz: 462df324f45466b15a426b59fb5cf21088dc0dc00acc2385cbabeb4a5e59b79c
5
5
  SHA512:
6
- metadata.gz: b28dca61caab7ea9cb25b988a0744698ea8acbf2045bf805389705493a63b480f3816969b8ab30a2cf56cd3e0ae36002b128e77e375690f3454f6ff6e1de04b4
7
- data.tar.gz: 5b80af7f2afeaeb45fd4b06d10d52d10e2ca1eb9f50512b8650a7f90350fe62e2edd08b8e1deba1b13998b1d433be0d41156e948ef89f30b66117372e9053ea5
6
+ metadata.gz: 6804f1a48407a57ff049fcfa4f218e307601df3a801398bc29a126682c0704aa1832e16356292fc732faadd002607ee5ccf1d03e605e0b2e54bd944db54f2a84
7
+ data.tar.gz: 109a1487e1b1cb8742fc9e251b3ecc34f34f464a4659d1e39e41e09dd0c6f879630533899015125b2d9a0883bcaeae24a94c05058e824f20171f3526a43f314c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- credentials_for_rails_env (0.1.0)
4
+ credentials_for_rails_env (0.1.2)
5
5
  rails (>= 5.2)
6
6
 
7
7
  GEM
@@ -50,6 +50,7 @@ GEM
50
50
  tzinfo (~> 1.1)
51
51
  arel (9.0.0)
52
52
  builder (3.2.3)
53
+ byebug (10.0.2)
53
54
  concurrent-ruby (1.0.5)
54
55
  crass (1.0.4)
55
56
  diff-lcs (1.3)
@@ -134,6 +135,7 @@ PLATFORMS
134
135
 
135
136
  DEPENDENCIES
136
137
  bundler (~> 1.16)
138
+ byebug
137
139
  credentials_for_rails_env!
138
140
  rake (~> 10.0)
139
141
  rspec (~> 3.0)
data/README.md CHANGED
@@ -1,8 +1,36 @@
1
1
  # CredentialsForRailsEnv
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/credentials_for_rails_env`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Now you can easily fetch different credentials for the each of your RAILS_ENV environments. The new Rails.application.credentials_env method does the work for you. Here is a sample credentials file.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ```yaml
6
+ $ EDITOR=vi rails credentials:edit
7
+ ```
8
+
9
+ ```yaml
10
+ foo: global foo
11
+ development:
12
+ foo: development foo
13
+ production:
14
+ foo: production foo
15
+ ```
16
+
17
+ The new credentials_env method will return values from the RAILS_ENV slice of the credentials. For example if RAILS_ENV == "development":
18
+
19
+ ```ruby
20
+ Rails.application.credentials_env.foo => "development foo"
21
+ Rails.application.credentials_env[:foo] => "development foo"
22
+ Rails.application.credentials_env.fetch(:foo) => "development foo"
23
+ Rails.application.credentials_env.config =>
24
+ { foo: "development foo" }
25
+ ```
26
+
27
+ This makes it very easy to migrate from the deprecated Rails 5.1 secrets convention to the new Rails 5.2 credentials convention. Just add the contents of your secrets file to your credentials file and replace all calls to "Rails.application.secrets" with calls to "Rails.application.credentials_env".
28
+
29
+ You can still call "Rails.application.credentials" as usual.
30
+
31
+ ```ruby
32
+ Rails.application.credentials.foo => "global foo"
33
+ ```
6
34
 
7
35
  ## Installation
8
36
 
@@ -22,7 +50,12 @@ Or install it yourself as:
22
50
 
23
51
  ## Usage
24
52
 
25
- TODO: Write usage instructions here
53
+ ```ruby
54
+ Rails.application.credentials_env.foo
55
+ Rails.application.credentials_env[:foo]
56
+ Rails.application.credentials_env.fetch(:foo)
57
+ Rails.application.credentials_env.config
58
+ ```
26
59
 
27
60
  ## Development
28
61
 
@@ -32,7 +65,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
65
 
33
66
  ## Contributing
34
67
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/credentials_for_rails_env.
68
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jgorman/credentials_for_rails_env.
36
69
 
37
70
  ## License
38
71
 
@@ -37,4 +37,5 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency "bundler", "~> 1.16"
38
38
  spec.add_development_dependency "rake", "~> 10.0"
39
39
  spec.add_development_dependency "rspec", "~> 3.0"
40
+ spec.add_development_dependency "byebug"
40
41
  end
@@ -1,12 +1,6 @@
1
- require "rails/application"
2
- require "active_support/fetch_rails_env"
3
- require "credentials_for_rails_env/version"
1
+ # Rails.application.credentials_env fetches Rails.env slice of the credentials.
4
2
 
5
- # Add Rails.application.credentials_env Rails.env slice of the credentials.
6
- module Rails
7
- class Application < Engine
8
- def credentials_env
9
- @credentials_env ||= ActiveSupport::FetchRailsEnv.new(credentials)
10
- end
11
- end
12
- end
3
+ require "credentials_for_rails_env/version"
4
+ require "active_support/fetch_rails_env"
5
+ require "rails/application"
6
+ require "rails/application/credentials_env"
@@ -1,3 +1,3 @@
1
1
  module CredentialsForRailsEnv
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -0,0 +1,9 @@
1
+ # Rails.application.credentials_env fetches Rails.env slice of the credentials.
2
+
3
+ module Rails
4
+ class Application < Engine
5
+ def credentials_env
6
+ @credentials_env ||= ActiveSupport::FetchRailsEnv.new(credentials)
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: credentials_for_rails_env
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Gorman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-09 00:00:00.000000000 Z
11
+ date: 2018-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Fetch the current RAILS_ENV specific credentials from Rails.application.credentials_env.foo
70
84
  just like Rails.application.secrets.foo.
71
85
  email:
@@ -88,6 +102,7 @@ files:
88
102
  - lib/active_support/fetch_rails_env.rb
89
103
  - lib/credentials_for_rails_env.rb
90
104
  - lib/credentials_for_rails_env/version.rb
105
+ - lib/rails/application/credentials_env.rb
91
106
  homepage: https://github.com/jgorman/credentials_for_rails_env
92
107
  licenses:
93
108
  - MIT