lex-transformer 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bac9f67997f5e3e4203e8049cfa9d2c5ec1f2cb5369a0d7b3fcc150a2f7ae198
4
+ data.tar.gz: ea681503c5db97fa1d45ad35c3b9fbb7ba59dada4328841103e57fbb19e650e7
5
+ SHA512:
6
+ metadata.gz: 10ff925a03e1d4f9e91996ee45b5cf84d9e37b45bc12ab85932c66d9624fdb5e21f8f4dd484bbbcc136b55f7e509c67144d1deb0a2ecc8f77dadb0e030cd09d6
7
+ data.tar.gz: 1535f9e23b315b657935b1ce3da8003eadec6698fc853b146b2f0f7b7631a7d52611e8909d6d3f359fc7df6bcafe972ba18505966facd0d3e38b95f077c74900
@@ -0,0 +1,61 @@
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@0.2.1
4
+
5
+ jobs:
6
+ "rubocop":
7
+ docker:
8
+ - image: circleci/ruby:2.5-node
9
+ steps:
10
+ - checkout
11
+ - ruby/load-cache
12
+ - ruby/install-deps
13
+ - run:
14
+ name: Run Rubocop
15
+ command: bundle exec rubocop
16
+ - ruby/save-cache
17
+ "ruby-two-five":
18
+ docker:
19
+ - image: circleci/ruby:2.5
20
+ - image: memcached:1.5-alpine
21
+ steps:
22
+ - checkout
23
+ - ruby/load-cache
24
+ - ruby/install-deps
25
+ - ruby/run-tests
26
+ - ruby/save-cache
27
+ "ruby-two-six":
28
+ docker:
29
+ - image: circleci/ruby:2.6
30
+ - image: memcached:1.5-alpine
31
+ steps:
32
+ - checkout
33
+ - ruby/load-cache
34
+ - ruby/install-deps
35
+ - ruby/run-tests
36
+ - ruby/save-cache
37
+ "ruby-two-seven":
38
+ docker:
39
+ - image: circleci/ruby:2.7
40
+ - image: memcached:1.5-alpine
41
+ steps:
42
+ - checkout
43
+ - ruby/load-cache
44
+ - ruby/install-deps
45
+ - ruby/run-tests
46
+ - ruby/save-cache
47
+
48
+ workflows:
49
+ version: 2
50
+ rubocop-rspec:
51
+ jobs:
52
+ - rubocop
53
+ - ruby-two-five:
54
+ requires:
55
+ - rubocop
56
+ - ruby-two-six:
57
+ requires:
58
+ - ruby-two-five
59
+ - ruby-two-seven:
60
+ requires:
61
+ - ruby-two-five
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
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>
@@ -0,0 +1,21 @@
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>
data/.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
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>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
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>
data/.idea/vagrant.xml ADDED
@@ -0,0 +1,7 @@
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>
@@ -0,0 +1,13 @@
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>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,25 @@
1
+ Layout/LineLength:
2
+ Max: 120
3
+ Metrics/MethodLength:
4
+ Max: 30
5
+ Metrics/ClassLength:
6
+ Max: 1500
7
+ Metrics/BlockLength:
8
+ Max: 50
9
+ Layout/SpaceAroundEqualsInParameterDefault:
10
+ EnforcedStyle: space
11
+ Style/SymbolArray:
12
+ Enabled: true
13
+ Layout/HashAlignment:
14
+ EnforcedHashRocketStyle: table
15
+ EnforcedColonStyle: table
16
+ Style/Documentation:
17
+ Enabled: false
18
+ AllCops:
19
+ TargetRubyVersion: 2.5
20
+ Style/FrozenStringLiteralComment:
21
+ Enabled: false
22
+ Naming/FileName:
23
+ Enabled: false
24
+ Style/ClassAndModuleChildren:
25
+ Enabled: false
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at matthewdiverson@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in legion-extensions-transformer.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lex-transformer (0.1.0)
5
+ tilt
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ rake (13.0.1)
12
+ rspec (3.9.0)
13
+ rspec-core (~> 3.9.0)
14
+ rspec-expectations (~> 3.9.0)
15
+ rspec-mocks (~> 3.9.0)
16
+ rspec-core (3.9.1)
17
+ rspec-support (~> 3.9.1)
18
+ rspec-expectations (3.9.0)
19
+ diff-lcs (>= 1.2.0, < 2.0)
20
+ rspec-support (~> 3.9.0)
21
+ rspec-mocks (3.9.1)
22
+ diff-lcs (>= 1.2.0, < 2.0)
23
+ rspec-support (~> 3.9.0)
24
+ rspec-support (3.9.2)
25
+ tilt (2.0.10)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ bundler
32
+ lex-transformer!
33
+ rake
34
+ rspec
35
+
36
+ BUNDLED WITH
37
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Miverson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Legion::Extensions::Transformer
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
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'legion-extensions-transformer'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install legion-extensions-transformer
22
+
23
+ ## 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.
36
+
37
+ ## License
38
+
39
+ 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).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'legion/extensions/transformer'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'legion/extensions/transformer/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'lex-transformer'
7
+ spec.version = Legion::Extensions::Transformer::VERSION
8
+ spec.authors = ['Miverson']
9
+ spec.email = ['matthewdiverson@gmail.com']
10
+
11
+ spec.summary = 'LEX-Transformer is used to transform payloads for the output'
12
+ spec.description = 'Runs transformer statements against tasks in a relationship'
13
+ spec.homepage = 'https://bitbucket.org/legion-io/lex-transformer'
14
+ spec.license = 'MIT'
15
+
16
+ if spec.respond_to?(:metadata)
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-transformer'
19
+ spec.metadata['changelog_uri'] = 'https://bitbucket.org/legion-io/lex-transformer'
20
+ else
21
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
22
+ 'public gem pushes.'
23
+ end
24
+
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
+ end
28
+ spec.require_paths = ['lib']
29
+
30
+ spec.add_dependency 'tilt'
31
+
32
+ spec.add_development_dependency 'bundler'
33
+ spec.add_development_dependency 'rake'
34
+ spec.add_development_dependency 'rspec'
35
+ end
@@ -0,0 +1,10 @@
1
+ require 'legion/extensions/transformer/version'
2
+ require 'legion/extensions'
3
+
4
+ module Legion
5
+ module Extensions
6
+ module Transformer
7
+ extend Legion::Extensions::Core
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ module Legion::Extensions::Transformer
2
+ module Actor
3
+ class Transform < Legion::Extensions::Actors::Subscription
4
+ def runner_function
5
+ 'transform'
6
+ end
7
+
8
+ def check_subtask?
9
+ false
10
+ end
11
+
12
+ def generate_task?
13
+ false
14
+ end
15
+
16
+ def use_runner?
17
+ false
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,56 @@
1
+ require 'tilt'
2
+
3
+ module Legion::Extensions::Transformer
4
+ module Runners
5
+ class Transform
6
+ extend Legion::Extensions::Helpers::Lex
7
+ extend Legion::Extensions::Helpers::Task
8
+
9
+ def self.transform(transformation:, **payload)
10
+ template = Tilt['erb'].new { transformation }
11
+ variables = { **payload }
12
+ variables[:crypt] = Legion::Crypt if transformation.include? 'crypt'
13
+ variables[:settings] = Legion::Settings if transformation.include? 'settings'
14
+ variables[:cache] = Legion::Cache if transformation.include? 'cache'
15
+ if payload.key?(:task_id) && transformation.include?('task')
16
+ variables[:task] = Legion::Data::Model::Task[payload[:task_id]]
17
+ end
18
+
19
+ payload[:args] = from_json(template.render(self, variables))
20
+ if payload[:args].is_a? Hash
21
+ unless payload[:task_id].nil?
22
+ task_update(payload[:task_id], 'transformer.succeeded', function_args: payload[:args])
23
+ end
24
+ send_task(payload)
25
+ elsif payload[:args].is_a? Array
26
+ payload[:args].each do |thing|
27
+ new_payload = payload
28
+ task = Legion::Runner::Status.generate_task_id(function_args: thing, status: 'task.queued', args: thing, **new_payload)
29
+ new_payload[:task_id] = task[:task_id]
30
+ new_payload[:args] = thing
31
+ send_task(**new_payload)
32
+ end
33
+ task_update(payload[:task_id], 'task.multiplied', function_args: payload[:args]) unless payload[:task_id].nil?
34
+ end
35
+
36
+ task_update(payload[:task_id], 'task.queued') unless payload[:task_id].nil?
37
+ if payload[:debug] && payload.key?(:task_id)
38
+ generate_task_log(task_id: payload[:task_id], function: 'transform', values: payload)
39
+ end
40
+ { success: true, **payload }
41
+ # rescue => ex
42
+ # task_update(payload[:task_id], 'transformer.exception') unless payload[:task_id].nil?
43
+ # raise ex
44
+ end
45
+
46
+ def self.send_task(**opts)
47
+ payload = {}
48
+ %i[task_id relationship_id trigger_function_id runner_class function_id function chain_id debug args].each do |thing|
49
+ payload[thing] = opts[thing] if opts.key? thing
50
+ end
51
+
52
+ Legion::Extensions::Transformer::Transport::Messages::Message.new(**payload).publish
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,19 @@
1
+ module Legion::Extensions::Transformer
2
+ module Transport
3
+ extend Legion::Extensions::Transport
4
+
5
+ def self.additional_e_to_q
6
+ [
7
+ {
8
+ # from: Legion::Transport::Exchanges::Task,
9
+ to: Legion::Extensions::Transformer::Transport::Queues::Transform,
10
+ routing_key: 'task.conditioner.succeeded'
11
+ }, {
12
+ # from: Legion::Transport::Exchanges::Task,
13
+ to: Legion::Extensions::Transformer::Transport::Queues::Transform,
14
+ routing_key: 'task.subtask.transform'
15
+ }
16
+ ]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ module Legion::Extensions::Transformer
2
+ module Transport
3
+ module Exchanges
4
+ class Transformer < Legion::Transport::Exchanges::Task
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ module Legion::Extensions::Transformer::Transport::Messages
2
+ class Message < Legion::Transport::Message
3
+ def type
4
+ 'task'
5
+ end
6
+
7
+ def message
8
+ { args: @options[:args] || @options }
9
+ end
10
+
11
+ def routing_key
12
+ "#{function.runner.extension.values[:name]}.#{function.runner.values[:name]}.#{function.values[:name]}"
13
+ end
14
+
15
+ def exchange
16
+ Legion::Transport::Exchange.new(function.runner.extension.values[:exchange])
17
+ end
18
+
19
+ def function
20
+ @function ||= Legion::Data::Model::Function[@options[:function_id]]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,11 @@
1
+ module Legion::Extensions::Transformer
2
+ module Transport
3
+ module Queues
4
+ class Transform < Legion::Transport::Queue
5
+ def queue_name
6
+ 'task.transform'
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module Legion
2
+ module Extensions
3
+ module Transformer
4
+ VERSION = '0.1.1'.freeze
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lex-transformer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Miverson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tilt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Runs transformer statements against tasks in a relationship
70
+ email:
71
+ - matthewdiverson@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".circleci/config.yml"
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
+ - ".rspec"
85
+ - ".rubocop.yml"
86
+ - CODE_OF_CONDUCT.md
87
+ - Gemfile
88
+ - Gemfile.lock
89
+ - LICENSE.txt
90
+ - README.md
91
+ - Rakefile
92
+ - bin/console
93
+ - bin/setup
94
+ - legion-extensions-transformer.gemspec
95
+ - lib/legion/extensions/transformer.rb
96
+ - lib/legion/extensions/transformer/actors/transform.rb
97
+ - lib/legion/extensions/transformer/runners/transform.rb
98
+ - lib/legion/extensions/transformer/transport.rb
99
+ - lib/legion/extensions/transformer/transport/exchanges/task.rb
100
+ - lib/legion/extensions/transformer/transport/messages/message.rb
101
+ - lib/legion/extensions/transformer/transport/queues/transform.rb
102
+ - lib/legion/extensions/transformer/version.rb
103
+ homepage: https://bitbucket.org/legion-io/lex-transformer
104
+ licenses:
105
+ - MIT
106
+ metadata:
107
+ homepage_uri: https://bitbucket.org/legion-io/lex-transformer
108
+ source_code_uri: https://bitbucket.org/legion-io/lex-transformer
109
+ changelog_uri: https://bitbucket.org/legion-io/lex-transformer
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubygems_version: 3.0.8
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: LEX-Transformer is used to transform payloads for the output
129
+ test_files: []