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.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/bin/elasticDynamoDb +11 -10
  3. data/lib/configparser.rb +14 -16
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODA2ZWE5YzZlNjRjOTNlZmExODI4MmQyYmZiMzMxMDQwYzk0MGY2Mw==
4
+ YjllZWNkZGRiMDA3MmVmM2VkNzg2ZGU2YmY2NDJmODEyOTM1OGRlZg==
5
5
  data.tar.gz: !binary |-
6
- YzZkOGFiN2Q2YmU3ZmIzYTk4NTNlNmRjNTBjNWRiZTQ4YzU2OTg0MA==
6
+ MTBhYWM0ZTg1ZGQ4NzdjODhmYmNjNDMxOWUxNzVkNWU4MDEzYWRiMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjBjODExNDk4M2VhZjRiMWY3NGU3NWFkMjRkZGMyNTMzZWNiOGQ3OTk4NmIw
10
- MWU5M2ZjMWEyY2VjYTQ1Y2YxYmM5MmVjYWUxZTk0ZDMyMmI1MDk1ODE2Yzc4
11
- MTY3NTdmOTkxZmNkNDRiZTdhMDRhZDRlZTg5MzVhNDg2MTRiNmM=
9
+ YWVlN2E3MWRkZTlkNmQ2MDM1N2ZhMDg3NTAwMjQ4YWNiZjJiOThjNTNlMmFi
10
+ ZTgzZmI1OGEyZDM5MzcwOGVhYmVlNDA1ZTcwOWNjMGUyZGZkYmU0ZDU0MDk5
11
+ YmU1MmMwNGE0ZDIxNjgyMDc5OGQ2YmFlMDdlMWMzNWVmM2Y3NmY=
12
12
  data.tar.gz: !binary |-
13
- Njc3YTUzYjIzNWNlYjBmMGU5NmYyMzI4ZWQzNjI4MmRlM2U4YjBmMWMxNTgw
14
- ODc4OTU5MGNkZWZiN2NjODBmMDNkNWYyN2YwZTM3Y2IzMTdmMGZmYzhmMmEy
15
- N2MzMDRiZjk3NjBjMWEyNDM4NTVjMTBkODQ1MTg4ZmEwYzlmZjk=
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
- str_to_write += "[#{section}]\n"
133
+ if !section.include?('pre_section')
134
+ str_to_write += "[#{section}]\n"
135
+ end
136
+
134
137
  lines.each do |line, value|
135
- if line =~ /^(#|;|\n)/
136
- str_to_write += "#{line}\n"
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
- if config_section.include?('index')
201
- config_section =~ /^gsi: \^(.*)\$\stable: \^(.*)\$$/
202
- index = $1
203
- table = $2
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
- section = nil
14
- key = nil
13
+ config_section = nil
15
14
 
16
- input_source.inject(config) {|acc, line|
17
- acc ||= {}
18
-
19
- if line =~ /^\[(.+?)\]/ # if line contain section start adding it to a new hash key
20
- section = $1
21
- acc[section] ||= {}
22
- elsif line =~ /^(#|;|\n)/
23
- acc[section]["#{line}"] = line
24
- elsif line =~ /^\s*(.+?)\s*[=:]\s*(.+)$/ # this returns a 2 parts $1 first response, $2 2nd response
25
- key = $1
26
- value = $2
27
- acc[section] ||= {}
28
- acc[section][key] = value
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.1.3
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 dynamodb by factor with dynamic-dynamodb
67
+ description: Elastically scale up or down with dynamic-dynamodb tool
68
68
  email: ami.mahloof@gmail.com
69
69
  executables:
70
70
  - elasticDynamoDb