roro 0.3.6 → 0.3.7
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 +4 -4
- data/.gitignore +13 -3
- data/Guardfile +0 -10
- data/lib/roro.rb +0 -1
- data/lib/roro/cli.rb +1 -1
- data/lib/roro/cli/expose.rb +1 -1
- data/lib/roro/cli/generate/generate_keys.rb +63 -79
- data/lib/roro/cli/greenfield.rb +1 -0
- data/lib/roro/cli/obfuscate.rb +3 -4
- data/lib/roro/version.rb +1 -1
- data/sandbox/.keep +0 -0
- data/tmp/.gitkeep +0 -0
- data/vendor/cache/concurrent-ruby-1.1.7.gem +0 -0
- metadata +5 -4
- data/lib/roro/cli/generate_keys.rb +0 -79
- data/vendor/cache/concurrent-ruby-1.1.6.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ec8ef8f72b6fd4ff28b8d74e1a6b85a7dc17d62af0b4e8c9f78948c51533dd4
|
4
|
+
data.tar.gz: 8583287621045a0cf864d82728480ce4a80fd814bbe99112948f13327c10ce0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 444be7de23db2d83ac72cc0520386c05b4b029667469d96d17cafc39c27fae94bf26168fae05b13fc8c8d64b1160b7f1201d62b1acabede65e667d312e2f6e09
|
7
|
+
data.tar.gz: 9f05dcdf81371ef94275b5b262380d5ad360edcc745e61fe7b8ec99d913b7c4d69374ddeb0770362dd5133fe35abfab813f9817688cd730d3659e813bd5cf4c3
|
data/.gitignore
CHANGED
@@ -5,10 +5,20 @@
|
|
5
5
|
/doc/
|
6
6
|
/pkg/
|
7
7
|
/spec/reports/
|
8
|
-
tmp/*
|
9
8
|
Gemfile.lock
|
10
9
|
.byebug_history
|
11
|
-
/sandbox/**/*
|
12
10
|
|
13
11
|
roro/**/*.env
|
14
|
-
roro/**/*.key
|
12
|
+
roro/**/*.key
|
13
|
+
|
14
|
+
*.key
|
15
|
+
*.env
|
16
|
+
|
17
|
+
tmp/*
|
18
|
+
tmp/*
|
19
|
+
!tmp/.gitkeep
|
20
|
+
sandbox/*
|
21
|
+
!sandbox/.keep
|
22
|
+
!sandbox/greenfield
|
23
|
+
sandbox/greenfield/*
|
24
|
+
!sandbox/greenfield/.keep
|
data/Guardfile
CHANGED
@@ -12,16 +12,6 @@ guard :minitest, options do
|
|
12
12
|
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
13
13
|
watch(%r{^test/(.*)\/?(.*)_test\.rb$})
|
14
14
|
watch(%r{^lib/roro/cli/(.+)\.rb$}) { |m| "test/cli/#{m[1]}_test.rb" }
|
15
|
-
watch(%r{^lib/roro/cli/rollon/*.rb$}) { 'test/generators' }
|
16
|
-
watch(%r{^lib/roro/cli/roro_configurator.yml$}) { 'test/cli/configuration_test.rb' }
|
17
|
-
# watch(%r{^lib/roro/cli/(.+).rb$}) { 'test' }
|
18
|
-
# watch(%r{^lib/roro/cli/templates/roro(.+).rb$}) do
|
19
|
-
# 'test/generators/rollon/rollon_as_roro_test.rb'
|
20
|
-
# end
|
21
|
-
|
22
|
-
|
23
15
|
watch(%r{^test/thor_helper\.rb$}) { 'test' }
|
24
|
-
|
25
16
|
watch(%r{^test/fixtures/files/(.*/)?([^/]+)\.yml$}) { 'test' }
|
26
|
-
|
27
17
|
end
|
data/lib/roro.rb
CHANGED
data/lib/roro/cli.rb
CHANGED
@@ -2,12 +2,12 @@ require 'thor'
|
|
2
2
|
require 'roro/cli/base/base'
|
3
3
|
require 'roro/cli/rollon'
|
4
4
|
require 'roro/cli/greenfield'
|
5
|
-
require 'roro/cli/generate_keys'
|
6
5
|
require 'roro/cli/obfuscate'
|
7
6
|
require 'roro/cli/expose'
|
8
7
|
require 'roro/cli/ruby_gem'
|
9
8
|
require 'roro/cli/generate/config/rails'
|
10
9
|
require 'roro/cli/generate/config'
|
10
|
+
require 'roro/cli/generate/generate_keys'
|
11
11
|
require 'roro/cli/configuration'
|
12
12
|
|
13
13
|
module Roro
|
data/lib/roro/cli/expose.rb
CHANGED
@@ -1,79 +1,63 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
#
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
# #
|
65
|
-
# # method_option :environment, type: :string, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "development, staging"
|
66
|
-
# #
|
67
|
-
|
68
|
-
# # def generate_keys
|
69
|
-
# # default_environments = %w[circleci development production]
|
70
|
-
# # environments = args.first ? [args.first] : default_environments
|
71
|
-
# # environments.each do |environment|
|
72
|
-
# # @cipher = OpenSSL::Cipher.new 'AES-128-CBC'
|
73
|
-
# # @salt = '8 octets'
|
74
|
-
# # @new_key = @cipher.random_key
|
75
|
-
# #
|
76
|
-
# # create_file "docker/keys/#{environment}.key", Base64.encode64(@new_key)
|
77
|
-
# # end
|
78
|
-
# # end
|
79
|
-
# end
|
1
|
+
require 'openssl'
|
2
|
+
require 'base64'
|
3
|
+
require 'handsome_fencer/crypto'
|
4
|
+
|
5
|
+
module Roro
|
6
|
+
|
7
|
+
class CLI < Thor
|
8
|
+
|
9
|
+
include Thor::Actions
|
10
|
+
include HandsomeFencer::Crypto
|
11
|
+
|
12
|
+
desc "generate_keys", "Generates keys for all environments. If you have .env files like './**/production.env' and './**/staging.env' this command assumes you need keys for the production and staging environments, and will generate them for you."
|
13
|
+
|
14
|
+
def generate_keys
|
15
|
+
generate_key
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "generate_key", "Generate a key for each environment"
|
19
|
+
method_option :environment, type: :hash, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "development, staging"
|
20
|
+
|
21
|
+
def generate_key(*args)
|
22
|
+
environments = args.first ? [args.first] : gather_environments
|
23
|
+
environments.each do |environment|
|
24
|
+
|
25
|
+
confirm_files_decrypted?(environment)
|
26
|
+
create_file "roro/keys/#{environment}.key", encoded_key
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
no_commands do
|
31
|
+
|
32
|
+
def encoded_key
|
33
|
+
@cipher = OpenSSL::Cipher.new 'AES-128-CBC'
|
34
|
+
@salt = '8 octets'
|
35
|
+
@new_key = @cipher.random_key
|
36
|
+
Base64.encode64(@new_key)
|
37
|
+
end
|
38
|
+
|
39
|
+
def gather_environments
|
40
|
+
environments = []
|
41
|
+
['.env', '.env.enc'].each do |extension|
|
42
|
+
HandsomeFencer::Crypto.source_files('roro', extension).each do |env_file|
|
43
|
+
environments << env_file.split('/').last.split(extension).last
|
44
|
+
end
|
45
|
+
end
|
46
|
+
environments.uniq
|
47
|
+
end
|
48
|
+
|
49
|
+
def confirm_files_decrypted?(environment)
|
50
|
+
orphan_encrypted = []
|
51
|
+
HandsomeFencer::Crypto.source_files('.', '.env.enc').each do |file|
|
52
|
+
unless File.exist? file.split('.enc').first
|
53
|
+
orphan_encrypted << file
|
54
|
+
end
|
55
|
+
end
|
56
|
+
if !orphan_encrypted.empty?
|
57
|
+
raise Roro::Error.new("You have an encrypted files (.env.enc) #{orphan_encrypted} that do not have corresponding decrypted files (.env). Please decrypt or remove these encrypted files before generating a new key for #{environment}.")
|
58
|
+
end
|
59
|
+
true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/roro/cli/greenfield.rb
CHANGED
data/lib/roro/cli/obfuscate.rb
CHANGED
@@ -7,13 +7,12 @@ module Roro
|
|
7
7
|
include Thor::Actions
|
8
8
|
include HandsomeFencer::Crypto
|
9
9
|
|
10
|
-
desc "obfuscate", "obfuscates any files matching the pattern ./
|
10
|
+
desc "obfuscate", "obfuscates any files matching the pattern ./roro/**/*.env"
|
11
11
|
|
12
12
|
def obfuscate(*args)
|
13
|
-
|
14
|
-
environments = args.first ? [args.first] : default_environments
|
13
|
+
environments = args.first ? [args.first] : gather_environments
|
15
14
|
environments.each do |environment|
|
16
|
-
HandsomeFencer::Crypto.obfuscate(environment, '
|
15
|
+
HandsomeFencer::Crypto.obfuscate(environment, 'roro')
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
data/lib/roro/version.rb
CHANGED
data/sandbox/.keep
ADDED
File without changes
|
data/tmp/.gitkeep
ADDED
File without changes
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- schadenfred
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -173,7 +173,6 @@ files:
|
|
173
173
|
- lib/roro/cli/generate/config/rails.rb
|
174
174
|
- lib/roro/cli/generate/generate.rb
|
175
175
|
- lib/roro/cli/generate/generate_keys.rb
|
176
|
-
- lib/roro/cli/generate_keys.rb
|
177
176
|
- lib/roro/cli/greenfield.rb
|
178
177
|
- lib/roro/cli/obfuscate.rb
|
179
178
|
- lib/roro/cli/rollon.rb
|
@@ -237,6 +236,8 @@ files:
|
|
237
236
|
- lib/roro/version.rb
|
238
237
|
- lib/tasks/deploy.rake
|
239
238
|
- roro.gemspec
|
239
|
+
- sandbox/.keep
|
240
|
+
- tmp/.gitkeep
|
240
241
|
- vendor/bundle/.keep
|
241
242
|
- vendor/cache/actionpack-6.0.3.2.gem
|
242
243
|
- vendor/cache/actionview-6.0.3.2.gem
|
@@ -245,7 +246,7 @@ files:
|
|
245
246
|
- vendor/cache/builder-3.2.4.gem
|
246
247
|
- vendor/cache/byebug-11.1.3.gem
|
247
248
|
- vendor/cache/coderay-1.1.3.gem
|
248
|
-
- vendor/cache/concurrent-ruby-1.1.
|
249
|
+
- vendor/cache/concurrent-ruby-1.1.7.gem
|
249
250
|
- vendor/cache/crass-1.0.6.gem
|
250
251
|
- vendor/cache/em-websocket-0.5.1.gem
|
251
252
|
- vendor/cache/erubi-1.9.0.gem
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'openssl'
|
2
|
-
require 'base64'
|
3
|
-
require 'handsome_fencer/crypto'
|
4
|
-
|
5
|
-
module Roro
|
6
|
-
|
7
|
-
class CLI < Thor
|
8
|
-
|
9
|
-
include Thor::Actions
|
10
|
-
include HandsomeFencer::Crypto
|
11
|
-
|
12
|
-
desc "generate_keys", "Generates keys for all environments. If you have .env files like './**/production.env' and './**/staging.env' this command assumes you need keys for the production and staging environments, and will generate them for you."
|
13
|
-
|
14
|
-
def generate_keys
|
15
|
-
generate_key
|
16
|
-
end
|
17
|
-
|
18
|
-
desc "generate_key", "Generate a key for each environment"
|
19
|
-
method_option :environment, type: :hash, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "development, staging"
|
20
|
-
|
21
|
-
def generate_key(*args)
|
22
|
-
environments = args.first ? [args.first] : gather_environments
|
23
|
-
environments.each do |environment|
|
24
|
-
confirm_files_decrypted?(environment)
|
25
|
-
create_file "docker/keys/#{environment}.key", encoded_key
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
no_commands do
|
30
|
-
|
31
|
-
def encoded_key
|
32
|
-
@cipher = OpenSSL::Cipher.new 'AES-128-CBC'
|
33
|
-
@salt = '8 octets'
|
34
|
-
@new_key = @cipher.random_key
|
35
|
-
Base64.encode64(@new_key)
|
36
|
-
end
|
37
|
-
|
38
|
-
def gather_environments
|
39
|
-
environments = []
|
40
|
-
['.env', '.env.enc'].each do |extension|
|
41
|
-
|
42
|
-
HandsomeFencer::Crypto.source_files('.', extension).each do |env_file|
|
43
|
-
environments << env_file.split('/').last.split(extension).last
|
44
|
-
end
|
45
|
-
end
|
46
|
-
environments.uniq
|
47
|
-
end
|
48
|
-
|
49
|
-
def confirm_files_decrypted?(environment)
|
50
|
-
orphan_encrypted = []
|
51
|
-
HandsomeFencer::Crypto.source_files('.', '.env.enc').each do |file|
|
52
|
-
orphan_encrypted << file unless File.exist? file.split('.enc').first
|
53
|
-
end
|
54
|
-
|
55
|
-
if !orphan_encrypted.empty?
|
56
|
-
raise Roro::Error.new("You have an encrypted files (.env.enc) #{orphan_encrypted} that do not have corresponding decrypted files (.env). Please decrypt or remove these encrypted files before generating a new key for #{environment}.")
|
57
|
-
end
|
58
|
-
true
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# desc "generate keys", "Generate keys on a per-environment basis"
|
64
|
-
#
|
65
|
-
# method_option :environment, type: :string, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "development, staging"
|
66
|
-
#
|
67
|
-
|
68
|
-
# def generate_keys
|
69
|
-
# default_environments = %w[circleci development production]
|
70
|
-
# environments = args.first ? [args.first] : default_environments
|
71
|
-
# environments.each do |environment|
|
72
|
-
# @cipher = OpenSSL::Cipher.new 'AES-128-CBC'
|
73
|
-
# @salt = '8 octets'
|
74
|
-
# @new_key = @cipher.random_key
|
75
|
-
#
|
76
|
-
# create_file "docker/keys/#{environment}.key", Base64.encode64(@new_key)
|
77
|
-
# end
|
78
|
-
# end
|
79
|
-
end
|
Binary file
|