handsomefencer-environment 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.env/backup.env +4 -0
- data/.env/backup.env.enc +3 -0
- data/.env/circle.env +4 -0
- data/.env/circle.env.enc +3 -0
- data/.env/development/backup.env +4 -0
- data/.env/development/backup.env.enc +3 -0
- data/.gitignore +11 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +72 -0
- data/Guardfile +44 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config/deploy.key +1 -0
- data/config/master.key +1 -0
- data/handsomefencer-environment.gemspec +45 -0
- data/lib/handsomefencer/environment/crypto.rb +79 -0
- data/lib/handsomefencer/environment/version.rb +5 -0
- data/lib/handsomefencer/environment.rb +8 -0
- data/lib/rake_gem/railtie.rb +6 -0
- data/lib/rake_gem.rb +6 -0
- data/lib/tasks/environment/expose.rake +14 -0
- data/lib/tasks/environment/obfuscate.rake +9 -0
- data/sourcefiles/circle.env +4 -0
- metadata +201 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 318e2cce8ba4e3017c05e5efe8543ae673b53f6586ed9d3ce3c51ab46caf7347
|
4
|
+
data.tar.gz: 4d62330aa5cf8a8a2b72ad411f0925d52fd7af30ee5a60e25bd825aa28b53e77
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 929c0acfcfacaff131063ca034e6427fa7d3d1581f7f7a77022286149dcf997dc52534c9efab86f74350637aa2b37f0a7901ecb7c14c997dfc192f79c316cbb4
|
7
|
+
data.tar.gz: d584eed249c4fd7bd2dc5c5362ef3f10dbc95c4d48668a78c651c8db6c6378b2260dc167dc1f618e79d7154cfec03dad58d478fad615a863875524e6dd34517a
|
data/.env/backup.env
ADDED
data/.env/backup.env.enc
ADDED
data/.env/circle.env
ADDED
data/.env/circle.env.enc
ADDED
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
handsomefencer-environment
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.5.1
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at fred.schoeneman@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
handsomefencer-environment (0.2.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
byebug (10.0.2)
|
10
|
+
coderay (1.1.2)
|
11
|
+
fakefs (0.18.0)
|
12
|
+
ffi (1.9.25)
|
13
|
+
formatador (0.2.5)
|
14
|
+
given_core (3.8.0)
|
15
|
+
sorcerer (>= 0.3.7)
|
16
|
+
guard (2.14.2)
|
17
|
+
formatador (>= 0.2.4)
|
18
|
+
listen (>= 2.7, < 4.0)
|
19
|
+
lumberjack (>= 1.0.12, < 2.0)
|
20
|
+
nenv (~> 0.1)
|
21
|
+
notiffany (~> 0.0)
|
22
|
+
pry (>= 0.9.12)
|
23
|
+
shellany (~> 0.0)
|
24
|
+
thor (>= 0.18.1)
|
25
|
+
guard-compat (1.2.1)
|
26
|
+
guard-minitest (2.4.6)
|
27
|
+
guard-compat (~> 1.2)
|
28
|
+
minitest (>= 3.0)
|
29
|
+
listen (3.1.5)
|
30
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
31
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
32
|
+
ruby_dep (~> 1.2)
|
33
|
+
lumberjack (1.0.13)
|
34
|
+
method_source (0.9.0)
|
35
|
+
minitest (5.11.3)
|
36
|
+
minitest-given (3.8.0)
|
37
|
+
given_core (= 3.8.0)
|
38
|
+
minitest (> 4.3)
|
39
|
+
nenv (0.3.0)
|
40
|
+
notiffany (0.1.1)
|
41
|
+
nenv (~> 0.1)
|
42
|
+
shellany (~> 0.0)
|
43
|
+
pry (0.11.3)
|
44
|
+
coderay (~> 1.1.0)
|
45
|
+
method_source (~> 0.9.0)
|
46
|
+
rake (12.3.1)
|
47
|
+
rb-fsevent (0.10.3)
|
48
|
+
rb-inotify (0.9.10)
|
49
|
+
ffi (>= 0.5.0, < 2)
|
50
|
+
rb-readline (0.5.5)
|
51
|
+
ruby_dep (1.5.0)
|
52
|
+
shellany (0.0.1)
|
53
|
+
sorcerer (1.0.2)
|
54
|
+
thor (0.20.0)
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
ruby
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
bundler
|
61
|
+
byebug
|
62
|
+
fakefs
|
63
|
+
guard
|
64
|
+
guard-minitest
|
65
|
+
handsomefencer-environment!
|
66
|
+
minitest
|
67
|
+
minitest-given
|
68
|
+
rake
|
69
|
+
rb-readline
|
70
|
+
|
71
|
+
BUNDLED WITH
|
72
|
+
1.16.3
|
data/Guardfile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
guard :minitest do
|
19
|
+
# with Minitest::Unit
|
20
|
+
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
21
|
+
watch(%r{^test/(.*)\/?(.*)_test\.rb$})
|
22
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
23
|
+
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
24
|
+
watch(%r{^lib/(.*)\/?(.*)\.rb$}) { 'test' }
|
25
|
+
|
26
|
+
# with Minitest::Spec
|
27
|
+
# watch(%r{^spec/(.*)_spec\.rb$})
|
28
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
29
|
+
# watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
30
|
+
|
31
|
+
# Rails 4
|
32
|
+
# watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
33
|
+
# watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
|
34
|
+
# watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
|
35
|
+
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
|
36
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
|
37
|
+
# watch(%r{^test/.+_test\.rb$})
|
38
|
+
# watch(%r{^test/test_helper\.rb$}) { 'test' }
|
39
|
+
|
40
|
+
# Rails < 4
|
41
|
+
# watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
|
42
|
+
# watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" }
|
43
|
+
# watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
|
44
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 schadenfred
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Handsomefencer::Environment
|
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/handsomefencer/environment`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'handsomefencer-environment'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install handsomefencer-environment
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
I like to keep environment variables out of source control. But I also like deploying from circleci, which means I have to get those variables from my local machine into circleci. That can kind of be a pain. With this gem you can .gitignore all your environment files, push to source control, and then when circleci pulls your code to run it for a deploy, all you need is to set one variable equal to whatever password you used to obfuscate your environment files. In a rails 5.2 app, you can use config/master.key.
|
25
|
+
|
26
|
+
From the root of your
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
After checking out the repo, run `bundle` to install dependencies. Then, run `guard` to run the tests.
|
31
|
+
|
32
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/schadenfred/handsomefencer-environment. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
|
+
|
42
|
+
## Code of Conduct
|
43
|
+
|
44
|
+
Everyone interacting in the Handsomefencer::Environment project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/schadenfred/handsomefencer-environment/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "handsomefencer/environment"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/config/deploy.key
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
QZMpG8XZKSQHHBGJFMO2iQ==
|
data/config/master.key
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
railsmasterkeyfrommasterkeyfile
|
@@ -0,0 +1,45 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "handsomefencer/environment/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "handsomefencer-environment"
|
8
|
+
spec.version = Handsomefencer::Environment::VERSION
|
9
|
+
spec.authors = ["schadenfred"]
|
10
|
+
spec.email = ["fred.schoeneman@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Obfuscate and expose environment files}
|
13
|
+
spec.description = %q{Obfuscate your environemnt files in development, push to source control, then expose them on the server}
|
14
|
+
spec.homepage = "https://github.com/schadenfred/handsomefencer-environment"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
# Specify which files should be added to the gem when it is released.
|
27
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
28
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
29
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
30
|
+
end
|
31
|
+
spec.bindir = "exe"
|
32
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
|
35
|
+
spec.add_development_dependency "bundler"
|
36
|
+
spec.add_development_dependency "rake"#, "12.3.1"
|
37
|
+
spec.add_development_dependency "minitest" #, "~> 5.0"
|
38
|
+
spec.add_development_dependency "minitest-given" #, "3.8.0"
|
39
|
+
spec.add_development_dependency "guard" #, "2.14.2"
|
40
|
+
|
41
|
+
spec.add_development_dependency "guard-minitest" #, "2.4.6"
|
42
|
+
spec.add_development_dependency "rb-readline" #, "0.5.5"
|
43
|
+
spec.add_development_dependency "fakefs" #, "0.5.5"
|
44
|
+
spec.add_development_dependency "byebug" #, "10.0.2"
|
45
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'openssl'
|
2
|
+
require 'base64'
|
3
|
+
|
4
|
+
class Handsomefencer::Environment::Crypto
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@cipher = OpenSSL::Cipher::AES.new(128, :CBC)
|
8
|
+
@cipher.encrypt
|
9
|
+
|
10
|
+
@key = (get_deploy_key ||= @cipher.random_key)
|
11
|
+
end
|
12
|
+
|
13
|
+
def encrypt(file)
|
14
|
+
data = File.read(file)
|
15
|
+
encrypted = @cipher.update(data) + @cipher.final
|
16
|
+
@cipher.reset
|
17
|
+
write_to_file(Base64.encode64(encrypted), file + '.enc')
|
18
|
+
end
|
19
|
+
|
20
|
+
def decrypt(file)
|
21
|
+
encrypted = Base64.decode64(File.read(file))
|
22
|
+
@cipher = OpenSSL::Cipher::AES.new(128, :CBC)
|
23
|
+
@cipher.decrypt
|
24
|
+
@cipher.key = @key
|
25
|
+
|
26
|
+
decrypted = @cipher.update(encrypted) + @cipher.final
|
27
|
+
decrypted_file = file.split('.enc').first
|
28
|
+
File.delete decrypted_file if File.exist? decrypted_file
|
29
|
+
write_to_file(decrypted, decrypted_file)
|
30
|
+
@cipher.reset
|
31
|
+
end
|
32
|
+
|
33
|
+
def generate_deploy_key
|
34
|
+
file = 'config/deploy.key'
|
35
|
+
File.delete file if File.exist? file
|
36
|
+
key = Base64.encode64(@cipher.random_key)
|
37
|
+
write_to_file(key, file)
|
38
|
+
if File.exist? '.gitignore'
|
39
|
+
open('.gitignore', 'a') do |f|
|
40
|
+
f << "\/config\/deploy.key"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def write_to_file(data, filename)
|
46
|
+
open filename, "w" do |io|
|
47
|
+
io.write data
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def get_deploy_key
|
52
|
+
encoded = ENV['DEPLOY_KEY'] || File.read('config/deploy.key')
|
53
|
+
Base64.decode64(encoded)
|
54
|
+
end
|
55
|
+
|
56
|
+
def source_files(directory=nil, extension=nil)
|
57
|
+
default = Dir.glob(".env/**/*#{extension}")
|
58
|
+
directory.nil? ? default : Dir.glob(directory + "/**/*#{extension}")
|
59
|
+
end
|
60
|
+
|
61
|
+
def obfuscate(directory=nil, extension=nil)
|
62
|
+
extension = extension || '.env'
|
63
|
+
directory = directory || '.env'
|
64
|
+
files = source_files(directory, extension)
|
65
|
+
|
66
|
+
files.each do |file|
|
67
|
+
encrypt(file)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def expose(directory=nil, extension=nil)
|
72
|
+
extension = extension || '.env.enc'
|
73
|
+
directory = directory || '.env'
|
74
|
+
files = source_files(directory, extension)
|
75
|
+
files.each do |file|
|
76
|
+
decrypt(file)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/rake_gem.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative '../../open_ssl_encryptor'
|
2
|
+
|
3
|
+
namespace :credentials do
|
4
|
+
|
5
|
+
desc "Obfuscates any file ending with .env in the .env/ directory"
|
6
|
+
task obfuscate: :environment do
|
7
|
+
Crypto.obfuscate
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Exposes any file ending with .enc in the .env/ directory"
|
11
|
+
task expose: :environment do
|
12
|
+
Crypto.expose
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: handsomefencer-environment
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- schadenfred
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-08-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-given
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard
|
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'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-minitest
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rb-readline
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: fakefs
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: byebug
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Obfuscate your environemnt files in development, push to source control,
|
140
|
+
then expose them on the server
|
141
|
+
email:
|
142
|
+
- fred.schoeneman@gmail.com
|
143
|
+
executables: []
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".env/backup.env"
|
148
|
+
- ".env/backup.env.enc"
|
149
|
+
- ".env/circle.env"
|
150
|
+
- ".env/circle.env.enc"
|
151
|
+
- ".env/development/backup.env"
|
152
|
+
- ".env/development/backup.env.enc"
|
153
|
+
- ".gitignore"
|
154
|
+
- ".ruby-gemset"
|
155
|
+
- ".ruby-version"
|
156
|
+
- CODE_OF_CONDUCT.md
|
157
|
+
- Gemfile
|
158
|
+
- Gemfile.lock
|
159
|
+
- Guardfile
|
160
|
+
- LICENSE.txt
|
161
|
+
- README.md
|
162
|
+
- Rakefile
|
163
|
+
- bin/console
|
164
|
+
- bin/setup
|
165
|
+
- config/deploy.key
|
166
|
+
- config/master.key
|
167
|
+
- handsomefencer-environment.gemspec
|
168
|
+
- lib/handsomefencer/environment.rb
|
169
|
+
- lib/handsomefencer/environment/crypto.rb
|
170
|
+
- lib/handsomefencer/environment/version.rb
|
171
|
+
- lib/rake_gem.rb
|
172
|
+
- lib/rake_gem/railtie.rb
|
173
|
+
- lib/tasks/environment/expose.rake
|
174
|
+
- lib/tasks/environment/obfuscate.rake
|
175
|
+
- sourcefiles/circle.env
|
176
|
+
homepage: https://github.com/schadenfred/handsomefencer-environment
|
177
|
+
licenses:
|
178
|
+
- MIT
|
179
|
+
metadata:
|
180
|
+
allowed_push_host: https://rubygems.org
|
181
|
+
post_install_message:
|
182
|
+
rdoc_options: []
|
183
|
+
require_paths:
|
184
|
+
- lib
|
185
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
requirements: []
|
196
|
+
rubyforge_project:
|
197
|
+
rubygems_version: 2.7.7
|
198
|
+
signing_key:
|
199
|
+
specification_version: 4
|
200
|
+
summary: Obfuscate and expose environment files
|
201
|
+
test_files: []
|