secretive 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,14 @@
|
|
1
1
|
class SecretsGenerator < ::Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
|
2
4
|
def create_secrets_file
|
3
5
|
create_file("#{Rails.root}/config/secrets.yml")
|
4
6
|
end
|
5
|
-
|
6
|
-
def
|
7
|
-
|
7
|
+
|
8
|
+
def copy_example_file
|
9
|
+
copy_file('secrets.yml.example', "#{Rails.root}/config/secrets.yml.example")
|
8
10
|
end
|
9
|
-
|
11
|
+
|
10
12
|
def gitignore_secrets_file
|
11
13
|
append_to_file("#{Rails.root}/.gitignore") do
|
12
14
|
"\n\n" +
|
@@ -15,4 +17,4 @@ class SecretsGenerator < ::Rails::Generators::Base
|
|
15
17
|
"config/secrets.yml"
|
16
18
|
end
|
17
19
|
end
|
18
|
-
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# We recommend you use this file to describe the structure of your real secrets.yml file.
|
2
|
+
#
|
3
|
+
# This file can then be committed to version control and provide hints to other developers
|
4
|
+
# about what keys they need.
|
5
|
+
#
|
6
|
+
# This file is not required by secretive - it's just here for your convenience.
|
7
|
+
|
8
|
+
test:
|
9
|
+
EXAMPLE_SECRET:
|
10
|
+
|
11
|
+
development:
|
12
|
+
EXAMPLE_SECRET:
|
13
|
+
|
14
|
+
production:
|
15
|
+
EXAMPLE_SECRET:
|
data/lib/secretive/loader.rb
CHANGED
@@ -8,6 +8,7 @@ module Secretive
|
|
8
8
|
end
|
9
9
|
|
10
10
|
vars = YAML.load(File.open(yaml_file))
|
11
|
+
return unless vars.present?
|
11
12
|
|
12
13
|
convert_to_env_vars(vars)
|
13
14
|
convert_to_env_vars(vars.fetch(scope)) if scope.present?
|
@@ -42,4 +43,4 @@ module Secretive
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
end
|
45
|
-
end
|
46
|
+
end
|
data/lib/secretive/railtie.rb
CHANGED
data/lib/secretive/version.rb
CHANGED
data/secretive.gemspec
CHANGED
data/spec/loader_spec.rb
CHANGED
@@ -25,6 +25,7 @@ describe Secretive::Loader do
|
|
25
25
|
|
26
26
|
context "without a secrets file" do
|
27
27
|
it "doesn't barf" do
|
28
|
+
subject.stub(:warn) # Prevent warning from displaying in test output
|
28
29
|
expect { subject.environmentalize!(nonexistent_secrets) }.not_to raise_error
|
29
30
|
end
|
30
31
|
|
@@ -50,6 +51,10 @@ describe Secretive::Loader do
|
|
50
51
|
expect { subject.environmentalize!(test_secrets, "empty_scope") }.not_to raise_error
|
51
52
|
end
|
52
53
|
|
54
|
+
it "doesn't barf when given a scope when no file is found" do
|
55
|
+
expect { subject.environmentalize!(empty_secrets, "any_scope") }.not_to raise_error
|
56
|
+
end
|
57
|
+
|
53
58
|
it "still environmentalizes top-level variables" do
|
54
59
|
ENV["FAVORITE_COLOR"] = nil
|
55
60
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secretive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 2.9.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: pry
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
description: Secretive converts variables in a YAML file into ENV vars. It's useful
|
63
79
|
for storing API keys and other sensitive information.
|
64
80
|
email:
|
@@ -74,6 +90,7 @@ files:
|
|
74
90
|
- README.md
|
75
91
|
- Rakefile
|
76
92
|
- lib/generators/secrets_generator.rb
|
93
|
+
- lib/generators/templates/secrets.yml.example
|
77
94
|
- lib/secretive.rb
|
78
95
|
- lib/secretive/loader.rb
|
79
96
|
- lib/secretive/railtie.rb
|