ruby-sfn-local 0.1.7 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d655dc8f501ace970ed5a36bfe03ce609b520c0e5395a15e5ea9e39802da0a7
4
- data.tar.gz: 876bb0c3e239c9f23935ab2220f3790dafb58d46c50893f5b90c492cd1a5a732
3
+ metadata.gz: 84a623fc6db39626f2c4562e6f6613827428629409425c18864ceca3f88c954d
4
+ data.tar.gz: 9077be558acade75591926166e04e2428f9225c11dd897206124697b9a4e6c4e
5
5
  SHA512:
6
- metadata.gz: f7ac6a2a6e99d56fc0dff450504480bf3cc401176e6b09ce9bd00073214bf1d2dde2a33fc239e18adb702e415805113b6bfc78a1838d8afc9c125fbf7548a47e
7
- data.tar.gz: d8d38c722b72679eb0cb85e8930f1c3dc773a2803881254db173865d09e0df62b840cd03679ff1b86eb93c502e99ac34e6996838a2956770d4f6d369f4b9f0e0
6
+ metadata.gz: c61caf572c5957664eaed371552f438780bf6354962a1aff13aa1355acd06e73ebbfbeeb171dbe63f208934d493d36e4a4be8736c7b07bea2cf611759c2d3ced
7
+ data.tar.gz: edb7519af4ee46230ed1e578358fe97f4430dd07491cd05897549de628f9aab43a5b8ebef95521aae1c68e2f7f293913b408908057e100687a777bc75a555302
@@ -4,6 +4,7 @@ require 'sfn/mock_macros/lambda'
4
4
  require 'sfn/mock_macros/step_function'
5
5
  require 'sfn/mock_macros/api_gateway'
6
6
  require 'sfn/mock_macros/sns'
7
+ require 'sfn/mock_macros/sqs'
7
8
 
8
9
  module Sfn
9
10
  module MockMacros
@@ -11,6 +12,7 @@ module Sfn
11
12
  include StepFunction
12
13
  include ApiGateway
13
14
  include Sns
15
+ include Sqs
14
16
 
15
17
  def self.gateway_response(data)
16
18
  ApiGateway.response(data)
@@ -24,6 +26,10 @@ module Sfn
24
26
  Sns.response(data)
25
27
  end
26
28
 
29
+ def self.sqs_response(data)
30
+ Sqs.response(data)
31
+ end
32
+
27
33
  def self.step_function_response(data)
28
34
  StepFunction.response(data)
29
35
  end
@@ -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.7
4
+ version: 0.1.10
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-05 00:00:00.000000000 Z
11
+ date: 2022-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-release