ruby-sfn-local 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sfn/state_machine.rb +8 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 031c92b9bd2cca0fe86da9f393fd5c8881dbc04bee6c43b189585bdbbd9aa35a
4
- data.tar.gz: d6e51f7f87a2278c8f7f12781f1d795d3afb324265287744c0d030d53f70efd1
3
+ metadata.gz: c91b50b39f94e77840a25e9179e86fca730a556d7884fcee41997f76e6273ae0
4
+ data.tar.gz: 36465c625f9169533a80018d4a5d3840bff585fcfac216b9ab43d0f8df933211
5
5
  SHA512:
6
- metadata.gz: 0dc87f86c63cd1fe745db17dab08afbd440b76b7d81a6f766b1cfae830acbaf7e475d480aff53a22dd8f015fc73c724951c9ee970ac76c09953970ab7bc768b3
7
- data.tar.gz: a31fbba0e5c16e68fd792f959ca88494f3abde0f9caea5a0ca7a1b38671b7ad9bcacb07d5eeeb580579f6f0d8e4626029f8095a4687214ded011b9692a87658a
6
+ metadata.gz: 3dfe1991cac8fdecccf933a4b83c1bd328875dc6b6fa236098ab0d64f79a5dc8a6adeba45e45987182b57c974957a7d01852d03dce23c284feb4ba9a907d31e5
7
+ data.tar.gz: 3405576ab516b3d7f5f9f59478d8113ec31da189a01a2aa1ee255e0163b349991274e1b00c1310cb69cbd3047fafb8261cd0fed1ed0561653756ae99c24deceb
@@ -9,7 +9,7 @@ module Sfn
9
9
  class StateMachine
10
10
  ROLE = 'arn:aws:iam::123456789012:role/DummyRole'
11
11
 
12
- attr_accessor :name, :definition, :arn, :executions, :execution_arn
12
+ attr_accessor :name, :path, :definition, :arn, :executions, :execution_arn
13
13
 
14
14
  def self.all
15
15
  Collection.instance.all.map { |sf| new(sf['name'], sf['stateMachineArn']) }
@@ -28,8 +28,9 @@ module Sfn
28
28
  end
29
29
 
30
30
  def initialize(name, arn = nil)
31
- self.name = name
32
- self.arn = arn || self.class.find_by_name(name)&.arn || create_state_machine
31
+ self.path = "#{Sfn.configuration.definition_path}/#{name}.json"
32
+ self.name = name.split("/").last
33
+ self.arn = arn || self.class.find_by_name(self.name)&.arn || create_state_machine
33
34
  self.executions = {}
34
35
  end
35
36
 
@@ -53,18 +54,17 @@ module Sfn
53
54
 
54
55
  def create_state_machine
55
56
  self.arn = AwsCli.run('stepfunctions', 'create-state-machine',
56
- { definition: load_definition(name), name: name, 'role-arn': ROLE }, 'stateMachineArn')
57
+ { definition: load_definition, name: name, 'role-arn': ROLE }, 'stateMachineArn')
57
58
  raise Sf::DefinitionError if arn.empty?
58
59
 
59
60
  Collection.instance.add(to_hash)
60
61
  arn
61
62
  end
62
63
 
63
- def load_definition(_name)
64
+ def load_definition
64
65
  local_definition_path = Tempfile.new(['name', '.json']).path
65
- remote_definition_path = "#{Sfn.configuration.definition_path}/#{name}.json"
66
-
67
- definition = File.read(remote_definition_path)
66
+
67
+ definition = File.read(self.path)
68
68
  local_definition = definition.gsub(/"MaxConcurrency": [0-9]+/, '"MaxConcurrency": 1')
69
69
 
70
70
  File.open(local_definition_path, 'w') { |file| file.puts local_definition }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-sfn-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gianni Mazza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-13 00:00:00.000000000 Z
11
+ date: 2022-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-release