pult 0.0.2 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +5 -1
- data/lib/init/req-lib.rb +2 -0
- data/lib/init/req-proj.rb +10 -2
- data/lib/init/struct.rb +11 -2
- data/lib/pult.rb +4 -2
- data/lib/pult/api.rb +10 -0
- data/lib/pult/api/drawer.rb +64 -0
- data/lib/pult/api/drawer/helper.rb +83 -0
- data/lib/pult/api/server.rb +8 -0
- data/lib/pult/executor.rb +0 -1
- data/lib/pult/executor/screener.rb +0 -2
- data/lib/pult/panel.rb +0 -1
- data/lib/pult/panel/executor.rb +0 -1
- data/lib/pult/version.rb +1 -1
- data/pult.gemspec +6 -0
- metadata +36 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a1f2626325d559bee139156bf965999bc5f25c7bcc1982ee89d74542092873f
|
4
|
+
data.tar.gz: 2746f3c883cbf0c5bfb5f8501f2b56d558d283702443bf122560d3f0f1624f1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d981f88ef4ed8e86f20ec8d20e908b0596111fa9e0dda770ee66b9953554b4669162d1cc8f024d8285364af452d15550f22f2636277423e3abd84d453efe847a
|
7
|
+
data.tar.gz: '08fbc15c24149cd6fdf616d60cfe769fe263585aca4dd663dbc3d4bc888ad44c9120b214adf7b2a2104f456f112ee38f3c092ac5bbd63ffb9c49e0366e411057'
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pult (0.
|
4
|
+
pult (0.0.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -34,6 +34,8 @@ GEM
|
|
34
34
|
rack (>= 1.3.0)
|
35
35
|
rack-accept
|
36
36
|
virtus (>= 1.0.0)
|
37
|
+
grape-swagger (0.33.0)
|
38
|
+
grape (>= 0.16.2)
|
37
39
|
i18n (1.6.0)
|
38
40
|
concurrent-ruby (~> 1.0)
|
39
41
|
ice_nine (0.11.2)
|
@@ -62,8 +64,10 @@ DEPENDENCIES
|
|
62
64
|
activesupport (~> 5.2)
|
63
65
|
bundler (~> 2.0)
|
64
66
|
grape (~> 1.2)
|
67
|
+
grape-swagger (~> 0.33)
|
65
68
|
minitest (~> 5.0)
|
66
69
|
pult!
|
70
|
+
rack (~> 2.0)
|
67
71
|
rake (~> 10.0)
|
68
72
|
|
69
73
|
BUNDLED WITH
|
data/lib/init/req-lib.rb
CHANGED
data/lib/init/req-proj.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
require_relative '../pult/version'
|
2
|
+
|
2
3
|
require_relative '../pult/cli'
|
3
|
-
|
4
|
+
|
5
|
+
require_relative '../pult/api'
|
6
|
+
require_relative '../pult/api/drawer/helper'
|
7
|
+
require_relative '../pult/api/drawer'
|
8
|
+
require_relative '../pult/api/server'
|
9
|
+
|
4
10
|
require_relative '../pult/executor/enver'
|
11
|
+
require_relative '../pult/executor'
|
5
12
|
require_relative '../pult/executor/screener'
|
6
13
|
require_relative '../pult/executor/terminator'
|
14
|
+
|
15
|
+
require_relative '../pult/panel/dot_accessible'
|
7
16
|
require_relative '../pult/panel'
|
8
17
|
require_relative '../pult/panel/executor'
|
9
|
-
require_relative '../pult/panel/dot_accessible'
|
10
18
|
require_relative '../pult/panel/injector/app'
|
11
19
|
require_relative '../pult/panel/injector/panel'
|
12
20
|
require_relative '../pult/panel/injector/runner'
|
data/lib/init/struct.rb
CHANGED
@@ -1,18 +1,27 @@
|
|
1
1
|
module Pult
|
2
|
+
class Error < StandardError; end
|
3
|
+
|
2
4
|
class Cli; end
|
3
5
|
|
6
|
+
module Api
|
7
|
+
class Drawer < Grape::API
|
8
|
+
module Helper; end
|
9
|
+
end
|
10
|
+
module Server; end
|
11
|
+
end
|
12
|
+
|
4
13
|
class Executor
|
5
|
-
class Job < ActiveJob::Base; end
|
6
14
|
module Enver; end
|
15
|
+
class Job < ActiveJob::Base; end
|
7
16
|
class Screener; end
|
8
17
|
class Terminator; end
|
9
18
|
end
|
10
19
|
|
11
20
|
class Panel < Hash
|
21
|
+
module DotAccessible; end
|
12
22
|
module Executor
|
13
23
|
class Job < ActiveJob::Base; end
|
14
24
|
end
|
15
|
-
module DotAccessible; end
|
16
25
|
module Injector
|
17
26
|
module App; end
|
18
27
|
module Panel; end
|
data/lib/pult.rb
CHANGED
data/lib/pult/api.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
class Pult::Api::Drawer
|
2
|
+
|
3
|
+
format :json
|
4
|
+
|
5
|
+
PREFIX = ENV['PULT_API_PREFIX'] || 'api'
|
6
|
+
|
7
|
+
prefix PREFIX
|
8
|
+
|
9
|
+
def self.draw! panel
|
10
|
+
@@panel = panel
|
11
|
+
|
12
|
+
for @@app in @@panel._apps
|
13
|
+
resource @@app, & ACTIONS
|
14
|
+
end
|
15
|
+
|
16
|
+
add_swagger_documentation
|
17
|
+
end
|
18
|
+
|
19
|
+
include Helper
|
20
|
+
|
21
|
+
Runner = Pult::Panel::Injector::Runner
|
22
|
+
|
23
|
+
ACTIONS = proc {
|
24
|
+
|
25
|
+
flat_app = @@panel[@@app]._to_flat.merge!(@@panel[@@app])
|
26
|
+
|
27
|
+
for action in flat_app._actions.sort.reverse
|
28
|
+
action_url = action.gsub '.', '/'
|
29
|
+
|
30
|
+
for injection in Runner.read_injections.sort
|
31
|
+
info_get flat_app, action, injection
|
32
|
+
get "#{action_url}_#{injection}" do
|
33
|
+
action route
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
for injection in Runner.run_injections.sort
|
38
|
+
info_post flat_app, action, injection
|
39
|
+
post "#{action_url}_#{injection}" do
|
40
|
+
action route
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
info_get flat_app, action
|
45
|
+
get action_url do
|
46
|
+
action route
|
47
|
+
end
|
48
|
+
|
49
|
+
info_post flat_app, action
|
50
|
+
post action_url do
|
51
|
+
action! route
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
for action in flat_app._actions.sort.reverse
|
56
|
+
action_url = action.gsub '.', '/'
|
57
|
+
|
58
|
+
info_post flat_app, action, job: true
|
59
|
+
post "#{action_url}_job" do
|
60
|
+
action! route
|
61
|
+
end
|
62
|
+
end
|
63
|
+
}
|
64
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Pult::Api::Drawer::Helper
|
2
|
+
|
3
|
+
def self.included base
|
4
|
+
@@base = base
|
5
|
+
|
6
|
+
Grape::API::Instance.extend ClassMethods
|
7
|
+
|
8
|
+
base.helpers do
|
9
|
+
def path
|
10
|
+
route.pattern.origin
|
11
|
+
end
|
12
|
+
|
13
|
+
def panel
|
14
|
+
@@base.class_variable_get :@@panel
|
15
|
+
end
|
16
|
+
|
17
|
+
def action route
|
18
|
+
/^\/(?<path>.+)$/ =~ path.sub(/^\/#{@@base::PREFIX}/, '')
|
19
|
+
panel._apply_path!(path, params)
|
20
|
+
end
|
21
|
+
|
22
|
+
def action! route
|
23
|
+
/^\/(?<path>.+)$/ =~ path.sub(/^\/#{@@base::PREFIX}/, '')
|
24
|
+
panel._apply_path!("#{path}!", params)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module ClassMethods
|
30
|
+
UI = {
|
31
|
+
red: ->(s){'<span style="color: red;">'+ s +'</span>'},
|
32
|
+
icon: {
|
33
|
+
job: '<b>‣ RUN JOB</b>',
|
34
|
+
run: '<b>‣ RUN</b>',
|
35
|
+
sep: ' | ',
|
36
|
+
},
|
37
|
+
title: {
|
38
|
+
get: ->{"#{@@injection}#{@@action_title}"},
|
39
|
+
post: ->{"#{@@injection}#{@@action_title} #{@@icon}"},
|
40
|
+
},
|
41
|
+
detail: {
|
42
|
+
get: ->{"#{@@injection}#{@@action_title}<br>#{@@command}"},
|
43
|
+
post: ->{"#{@@injection}#{@@action_title}<br>#{UI[:red].(@@command)}"}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
def info flat_app, action, injection, job, type:
|
48
|
+
@@action = action
|
49
|
+
@@action_title = flat_app._action_title(action)
|
50
|
+
@@command = flat_app[action].to_s
|
51
|
+
@@icon = job ? UI[:icon][:job] : UI[:icon][:run]
|
52
|
+
@@injection = injection&.sub!('_', '') ? "#{injection}#{UI[:icon][:sep]}" : ''
|
53
|
+
|
54
|
+
desc(UI[:title][type].call){ detail(UI[:detail][type].call) }
|
55
|
+
|
56
|
+
parameters if type == :post
|
57
|
+
end
|
58
|
+
|
59
|
+
def parameters
|
60
|
+
params do
|
61
|
+
optional :screen, type: String
|
62
|
+
|
63
|
+
@@command.scan(/(?<=\$)[^\s()]+/).each do |param|
|
64
|
+
description = { type: String }
|
65
|
+
|
66
|
+
if ! (default = `echo -n $#{param}`).blank?
|
67
|
+
description.merge! default: default
|
68
|
+
end
|
69
|
+
|
70
|
+
requires param.to_sym, description
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def info_get flat_app, action, injection=nil, job: nil
|
76
|
+
info flat_app, action, injection, job, type: :get
|
77
|
+
end
|
78
|
+
|
79
|
+
def info_post flat_app, action, injection=nil, job: nil
|
80
|
+
info flat_app, action, injection, job, type: :post
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/pult/executor.rb
CHANGED
data/lib/pult/panel.rb
CHANGED
data/lib/pult/panel/executor.rb
CHANGED
data/lib/pult/version.rb
CHANGED
data/pult.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
|
2
|
+
RUBY_VERSION_REQ = '>= 2.3.0'
|
3
|
+
|
2
4
|
lib = File.expand_path("../lib", __FILE__)
|
3
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
6
|
require "pult/version"
|
@@ -13,6 +15,8 @@ Gem::Specification.new do |spec|
|
|
13
15
|
spec.homepage = "https://github.com/dmitryck/pult"
|
14
16
|
spec.license = "MIT"
|
15
17
|
|
18
|
+
spec.required_ruby_version = RUBY_VERSION_REQ
|
19
|
+
|
16
20
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
21
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
22
|
if spec.respond_to?(:metadata)
|
@@ -39,5 +43,7 @@ Gem::Specification.new do |spec|
|
|
39
43
|
spec.add_development_dependency "minitest", "~> 5.0"
|
40
44
|
spec.add_development_dependency "activesupport", "~> 5.2"
|
41
45
|
spec.add_development_dependency "activejob", "~> 5.2"
|
46
|
+
spec.add_development_dependency "rack", "~> 2.0"
|
42
47
|
spec.add_development_dependency "grape", "~> 1.2"
|
48
|
+
spec.add_development_dependency "grape-swagger", "~> 0.33"
|
43
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pult
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dmitryck
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: grape
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '1.2'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: grape-swagger
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.33'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.33'
|
97
125
|
description:
|
98
126
|
email:
|
99
127
|
- dmitryck@gmail.com
|
@@ -103,6 +131,7 @@ extra_rdoc_files: []
|
|
103
131
|
files:
|
104
132
|
- ".gitignore"
|
105
133
|
- ".travis.yml"
|
134
|
+
- CHANGELOG.md
|
106
135
|
- Gemfile
|
107
136
|
- Gemfile.lock
|
108
137
|
- LICENSE.txt
|
@@ -116,6 +145,10 @@ files:
|
|
116
145
|
- lib/init/req-proj.rb
|
117
146
|
- lib/init/struct.rb
|
118
147
|
- lib/pult.rb
|
148
|
+
- lib/pult/api.rb
|
149
|
+
- lib/pult/api/drawer.rb
|
150
|
+
- lib/pult/api/drawer/helper.rb
|
151
|
+
- lib/pult/api/server.rb
|
119
152
|
- lib/pult/cli.rb
|
120
153
|
- lib/pult/executor.rb
|
121
154
|
- lib/pult/executor/enver.rb
|
@@ -145,7 +178,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
178
|
requirements:
|
146
179
|
- - ">="
|
147
180
|
- !ruby/object:Gem::Version
|
148
|
-
version:
|
181
|
+
version: 2.3.0
|
149
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
183
|
requirements:
|
151
184
|
- - ">="
|