lex-transformer 0.1.1 → 0.1.2

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: bac9f67997f5e3e4203e8049cfa9d2c5ec1f2cb5369a0d7b3fcc150a2f7ae198
4
- data.tar.gz: ea681503c5db97fa1d45ad35c3b9fbb7ba59dada4328841103e57fbb19e650e7
3
+ metadata.gz: 222bfa8365ec6539386ad0616e240f93860551642c9e92e6d211cb5282624eac
4
+ data.tar.gz: 4ad41275a910f97da2189f7464cbeb04c3398bd077a5c818caaaef9327b6a892
5
5
  SHA512:
6
- metadata.gz: 10ff925a03e1d4f9e91996ee45b5cf84d9e37b45bc12ab85932c66d9624fdb5e21f8f4dd484bbbcc136b55f7e509c67144d1deb0a2ecc8f77dadb0e030cd09d6
7
- data.tar.gz: 1535f9e23b315b657935b1ce3da8003eadec6698fc853b146b2f0f7b7631a7d52611e8909d6d3f359fc7df6bcafe972ba18505966facd0d3e38b95f077c74900
6
+ metadata.gz: f18b6bdd8e50637a08762a3182317555e1daab5aa6afab37fb08459bde7804094fdbd70fdcde9e0d5229e2b47d0107818057025baa2bd6add543932c4fb5eeea
7
+ data.tar.gz: afc8938a267ba1d147afa83726f91b7080d0abcf14d2ce90db0e4f573f93b7feb5547b3ab2e519b9945fc2039f296d6ca9990c7d777bf32184283c09b04e3b32
@@ -1,11 +1,17 @@
1
1
  Layout/LineLength:
2
2
  Max: 120
3
3
  Metrics/MethodLength:
4
- Max: 30
4
+ Max: 50
5
5
  Metrics/ClassLength:
6
6
  Max: 1500
7
7
  Metrics/BlockLength:
8
8
  Max: 50
9
+ Metrics/PerceivedComplexity:
10
+ Max: 20
11
+ Metrics/CyclomaticComplexity:
12
+ Max: 15
13
+ Metrics/AbcSize:
14
+ Max: 50
9
15
  Layout/SpaceAroundEqualsInParameterDefault:
10
16
  EnforcedStyle: space
11
17
  Style/SymbolArray:
@@ -17,6 +23,7 @@ Style/Documentation:
17
23
  Enabled: false
18
24
  AllCops:
19
25
  TargetRubyVersion: 2.5
26
+ NewCops: enable
20
27
  Style/FrozenStringLiteralComment:
21
28
  Enabled: false
22
29
  Naming/FileName:
@@ -1,27 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lex-transformer (0.1.0)
4
+ lex-transformer (0.1.2)
5
5
  tilt
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- diff-lcs (1.3)
10
+ diff-lcs (1.4.4)
11
11
  rake (13.0.1)
12
12
  rspec (3.9.0)
13
13
  rspec-core (~> 3.9.0)
14
14
  rspec-expectations (~> 3.9.0)
15
15
  rspec-mocks (~> 3.9.0)
16
- rspec-core (3.9.1)
17
- rspec-support (~> 3.9.1)
18
- rspec-expectations (3.9.0)
16
+ rspec-core (3.9.2)
17
+ rspec-support (~> 3.9.3)
18
+ rspec-expectations (3.9.2)
19
19
  diff-lcs (>= 1.2.0, < 2.0)
20
20
  rspec-support (~> 3.9.0)
21
21
  rspec-mocks (3.9.1)
22
22
  diff-lcs (>= 1.2.0, < 2.0)
23
23
  rspec-support (~> 3.9.0)
24
- rspec-support (3.9.2)
24
+ rspec-support (3.9.3)
25
25
  tilt (2.0.10)
26
26
 
27
27
  PLATFORMS
data/README.md CHANGED
@@ -1,15 +1,13 @@
1
1
  # Legion::Extensions::Transformer
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/legion/extensions/transformer`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Used to transform data to match the action for a relationship
6
4
 
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
11
9
  ```ruby
