elasticDynamoDb 1.1.3 → 1.2
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 +8 -8
- data/bin/elasticDynamoDb +11 -10
- data/lib/configparser.rb +14 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjllZWNkZGRiMDA3MmVmM2VkNzg2ZGU2YmY2NDJmODEyOTM1OGRlZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTBhYWM0ZTg1ZGQ4NzdjODhmYmNjNDMxOWUxNzVkNWU4MDEzYWRiMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWVlN2E3MWRkZTlkNmQ2MDM1N2ZhMDg3NTAwMjQ4YWNiZjJiOThjNTNlMmFi
|
10
|
+
ZTgzZmI1OGEyZDM5MzcwOGVhYmVlNDA1ZTcwOWNjMGUyZGZkYmU0ZDU0MDk5
|
11
|
+
YmU1MmMwNGE0ZDIxNjgyMDc5OGQ2YmFlMDdlMWMzNWVmM2Y3NmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTU0OWM3YzkzYWM4MDFkMWUxNTY5YTkzM2VlMDBmNzEyMDk2NjJkZDBlOTZi
|
14
|
+
MTY3YzM2ZWE2ZTQxZGMwZjc0MmU5ZWIyZDJkZjQ2YmUwY2NhYjA4NjAyODZk
|
15
|
+
M2E1MmNlMGYwYWU1MjcyNTYzMTc4MDAwMzM0NjNlYTY4Y2U3Y2Y=
|
data/bin/elasticDynamoDb
CHANGED
@@ -130,10 +130,13 @@ private
|
|
130
130
|
|
131
131
|
str_to_write = ''
|
132
132
|
@@config.each do |section, lines|
|
133
|
-
|
133
|
+
if !section.include?('pre_section')
|
134
|
+
str_to_write += "[#{section}]\n"
|
135
|
+
end
|
136
|
+
|
134
137
|
lines.each do |line, value|
|
135
|
-
if
|
136
|
-
str_to_write += "#{
|
138
|
+
if value =~ /^(#|;|\n)/
|
139
|
+
str_to_write += "#{value}"
|
137
140
|
else
|
138
141
|
str_to_write += "#{line}: #{value}\n"
|
139
142
|
end
|
@@ -197,18 +200,16 @@ private
|
|
197
200
|
active_throughputs = @@config.keys.select{|k| k =~ /table/}
|
198
201
|
|
199
202
|
active_throughputs.inject(provisioning) { |acc, config_section|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
203
|
+
config_section =~ /^(gsi:\ *\^(?<index>.*)\$|)\ *table:\ *\^(?<table>.*)\$/
|
204
|
+
index = $1
|
205
|
+
table = $2
|
206
|
+
|
207
|
+
if config_section.include?('gsi')
|
205
208
|
acc[table] ||= {}
|
206
209
|
acc[table][index] ||= {}
|
207
210
|
acc[table][index]['reads'] = @@config[config_section]['min-provisioned-reads'].to_i
|
208
211
|
acc[table][index]['writes'] = @@config[config_section]['min-provisioned-writes'].to_i
|
209
212
|
else
|
210
|
-
config_section =~ /^table:?\S\^(.*)\$/
|
211
|
-
table = $1
|
212
213
|
acc[table] ||= {}
|
213
214
|
acc[table]['reads'] = @@config[config_section]['min-provisioned-reads'].to_i
|
214
215
|
acc[table]['writes'] = @@config[config_section]['min-provisioned-writes'].to_i
|
data/lib/configparser.rb
CHANGED
@@ -10,24 +10,22 @@ class ConfigParser < Hash
|
|
10
10
|
puts "error loading file -> #{e}"
|
11
11
|
end
|
12
12
|
config = {}
|
13
|
-
|
14
|
-
key = nil
|
13
|
+
config_section = nil
|
15
14
|
|
16
|
-
input_source.inject(config) {|acc, line|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
elsif line =~
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
acc[
|
28
|
-
acc[
|
15
|
+
input_source.each_with_index.inject(config) {|acc, (line, index)|
|
16
|
+
if line =~ /^\[(.+?)\]/
|
17
|
+
config_section = $1
|
18
|
+
acc[config_section] ||= {}
|
19
|
+
elsif line =~ /^(#|;|\n)/ && config_section
|
20
|
+
acc[config_section]["comment_#{index}"] = line
|
21
|
+
elsif line =~ /^\s*(.+?)\s*[=:]\s*(.+)$/ && config_section # this returns a 2 parts $1 key, $2 value
|
22
|
+
config_key = $1
|
23
|
+
config_value = $2
|
24
|
+
acc[config_section][config_key] = config_value
|
25
|
+
else
|
26
|
+
acc['pre_section'] ||= {}
|
27
|
+
acc['pre_section']["comment_#{index}"] = line
|
29
28
|
end
|
30
|
-
|
31
29
|
acc
|
32
30
|
}
|
33
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticDynamoDb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ami Mahloof
|
@@ -64,7 +64,7 @@ dependencies:
|
|
64
64
|
- - ! '>='
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: 1.40.0
|
67
|
-
description: scale
|
67
|
+
description: Elastically scale up or down with dynamic-dynamodb tool
|
68
68
|
email: ami.mahloof@gmail.com
|
69
69
|
executables:
|
70
70
|
- elasticDynamoDb
|