ruby-sfn-local 0.1.28 → 0.1.29

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1ded192dbca449ce9c35a0fdac5a33cff11a5d6e7c60bf2780de51e93463896
4
- data.tar.gz: 0d3ccddbbded015d1bae65ca6459f68e19581121063d3d9a93e4c31d5402fbba
3
+ metadata.gz: be57c78578b7ddee065c2bcd524f3a8a76fbee4c8f55010fcb2ed08c9daae437
4
+ data.tar.gz: '072679be3d8981e2831a27ba5e47bb7b8ca588b779e6aab5ba2a38673e72918e'
5
5
  SHA512:
6
- metadata.gz: e18a67928a60e687dbe05e0ee1947feedfa16c4ecad21f45f2c483bd5efbf2391785b010031d16592ba8b2e7043b8f9a41621d99473721cfb0ef23404c0c70a8
7
- data.tar.gz: 60e1b4cfdfb3497e767dfc1a2ac6afdfad190df3c97141c538500085170858a863f10166a63ec451b04f1387b637b4fe9c4dc90195a05abcc48bda1c6a18d701
6
+ metadata.gz: c62f2e9b6c359688ac144d19b2f0816839e95bd3249683f0df2b5abdedea609638c0238e9d90867792340a1ad159fae0397c3b065a38a520ed54f4d958c1e2c7
7
+ data.tar.gz: ae4203012bb56dca90fc2a771e9da7988dc0296995d5db402106da4b70a8230a3bb55078bb230598d45fe0e1b468760fc066da57bc4b78beed0c4f1a4e3968a9
data/lib/hash.rb ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Hash
4
+ def stringify_keys
5
+ h = self.map do |k,v|
6
+ v_str = if v.instance_of? Hash
7
+ v.stringify_keys
8
+ else
9
+ v
10
+ end
11
+
12
+ [k.to_s, v_str]
13
+ end
14
+ Hash[h]
15
+ end
16
+ end
@@ -30,7 +30,7 @@ module Sfn
30
30
  def initialize(name, variables = {}, arn = nil)
31
31
  self.path = "#{Sfn.configuration.definition_path}/#{name}.json"
32
32
  self.name = name.split('/').last
33
- self.variables = variables
33
+ self.variables = (variables || {}).stringify_keys
34
34
  self.arn = arn || self.class.find_by_name(self.name)&.arn || create_state_machine
35
35
  self.executions = {}
36
36
  end
@@ -83,7 +83,7 @@ module Sfn
83
83
  local_definition = local_definition.gsub(/,[\s\n]+\}/, "\n}")
84
84
  local_definition = local_definition.gsub(/(\${[a-z_]+})/) do |variable|
85
85
  key = variable.gsub(/[${}]/, '')
86
- variables[key].to_s || variable
86
+ (self.variables[key] || variable).to_s
87
87
  end
88
88
  File.open(local_definition_path, 'w') { |file| file.puts local_definition }
89
89
  "file://#{local_definition_path}"
data/lib/sfn.rb CHANGED
@@ -11,3 +11,4 @@ require 'sfn/mock_macros'
11
11
  require 'sfn/execution'
12
12
  require 'sfn/execution_log'
13
13
  require 'string'
14
+ require 'hash'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-sfn-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.28
4
+ version: 0.1.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gianni Mazza
@@ -58,6 +58,7 @@ executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
+ - lib/hash.rb
61
62
  - lib/sfn.rb
62
63
  - lib/sfn/aws_cli.rb
63
64
  - lib/sfn/collection.rb