legionio 0.2.0 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. metadata +22 -104
  3. data/.circleci/config.yml +0 -98
  4. data/.gitignore +0 -14
  5. data/.rspec +0 -2
  6. data/.rubocop.yml +0 -56
  7. data/CHANGELOG.md +0 -7
  8. data/Gemfile +0 -15
  9. data/LICENSE.txt +0 -21
  10. data/README.md +0 -46
  11. data/Rakefile +0 -38
  12. data/bin/console +0 -16
  13. data/bin/legion +0 -61
  14. data/bin/setup +0 -8
  15. data/bin/test +0 -32
  16. data/bitbucket-pipelines.yml +0 -55
  17. data/exe/legion +0 -58
  18. data/legion.gemspec +0 -60
  19. data/lib/legion.rb +0 -21
  20. data/lib/legion/exceptions/handled_task.rb +0 -6
  21. data/lib/legion/exceptions/invalidjson.rb +0 -8
  22. data/lib/legion/exceptions/missingargument.rb +0 -8
  23. data/lib/legion/exceptions/wrongtype.rb +0 -10
  24. data/lib/legion/exceptions/wrongtypes/array.rb +0 -11
  25. data/lib/legion/exceptions/wrongtypes/hash.rb +0 -11
  26. data/lib/legion/exceptions/wrongtypes/integer.rb +0 -11
  27. data/lib/legion/exceptions/wrongtypes/string.rb +0 -11
  28. data/lib/legion/extensions.rb +0 -151
  29. data/lib/legion/extensions/actors/base.rb +0 -53
  30. data/lib/legion/extensions/actors/every.rb +0 -50
  31. data/lib/legion/extensions/actors/loop.rb +0 -34
  32. data/lib/legion/extensions/actors/nothing.rb +0 -15
  33. data/lib/legion/extensions/actors/once.rb +0 -42
  34. data/lib/legion/extensions/actors/poll.rb +0 -90
  35. data/lib/legion/extensions/actors/subscription.rb +0 -120
  36. data/lib/legion/extensions/builders/actors.rb +0 -62
  37. data/lib/legion/extensions/builders/base.rb +0 -38
  38. data/lib/legion/extensions/builders/helpers.rb +0 -26
  39. data/lib/legion/extensions/builders/runners.rb +0 -54
  40. data/lib/legion/extensions/core.rb +0 -84
  41. data/lib/legion/extensions/helpers/base.rb +0 -88
  42. data/lib/legion/extensions/helpers/core.rb +0 -20
  43. data/lib/legion/extensions/helpers/lex.rb +0 -22
  44. data/lib/legion/extensions/helpers/logger.rb +0 -48
  45. data/lib/legion/extensions/helpers/task.rb +0 -42
  46. data/lib/legion/extensions/helpers/transport.rb +0 -45
  47. data/lib/legion/extensions/transport.rb +0 -156
  48. data/lib/legion/process.rb +0 -138
  49. data/lib/legion/runner.rb +0 -57
  50. data/lib/legion/runner/log.rb +0 -12
  51. data/lib/legion/runner/status.rb +0 -72
  52. data/lib/legion/service.rb +0 -80
  53. data/lib/legion/supervison.rb +0 -14
  54. data/lib/legion/version.rb +0 -5
  55. data/settings/client.json +0 -9
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 BuildTools
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 DELETED
@@ -1,46 +0,0 @@
1
- # Legion
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
4
- into a gem. Put your Ruby code in the file `lib/legion`. To experiment with that code, run `bin/console` for
5
- an interactive prompt.
6
-
7
-
8
- ## Installation
9
-
10
- Add this line to your application's Gemfile:
11
-
12
- ```ruby
13
- gem 'legion'
14
- ```
15
-
16
- And then execute:
17
-
18
- $ bundle
19
-
20
- Or install it yourself as:
21
-
22
- $ gem install legion
23
-
24
- ## Usage
25
-
26
- TODO: Write usage instructions here
27
-
28
- ## Development
29
-
30
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
31
- You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
-
33
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version,
34
- update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git
35
- tag for the version, push git commits and tags, and push the `.gem` file
36
- to [rubygems.org](https://rubygems.org).
37
-
38
- ## Contributing
39
-
40
- Bug reports and pull requests are welcome on GitHub at https://bitbucket.org/whonodes/legion/issues.
41
- This project is intended to be a safe, welcoming space for collaboration, and contributors are
42
- expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
43
-
44
- ## License
45
-
46
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile DELETED
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- task default: :spec
9
-
10
- task test: :rubocop
11
- task test: :spec
12
- task test: :start
13
-
14
- task :rubocop do
15
- sh 'rubocop'
16
- end
17
-
18
- task :start do
19
- sh 'bin/legion start -d'
20
- sh 'bin/legion stop'
21
- end
22
-
23
- namespace :deploy do
24
- require 'legion/version.rb'
25
- desc 'Deploy alpha/test'
26
- task :test do
27
- Gem.yank_gem('legion', "#{Legion::VERSION}a")
28
- puts Gem.query('legion-transport').inspect
29
- puts Gem.methods(false)
30
- puts Legion::VERSION
31
- end
32
-
33
- task :staging do
34
- end
35
-
36
- task :production do
37
- end
38
- end
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'legion'
6
- Legion::Service.new
7
-
8
- # You can add fixtures and/or initialization code here to make experimenting
9
- # with your gem easier. You can also use a different console, if you like.
10
-
11
- # (If you use this, don't forget to add pry to your Gemfile!)
12
- require 'pry'
13
- Pry.start
14
-
15
- require 'irb'
16
- IRB.start(__FILE__)
data/bin/legion DELETED
@@ -1,61 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- # rubocop:disable all
4
- require 'optparse'
5
-
6
- options = { action: :run }
7
-
8
- daemonize_help = 'run daemonized in the background (default: false)'
9
- pidfile_help = 'the pid filename'
10
- logfile_help = 'the log filename'
11
- include_help = 'an additional $LOAD_PATH (may be used more than once)'
12
- debug_help = 'set $DEBUG to true'
13
- warn_help = 'enable warnings'
14
- time_help = 'only run legion for X seconds'
15
-
16
- op = OptionParser.new
17
- op.banner = 'An example of how to daemonize a long running Ruby process.'
18
- op.separator ''
19
- op.separator 'Usage: server [options]'
20
- op.separator ''
21
-
22
- op.separator ''
23
- op.separator 'Process options:'
24
- op.on('-d', '--daemonize', daemonize_help) { options[:daemonize] = true }
25
- op.on('-p', '--pid PIDFILE', pidfile_help) { |value| options[:pidfile] = value }
26
- op.on('-l', '--log LOGFILE', logfile_help) { |value| options[:logfile] = value }
27
- op.on('-t', '--time 10', time_help) { |value| options[:time_limit] = value }
28
-
29
- op.separator ''
30
- op.separator 'Ruby options:'
31
- op.on('-I', '--include PATH', include_help) {
32
- |value| $LOAD_PATH.unshift(*value.split(':').map {
33
- |v| File.expand_path(v)
34
- })
35
- }
36
- op.on('--debug', debug_help) { $DEBUG = true }
37
- op.on('--warn', warn_help) { $-w = true }
38
-
39
- op.separator ''
40
- op.separator 'Common options:'
41
- op.on('-h', '--help') { options[:action] = :help }
42
- op.on('-v', '--version') { options[:action] = :version }
43
-
44
- op.separator ''
45
- op.parse!(ARGV)
46
-
47
- #==============================================================================
48
- # EXECUTE script
49
- #==============================================================================
50
-
51
- require File.expand_path('lib/legion.rb') unless options[:action] == :help
52
- Legion.start
53
- require File.expand_path('lib/legion/process.rb') unless options[:action] == :help
54
- # case options[:action]
55
- # when :help then puts op.to_s
56
- # when :version then puts Legion::VERSION
57
- # else
58
- # Legion::Process.run!(options)
59
- # end
60
-
61
- Legion::Process.new(options).run!
data/bin/setup DELETED
@@ -1,8 +0,0 @@
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
data/bin/test DELETED
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- # rubocop:disable all
4
- require 'cli-tree'
5
- # require File.expand_path('lib/legion.rb')
6
- # Legion.setup
7
- require 'legion/json'
8
- require 'legion/logging'
9
- require 'legion/settings'
10
- require 'legion/data'
11
- Legion::Logging.setup(level: 'debug')
12
- Legion::Settings.load
13
- Legion::Settings.merge_settings('data', Legion::Data::Settings.default)
14
- Legion::Data.setup
15
- extensions = {name: 'extensions', children: []}
16
- Legion::Data::Model::Extension.each do | extension|
17
- runners = []
18
- extension.runners.each do |runner|
19
- functions = []
20
- runner.functions.each do |function|
21
- functions.push function.values[:name]
22
- end
23
- # runners.push runner.values[:name]
24
- runners.push({name: runner.values[:name], children: functions})
25
- end
26
- child = {name: extension.values[:name], children: runners}
27
- # extensions[:children].push extension.values[:name]
28
- extensions[:children].push child
29
- end
30
-
31
- tree = TreeNode.from_h(extensions)
32
- tree.print
@@ -1,55 +0,0 @@
1
- image: ruby:2.5.0
2
-
3
- pipelines:
4
- tags:
5
- '0.1.0':
6
- - step:
7
- caches:
8
- - bundler
9
- deployment: rubygems
10
- script:
11
- - mkdir -p ~/.gem/credentials
12
- - (umask 077 ; echo $gem_creds | base64 --decode > ~/.gem/credentials)
13
- - gem build legion.gemspec
14
- - gem push legionio-*.gem
15
- branches:
16
- master:
17
- - step:
18
- caches:
19
- - bundler
20
- script:
21
- - gem install bundle rubocop
22
- - bundle install
23
- - rubocop
24
- - rake
25
- services:
26
- - mysql
27
- - broker
28
- default:
29
- - step:
30
- caches:
31
- - bundler
32
- script:
33
- - gem install bundle rubocop
34
- - bundle install
35
- - rubocop
36
- - rake
37
- services:
38
- - mysql
39
- - broker
40
- definitions:
41
- caches:
42
- bundler: vendor/bundle
43
- services:
44
- mysql:
45
- image: mysql:5.7
46
- environment:
47
- MYSQL_DATABASE: 'legion'
48
- MYSQL_ROOT_PASSWORD: 'legion'
49
- MYSQL_USER: 'legion'
50
- MYSQL_PASSWORD: 'legion'
51
- broker:
52
- image: rabbitmq:3
53
- environment:
54
- RABBITMQ_DEFAULT_USER: guest
55
- RABBITMQ_DEFAULT_PASS: guest
data/exe/legion DELETED
@@ -1,58 +0,0 @@
1
- #!/usr/bin/env jruby
2
- # frozen_string_literal: true
3
- # rubocop:disable all
4
- require 'optparse'
5
-
6
- options = { action: :run }
7
-
8
- daemonize_help = 'run daemonized in the background (default: false)'
9
- pidfile_help = 'the pid filename'
10
- logfile_help = 'the log filename'
11
- include_help = 'an additional $LOAD_PATH (may be used more than once)'
12
- debug_help = 'set $DEBUG to true'
13
- warn_help = 'enable warnings'
14
-
15
- op = OptionParser.new
16
- op.banner = 'An example of how to daemonize a long running Ruby process.'
17
- op.separator ''
18
- op.separator 'Usage: server [options]'
19
- op.separator ''
20
-
21
- op.separator ''
22
- op.separator 'Process options:'
23
- op.on('-d', '--daemonize', daemonize_help) { options[:daemonize] = true }
24
- op.on('-p', '--pid PIDFILE', pidfile_help) { |value| options[:pidfile] = value }
25
- op.on('-l', '--log LOGFILE', logfile_help) { |value| options[:logfile] = value }
26
-
27
- op.separator ''
28
- op.separator 'Ruby options:'
29
- op.on('-I', '--include PATH', include_help) {
30
- |value| $LOAD_PATH.unshift(*value.split(':').map {
31
- |v| File.expand_path(v)
32
- })
33
- }
34
- op.on('--debug', debug_help) { $DEBUG = true }
35
- op.on('--warn', warn_help) { $-w = true }
36
-
37
- op.separator ''
38
- op.separator 'Common options:'
39
- op.on('-h', '--help') { options[:action] = :help }
40
- op.on('-v', '--version') { options[:action] = :version }
41
-
42
- op.separator ''
43
- op.parse!(ARGV)
44
-
45
- #==============================================================================
46
- # EXECUTE script
47
- #==============================================================================
48
-
49
- require File.expand_path('lib/legion.rb') unless options[:action] == :help
50
- require File.expand_path('lib/legion/process.rb') unless options[:action] == :help
51
- case options[:action]
52
- when :help then puts op.to_s
53
- when :version then puts Legion::VERSION
54
- else
55
- Legion::Process.run!(options)
56
- end
57
-
58
- Legion::Process.new(options).run!
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'legion/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = (RUBY_ENGINE == 'jruby' ? 'legionio-java' : 'legionio')
9
- spec.version = Legion::VERSION
10
- spec.authors = ['Esity']
11
- spec.email = ['matthewdiverson@gmail.com']
12
-
13
- spec.summary = 'Legion Core Software to string it all together'
14
- spec.description = 'Legion Core runs Legion Framwork'
15
- spec.homepage = 'https://bitbucket.org/legion-io/legion/'
16
- spec.license = 'MIT'
17
-
18
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
20
- end
21
- spec.bindir = 'exe'
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ['lib']
24
-
25
- if RUBY_ENGINE == 'jruby'
26
- spec.add_dependency 'legion-data-java'
27
- spec.add_dependency 'legion-json-java'
28
- spec.add_dependency 'legion-settings-java'
29
- spec.add_dependency 'legion-transport-java'
30
- else
31
- spec.add_dependency 'legion-data'
32
- spec.add_dependency 'legion-json'
33
- spec.add_dependency 'legion-settings'
34
- spec.add_dependency 'legion-transport'
35
- end
36
-
37
- spec.add_dependency 'concurrent-ruby'
38
- spec.add_dependency 'concurrent-ruby-ext'
39
- spec.add_dependency 'daemons'
40
- spec.add_dependency 'hashdiff'
41
- spec.add_dependency 'vault'
42
-
43
- spec.add_dependency 'legion-cache'
44
- spec.add_dependency 'legion-crypt'
45
- spec.add_dependency 'legion-exceptions'
46
- spec.add_dependency 'legion-logging'
47
-
48
- spec.add_dependency 'sleepiq'
49
-
50
- spec.add_development_dependency 'bundler'
51
- spec.add_development_dependency 'cli-tree'
52
- spec.add_development_dependency 'codecov'
53
- spec.add_development_dependency 'memory_profiler'
54
- spec.add_development_dependency 'pry'
55
- spec.add_development_dependency 'rake'
56
- spec.add_development_dependency 'rspec'
57
- spec.add_development_dependency 'rspec_junit_formatter'
58
- spec.add_development_dependency 'rubocop'
59
- spec.add_development_dependency 'simplecov'
60
- end
@@ -1,21 +0,0 @@
1
- Process.setproctitle('Legion')
2
- require 'concurrent-ruby'
3
- require 'securerandom'
4
- # require 'legion/exceptions'
5
- require 'legion/version'
6
- require 'legion/process'
7
- require 'legion/service'
8
- require 'legion/extensions'
9
-
10
- module Legion
11
- attr_reader :service
12
-
13
- def self.start
14
- @service = Legion::Service.new
15
- Legion::Logging.info("Started Legion v#{Legion::VERSION}")
16
- end
17
-
18
- def self.shutdown
19
- @service.shutdown
20
- end
21
- end
@@ -1,6 +0,0 @@
1
- module Legion
2
- module Exception
3
- class HandledTask < StandardError
4
- end
5
- end
6
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Legion
4
- module Exception
5
- # Invalid JSON class
6
- class InvalidJson < StandardError; end
7
- end
8
- end