rails-creds 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -2
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -1
- data/Rakefile +2 -2
- data/creds.gemspec +19 -19
- data/lib/creds/errors.rb +6 -4
- data/lib/creds/version.rb +1 -1
- data/lib/creds.rb +10 -6
- data/lib/rails-creds.rb +1 -3
- metadata +8 -9
- data/.rubocop.yml +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 180c1ca9192de8e7d152b8287d51031006f724e76e35620c7c19111c97cca536
|
4
|
+
data.tar.gz: dc4cb85e4083a01a2b825b5568cc56e0391d932e3c9683c466c55f72d676656b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56cd8bd00245b4e15d5a9b145e420e8f330a7d76a5db58a38d9580d97b4cdf3319ce10ddc52c6b7de1a4611e20c2a69a836978c21e1af988e50025548ee7f8e1
|
7
|
+
data.tar.gz: d017e6fbaf58ae2844a91bd820930054696b2b438ec995ff7fc37a1cad8b5f2983fcde085662afa8e15d489552fd0f81b1e989ffc921429c080c4d79122a022a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/creds.gemspec
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
lib = File.expand_path(
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require
|
3
|
+
require "creds/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
6
|
+
spec.name = "rails-creds"
|
7
|
+
spec.version = Creds::VERSION
|
8
|
+
spec.authors = ["Mikkel Malmberg"]
|
9
|
+
spec.email = ["mikkel@brnbw.com"]
|
10
10
|
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
13
|
-
spec.homepage
|
14
|
-
spec.metadata
|
15
|
-
spec.license
|
11
|
+
spec.summary = "Shorter, env-scoped version of Rails' credentials"
|
12
|
+
spec.description = ""
|
13
|
+
spec.homepage = "https://github.com/mikker/rails-creds"
|
14
|
+
spec.metadata = {"source_code_uri" => "https://github.com/mikker/rails-creds"}
|
15
|
+
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
18
|
f.match(%r{^(test|spec|features)/})
|
19
19
|
end
|
20
|
-
spec.bindir
|
21
|
-
spec.executables
|
22
|
-
spec.require_paths = [
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_dependency
|
24
|
+
spec.add_dependency "rails", "> 5.2"
|
25
25
|
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
spec.add_development_dependency "standard", "~> 0.1.0"
|
30
30
|
end
|
data/lib/creds/errors.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "active_support/core_ext/string/strip"
|
2
|
+
|
1
3
|
class Creds
|
2
4
|
class MissingCredentialsWarning
|
3
5
|
MESSAGE =
|
@@ -6,8 +8,8 @@ class Creds
|
|
6
8
|
Creds will return nil for any key.
|
7
9
|
Run this to generate your credentials file:
|
8
10
|
$ bin/rails credentials:edit
|
9
|
-
|
10
|
-
|
11
|
+
MSG
|
12
|
+
.strip_heredoc.freeze
|
11
13
|
end
|
12
14
|
|
13
15
|
# @api private
|
@@ -43,7 +45,7 @@ class Creds
|
|
43
45
|
<<: *default
|
44
46
|
aws_key: 'you can override defaults for individual environments'
|
45
47
|
MSG
|
46
|
-
|
48
|
+
.strip_heredoc.freeze
|
47
49
|
# rubocop:enable Layout/TrailingWhitespace
|
48
50
|
|
49
51
|
def initialize(env)
|
@@ -60,7 +62,7 @@ class Creds
|
|
60
62
|
Either get or recover the file config/master.key
|
61
63
|
or set the environment variable RAILS_MASTER_KEY
|
62
64
|
MSG
|
63
|
-
|
65
|
+
.strip_heredoc.freeze
|
64
66
|
|
65
67
|
def initalize
|
66
68
|
super(MESSAGE)
|
data/lib/creds/version.rb
CHANGED
data/lib/creds.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "rails"
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "creds/version"
|
6
|
+
require "creds/errors"
|
7
7
|
|
8
8
|
# The main module of rails-creds
|
9
9
|
class Creds
|
@@ -15,9 +15,11 @@ class Creds
|
|
15
15
|
true
|
16
16
|
end
|
17
17
|
|
18
|
+
# rubocop:disable Style/MethodMissingSuper
|
18
19
|
def method_missing(*_args)
|
19
20
|
nil
|
20
21
|
end
|
22
|
+
# rubocop:enable Style/MethodMissingSuper
|
21
23
|
|
22
24
|
def nil?
|
23
25
|
true
|
@@ -28,11 +30,13 @@ class Creds
|
|
28
30
|
true
|
29
31
|
end
|
30
32
|
|
33
|
+
# rubocop:disable Style/MethodMissingSuper
|
31
34
|
def self.method_missing(name, *_args)
|
32
35
|
instance.credentials.fetch(name)
|
33
36
|
rescue KeyError
|
34
37
|
raise MissingKeyError.new(name, Rails.env)
|
35
38
|
end
|
39
|
+
# rubocop:enable Style/MethodMissingSuper
|
36
40
|
|
37
41
|
def self.to_h
|
38
42
|
instance.credentials
|
@@ -60,12 +64,12 @@ class Creds
|
|
60
64
|
end
|
61
65
|
|
62
66
|
def encrypted_credentials_exist?
|
63
|
-
File.exist? Rails.root.join(
|
67
|
+
File.exist? Rails.root.join("config", "credentials.yml.enc")
|
64
68
|
end
|
65
69
|
|
66
70
|
def master_key_present?
|
67
|
-
return true if ENV[
|
68
|
-
return true if File.exist?(Rails.root.join(
|
71
|
+
return true if ENV["RAILS_MASTER_KEY"]
|
72
|
+
return true if File.exist?(Rails.root.join("config", "master.key"))
|
69
73
|
false
|
70
74
|
end
|
71
75
|
end
|
data/lib/rails-creds.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-creds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikkel Malmberg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +67,19 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: standard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.1.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.1.0
|
83
83
|
description: ''
|
84
84
|
email:
|
85
85
|
- mikkel@brnbw.com
|
@@ -89,7 +89,6 @@ extra_rdoc_files: []
|
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
91
|
- ".rspec"
|
92
|
-
- ".rubocop.yml"
|
93
92
|
- ".travis.yml"
|
94
93
|
- CHANGELOG.md
|
95
94
|
- CODE_OF_CONDUCT.md
|
@@ -123,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
122
|
- !ruby/object:Gem::Version
|
124
123
|
version: '0'
|
125
124
|
requirements: []
|
126
|
-
rubygems_version: 3.0.
|
125
|
+
rubygems_version: 3.0.4
|
127
126
|
signing_key:
|
128
127
|
specification_version: 4
|
129
128
|
summary: Shorter, env-scoped version of Rails' credentials
|