12
- gem 'legion-extensions-transformer'
10
+ gem 'lex-transformer'
13
11
  ```
14
12
 
15
13
  And then execute:
@@ -18,26 +16,23 @@ And then execute:
18
16
 
19
17
  Or install it yourself as:
20
18
 
21
- $ gem install legion-extensions-transformer
19
+ $ gem install lex-transformer
20
+
21
+ ## Adding to Legion
22
+ You can manually install with a `gem install lex-transformer` command or by adding it into your settings with something like this
23
+ ```json
24
+ {
25
+ "extensions": {
26
+ "transformer": {
27
+ "enabled": true, "workers": 1
28
+ }
29
+ }
30
+ }
31
+ ```
22
32
 
23
33
  ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/legion-extensions-transformer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
+ *to be added*
36
35
 
37
36
  ## License
38
37
 
39
38
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
-
41
- ## Code of Conduct
42
-
43
- Everyone interacting in the Legion::Extensions::Transformer project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/legion-extensions-transformer/blob/master/CODE_OF_CONDUCT.md).
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'Runs transformer statements against tasks in a relationship'
13
13
  spec.homepage = 'https://bitbucket.org/legion-io/lex-transformer'
14
14
  spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
15
16
 
16
17
  if spec.respond_to?(:metadata)
17
18
  spec.metadata['homepage_uri'] = spec.homepage
@@ -17,20 +17,28 @@ module Legion::Extensions::Transformer
17
17
  end
18
18
 
19
19
  payload[:args] = from_json(template.render(self, variables))
20
- if payload[:args].is_a? Hash
20
+ case payload[:args]
21
+ when Hash
21
22
  unless payload[:task_id].nil?
22
23
  task_update(payload[:task_id], 'transformer.succeeded', function_args: payload[:args])
23
24
  end
24
- send_task(payload)
25
- elsif payload[:args].is_a? Array
25
+ send_task(**payload)
26
+ when Array
26
27
  payload[:args].each do |thing|
27
28
  new_payload = payload
28
- task = Legion::Runner::Status.generate_task_id(function_args: thing, status: 'task.queued', args: thing, **new_payload)
29
+ task = Legion::Runner::Status.generate_task_id(function_args: thing,
30
+ status: 'task.queued',
31
+ args: thing,
32
+ **new_payload)
29
33
  new_payload[:task_id] = task[:task_id]
30
34
  new_payload[:args] = thing
31
35
  send_task(**new_payload)
32
36
  end
33
- task_update(payload[:task_id], 'task.multiplied', function_args: payload[:args]) unless payload[:task_id].nil?
37
+ unless payload[:task_id].nil?
38
+ task_update(payload[:task_id],
39
+ 'task.multiplied',
40
+ function_args: payload[:args])
41
+ end
34
42
  end
35
43
 
36
44
  task_update(payload[:task_id], 'task.queued') unless payload[:task_id].nil?
@@ -38,14 +46,11 @@ module Legion::Extensions::Transformer
38
46
  generate_task_log(task_id: payload[:task_id], function: 'transform', values: payload)
39
47
  end
40
48
  { success: true, **payload }
41
- # rescue => ex
42
- # task_update(payload[:task_id], 'transformer.exception') unless payload[:task_id].nil?
43
- # raise ex
44
49
  end
45
50
 
46
51
  def self.send_task(**opts)
47
52
  payload = {}
48
- %i[task_id relationship_id trigger_function_id runner_class function_id function chain_id debug args].each do |thing|
53
+ %i[task_id relationship_id trigger_function_id runner_class function_id function chain_id debug args].each do |thing| # rubocop:disable Layout/LineLength
49
54
  payload[thing] = opts[thing] if opts.key? thing
50
55
  end
51
56
 
@@ -5,11 +5,9 @@ module Legion::Extensions::Transformer
5
5
  def self.additional_e_to_q
6
6
  [
7
7
  {
8
- # from: Legion::Transport::Exchanges::Task,
9
8
  to: Legion::Extensions::Transformer::Transport::Queues::Transform,
10
9
  routing_key: 'task.conditioner.succeeded'
11
10
  }, {
12
- # from: Legion::Transport::Exchanges::Task,
13
11
  to: Legion::Extensions::Transformer::Transport::Queues::Transform,
14
12
  routing_key: 'task.subtask.transform'
15
13
  }
@@ -1,7 +1,7 @@
1
1
  module Legion
2
2
  module Extensions
3
3
  module Transformer
4
- VERSION = '0.1.1'.freeze
4
+ VERSION = '0.1.2'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-transformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miverson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-26 00:00:00.000000000 Z
11
+ date: 2020-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt
@@ -75,12 +75,6 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - ".circleci/config.yml"
77
77
  - ".gitignore"
78
- - ".idea/.rakeTasks"
79
- - ".idea/lex-transformer.iml"
80
- - ".idea/misc.xml"
81
- - ".idea/modules.xml"
82
- - ".idea/vagrant.xml"
83
- - ".idea/workspace.xml"
84
78
  - ".rspec"
85
79
  - ".rubocop.yml"
86
80
  - CODE_OF_CONDUCT.md
@@ -107,7 +101,7 @@ metadata:
107
101
  homepage_uri: https://bitbucket.org/legion-io/lex-transformer
108
102
  source_code_uri: https://bitbucket.org/legion-io/lex-transformer
109
103
  changelog_uri: https://bitbucket.org/legion-io/lex-transformer
110
- post_install_message:
104
+ post_install_message:
111
105
  rdoc_options: []
112
106
  require_paths:
113
107
  - lib
@@ -115,15 +109,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
109
  requirements:
116
110
  - - ">="
117
111
  - !ruby/object:Gem::Version
118
- version: '0'
112
+ version: 2.5.0
119
113
  required_rubygems_version: !ruby/object:Gem::Requirement
120
114
  requirements:
121
115
  - - ">="
122
116
  - !ruby/object:Gem::Version
123
117
  version: '0'
124
118
  requirements: []
125
- rubygems_version: 3.0.8
126
- signing_key:
119
+ rubygems_version: 3.1.2
120
+ signing_key:
127
121
  specification_version: 4
128
122
  summary: LEX-Transformer is used to transform payloads for the output
129
123
  test_files: []
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Settings><!--This file was automatically generated by Ruby plugin.
3
- You are allowed to:
4
- 1. Remove rake task
5
- 2. Add existing rake tasks
6
- To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build lex-transformer-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install lex-transformer-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install lex-transformer-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push lex-transformer-0.1.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
@@ -1,21 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="ModuleRunConfigurationManager">
4
- <shared />
5
- </component>
6
- <component name="NewModuleRootManager">
7
- <content url="file://$MODULE_DIR$" />
8
- <orderEntry type="inheritedJdk" />
9
- <orderEntry type="sourceFolder" forTests="false" />
10
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.6.3) [gem]" level="application" />
11
- <orderEntry type="library" scope="PROVIDED" name="chef (v15.8.23, RVM: ruby-2.6.3) [gem]" level="application" />
12
- <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.6.3) [gem]" level="application" />
13
- <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.1, RVM: ruby-2.6.3) [gem]" level="application" />
14
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, RVM: ruby-2.6.3) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.1, RVM: ruby-2.6.3) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.0, RVM: ruby-2.6.3) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, RVM: ruby-2.6.3) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.2, RVM: ruby-2.6.3) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="tilt (v2.0.10, RVM: ruby-2.6.3) [gem]" level="application" />
20
- </component>
21
- </module>
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptSettings">
4
- <option name="languageLevel" value="ES6" />
5
- </component>
6
- <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.6.3" project-jdk-type="RUBY_SDK" />
7
- </project>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/lex-transformer.iml" filepath="$PROJECT_DIR$/.idea/lex-transformer.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VagrantProjectSettings">
4
- <option name="instanceFolder" value="" />
5
- <option name="provider" value="" />
6
- </component>
7
- </project>
@@ -1,13 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="CoverageOptionsProvider">
4
- <option name="myAddOrReplace" value="0" />
5
- </component>
6
- <component name="Git.Settings">
7
- <option name="PUSH_AUTO_UPDATE" value="true" />
8
- <option name="ROOT_SYNC" value="DONT_SYNC" />
9
- </component>
10
- <component name="PropertiesComponent">
11
- <property name="settings.editor.selected.configurable" value="reference.settingsdialog.project.vagrant" />
12
- </component>
13
- </project>