rails_workflow 0.3.6 → 0.3.7

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
  SHA1:
3
- metadata.gz: 1db95d376f20257075301d6e95a199429e78e490
4
- data.tar.gz: 3de2e6d705dfa30474db9243d5fdb0dfe50fe348
3
+ metadata.gz: b41bc702bc674c7fa88cdcdb39bd064e533b0cc6
4
+ data.tar.gz: 56d8af3b39954d865dc9b81887e2986ab1fa5b21
5
5
  SHA512:
6
- metadata.gz: 7c1a4e7d29cdaeadc54e5e28305a4695bd706e9339be5e1936b76be476e72014f3aeaf55e2af6d2a1d22b635e5fa7d76e8a8c307e41763a0137cccd8795ec045
7
- data.tar.gz: ca6af36d8cbba7d49e03bf0f8fd69c0c3705834f336133cb476c77edbbec63880459ac2db47d03c29f8fe9580b0a5ce7e289d83219c6319a3fd5ac9d9728e2c3
6
+ metadata.gz: d4a55a663022085116a3ac44e0049a0218f348f85270568af78397701c2dd89fa501afa70b15c05fd39709cd852cbcd3c75279776780f83205de7a5a8b49592a
7
+ data.tar.gz: ae738a6d4a327a4a7107d30229ce2dc1c8fb2c55355061252017052487394904a9e5f3c495ebce44e77c91ebc52e449c0373ec7fc03865dfc5cb364a16ff26dd
@@ -0,0 +1,12 @@
1
+ module RailsWorkflow
2
+ class DefaultImporterPreprocessor
3
+ def prepare json
4
+ if json['operations']
5
+ json['process_template']['operations'] = json['operations']
6
+ json['process_template'].delete('operation_ids')
7
+ end
8
+
9
+ json
10
+ end
11
+ end
12
+ end
@@ -1,7 +1,8 @@
1
1
  module RailsWorkflow
2
2
  class ProcessImporter
3
3
  def initialize json
4
- @json = json['process_template']
4
+ prepared_json = RailsWorkflow.config.import_preprocessor.prepare(json)
5
+ @json = prepared_json['process_template']
5
6
  end
6
7
 
7
8
  def process
@@ -38,7 +38,7 @@ module RailsWorkflow
38
38
  class: "RailsWorkflow::UserByGroupOperation"
39
39
  }
40
40
  }
41
-
41
+ @default_import_preprocessor = "RailsWorkflow::DefaultImporterPreprocessor"
42
42
  @default_operation_template_type = "RailsWorkflow::OperationTemplate"
43
43
  @default_process_manager = "RailsWorkflow::ProcessManager"
44
44
  @default_process_class = "RailsWorkflow::Process"
@@ -76,6 +76,15 @@ module RailsWorkflow
76
76
  @operation_template_type = value
77
77
  end
78
78
 
79
+ def import_preprocessor=(value)
80
+ @import_preprocessor = value
81
+ end
82
+
83
+ def import_preprocessor
84
+ processor = @import_preprocessor || @default_import_preprocessor
85
+ processor.constantize.new
86
+ end
87
+
79
88
  def default_operation_template_type
80
89
  @operation_template_type || @default_operation_template_type
81
90
  end
@@ -1,3 +1,3 @@
1
1
  module RailsWorkflow
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Madzhuga
@@ -14,6 +14,9 @@ dependencies:
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.1'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 4.1.0
@@ -21,6 +24,9 @@ dependencies:
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '4.1'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 4.1.0
@@ -244,6 +250,7 @@ files:
244
250
  - app/models/rails_workflow/user_by_role_operation.rb
245
251
  - app/serializers/rails_workflow/operation_template_serializer.rb
246
252
  - app/serializers/rails_workflow/process_template_serializer.rb
253
+ - app/services/rails_workflow/default_importer_preprocessor.rb
247
254
  - app/services/rails_workflow/process_importer.rb
248
255
  - app/views/application/_context.html.slim
249
256
  - app/views/application/_flash.html.slim