belt 0.2.2 → 0.2.4
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/lib/belt/cli/tables_command.rb +7 -22
- data/lib/belt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b99fa5db1ad085eaffe7967b3ebd767780190dfdab73f4715d12d57351b556c4
|
|
4
|
+
data.tar.gz: 1dd0a58fe2d7190214a3c88d936d0f868cba27264e469e9450e59a948fbef130
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7d9c381fc41b28b4302c17ce25f13bc09adaecfa9f593d1de03437ae0104bdca03b510dcd99578a0a7aa4f931e19e33b6b7426e3145582b25aad2ea3ead6c42c
|
|
7
|
+
data.tar.gz: 9d78f571938ce9236c3103decacb5078e10c9023c29000d0a817d5ac9c5f9cb07312eff1e54323a4cc96db66f13111cb51a87779a1fb4dc99dc656faa3bd2f5e
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative 'app_detection'
|
|
4
3
|
require_relative 'env_resolver'
|
|
5
4
|
require_relative 'terraform_command'
|
|
6
5
|
require_relative '../inflector'
|
|
@@ -11,23 +10,12 @@ module Belt
|
|
|
11
10
|
SCHEMA_FILE_CANDIDATES = ['config/schema.tf.rb', 'infrastructure/schema.tf.rb'].freeze
|
|
12
11
|
MODULE_DIR = 'infrastructure/modules/app'
|
|
13
12
|
|
|
14
|
-
include AppDetection
|
|
15
|
-
|
|
16
13
|
def self.run(args)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
puts 'Usage: belt setup tables [environment]'
|
|
21
|
-
puts "\nReads schema.tf.rb and generates dynamodb.tf in the app module."
|
|
22
|
-
puts 'You can also set BELT_ENV to skip the environment argument.'
|
|
23
|
-
puts "\nExamples:"
|
|
24
|
-
puts ' belt setup tables'
|
|
25
|
-
puts ' belt setup tables dev'
|
|
26
|
-
puts ' BELT_ENV=dev belt setup tables'
|
|
27
|
-
exit 1
|
|
28
|
-
end
|
|
14
|
+
# Environment argument accepted for backwards compatibility but unused —
|
|
15
|
+
# dynamodb.tf lives in infrastructure/modules/app and uses var.environment.
|
|
16
|
+
EnvResolver.resolve(args)
|
|
29
17
|
|
|
30
|
-
new
|
|
18
|
+
new.run
|
|
31
19
|
end
|
|
32
20
|
|
|
33
21
|
# Automatically sync dynamodb.tf in the app module.
|
|
@@ -35,18 +23,15 @@ module Belt
|
|
|
35
23
|
def self.sync_all_environments
|
|
36
24
|
return unless schema_file_path
|
|
37
25
|
|
|
38
|
-
|
|
39
|
-
new(nil, quiet: true).run
|
|
26
|
+
new(quiet: true).run
|
|
40
27
|
end
|
|
41
28
|
|
|
42
29
|
def self.schema_file_path
|
|
43
30
|
SCHEMA_FILE_CANDIDATES.find { |f| File.exist?(f) }
|
|
44
31
|
end
|
|
45
32
|
|
|
46
|
-
def initialize(
|
|
47
|
-
@env = env
|
|
33
|
+
def initialize(quiet: false)
|
|
48
34
|
@quiet = quiet
|
|
49
|
-
@app_name = detect_app_name
|
|
50
35
|
end
|
|
51
36
|
|
|
52
37
|
def run
|
|
@@ -163,7 +148,7 @@ module Belt
|
|
|
163
148
|
end
|
|
164
149
|
|
|
165
150
|
def table_name(model_name)
|
|
166
|
-
"
|
|
151
|
+
"${var.app_name}-${var.environment}-#{Belt::Inflector.pluralize(model_name)}"
|
|
167
152
|
end
|
|
168
153
|
|
|
169
154
|
# Minimal DSL parser for schema.tf.rb
|
data/lib/belt/version.rb
CHANGED