mushy 0.14.1 → 0.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/mushy +5 -0
- data/lib/mushy/builder/api.rb +37 -6
- data/lib/mushy/builder/index.rb +20 -18
- data/lib/mushy/fluxs/filter.rb +29 -2
- data/lib/mushy/fluxs/stdout.rb +26 -0
- data/mushy.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b743e14b0d41b727255550df74d33edc0c5eb33b4426e31d4eea41830aa167e
|
4
|
+
data.tar.gz: 26e61eb0310e6a512deca465c0bb375c94b28ce58a3ee296e677b60a4fea5fc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bcfe3677a5ca79b2e0249e1b03dec50bc2a019a06f8c61dcb0b4d6e76fc7f11f28f86f32c908d666ba163427a020630f43f73d0ad2c429a35a6f66bf047eab9
|
7
|
+
data.tar.gz: 421e40fea84d8ed8e18f0f60584d55b21bb540139c6e9c28cfcf5ce8770a3102e6a92d17efe4b44fae4706bc36b9e2d080b036ba9208162ac5efe60e3c04a657
|
data/bin/mushy
CHANGED
data/lib/mushy/builder/api.rb
CHANGED
@@ -80,18 +80,49 @@ module Mushy
|
|
80
80
|
puts "trying to get: #{file}"
|
81
81
|
file = "#{file}.mushy" unless file.downcase.end_with?('.mushy')
|
82
82
|
data = JSON.parse File.open(file).read
|
83
|
-
|
83
|
+
|
84
|
+
data['fluxs'] = standardize_these data['fluxs']
|
85
|
+
data['fluxs'] = organize_as_a_flattened_tree_based_on_parents data['fluxs']
|
86
|
+
|
87
|
+
data
|
88
|
+
rescue
|
89
|
+
{ fluxs: [] }
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.standardize_these fluxs
|
93
|
+
fluxs
|
84
94
|
.reject { |x| x['parents'] }
|
85
95
|
.each { |x| x['parents'] = [x['parent']].select { |y| y } }
|
86
|
-
|
96
|
+
fluxs
|
87
97
|
.select { |x| x['parent'] }
|
88
98
|
.each { |x| x.delete 'parent' }
|
89
|
-
|
99
|
+
fluxs
|
90
100
|
.select { |x| x['parents'] }
|
91
101
|
.each { |x| x['parents'] = x['parents'].select { |y| y } }
|
92
|
-
|
93
|
-
|
94
|
-
|
102
|
+
|
103
|
+
fluxs
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.organize_as_a_flattened_tree_based_on_parents fluxs
|
107
|
+
fluxs = fluxs.sort_by { |x| x['parents'].count }
|
108
|
+
|
109
|
+
new_fluxs = [fluxs.first]
|
110
|
+
|
111
|
+
loop do
|
112
|
+
|
113
|
+
next_fluxs = fluxs.select { |x| x['parents'].include? new_fluxs[-1]['id'] }
|
114
|
+
|
115
|
+
unless next_fluxs.any?
|
116
|
+
next_fluxs = [fluxs.reject { |x| new_fluxs.map { |y| y['id'] }.include?(x['id']) }[0]].select { |x| x }
|
117
|
+
end
|
118
|
+
|
119
|
+
new_fluxs = [new_fluxs, next_fluxs].flatten
|
120
|
+
|
121
|
+
break unless next_fluxs.any?
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
new_fluxs
|
95
126
|
end
|
96
127
|
|
97
128
|
def self.get_fluxs
|
data/lib/mushy/builder/index.rb
CHANGED
@@ -56,25 +56,26 @@ module Mushy
|
|
56
56
|
<div class="columns">
|
57
57
|
<div class="column is-half">
|
58
58
|
<mip-heavy :data="setup"></mip-heavy>
|
59
|
-
<mip-mediumred v-for="(data, id) in configs" v-show="setup.flux.value === id" :data="data" medium="hey"></mip-
|
59
|
+
<mip-mediumred v-for="(data, id) in configs" v-show="setup.flux.value === id" :data="data" medium="hey"></mip-mediumred>
|
60
60
|
</div>
|
61
61
|
<div class="column is-half">
|
62
|
-
<mip-mediumgreen v-for="(data, id) in configs" v-show="setup.flux.value === id" :data="data" medium="hey"></mip-
|
62
|
+
<mip-mediumgreen v-for="(data, id) in configs" v-show="setup.flux.value === id" :data="data" medium="hey"></mip-mediumgreen>
|
63
63
|
|
64
64
|
<div v-bind:class="setup.testResultModal">
|
65
65
|
<div class="modal-background"></div>
|
66
66
|
<div class="modal-card">
|
67
67
|
<header class="modal-card-head">
|
68
|
-
<p class="modal-card-title">
|
68
|
+
<p class="modal-card-title">Test Results</p>
|
69
|
+
<div v-if="results.errorMessage"></div>
|
70
|
+
<div v-else>{{results.length}} result{{results.length == 1 ? "" : "s"}}</div>
|
69
71
|
<button class="delete" aria-label="close" v-on:click.prevent.stop="setup.testResultModal['is-active'] = false"></button>
|
70
72
|
</header>
|
71
73
|
<section class="modal-card-body">
|
72
74
|
<div v-if="results.errorMessage">{{results.errorMessage}}</div>
|
73
|
-
<div v-else>{{results.length}} result{{results.length == 1 ? "" : "s"}}</div>
|
74
75
|
<mip-heavy v-for="data in results" :data="data"></mip-heavy>
|
75
76
|
</section>
|
76
77
|
<footer class="modal-card-foot">
|
77
|
-
<button class="button is-
|
78
|
+
<button class="button is-primary" v-on:click.prevent.stop="setup.testResultModal['is-active'] = false">Done</button>
|
78
79
|
</footer>
|
79
80
|
</div>
|
80
81
|
</div>
|
@@ -398,20 +399,9 @@ module Mushy
|
|
398
399
|
|
399
400
|
for (var key in configs)
|
400
401
|
{
|
401
|
-
configs[key].save = { type: 'button', name: 'Save Changes', foghat: 'free', color: 'is-primary', click: function(config) {
|
402
|
-
saveTheFlux({ app: app, config: config });
|
403
|
-
saveTheFlow({ setup: app.setup, flow: app.flow });
|
404
|
-
app.setup.showFlux = false;
|
405
|
-
}
|
406
|
-
};
|
407
|
-
configs[key].cancel = { type: 'button', name: 'Ignore Changes', foghat: 'free', color: 'is-warning', click: function() {
|
408
|
-
app.setup.showFlux = false;
|
409
|
-
}
|
410
|
-
};
|
411
|
-
|
412
402
|
configs[key].test_event = { type: 'json', value: '{}', default: '{}', medium: 'hey' };
|
413
403
|
|
414
|
-
configs[key].run_test = { type: 'button', name: 'Test Run This Flux', click: function(c, hey) {
|
404
|
+
configs[key].run_test = { type: 'button', name: 'Test Run This Flux', medium: 'hey', color: 'is-link', click: function(c, hey) {
|
415
405
|
var previousName = hey.run_test.name;
|
416
406
|
Vue.set(hey.run_test, 'name', 'Loading');
|
417
407
|
app.results = [];
|
@@ -420,7 +410,7 @@ module Mushy
|
|
420
410
|
the_setup.event = c.test_event;
|
421
411
|
axios.post('/run', { config: c, setup: the_setup })
|
422
412
|
.then(function(r){
|
423
|
-
app.setup.testResultModal
|
413
|
+
Vue.set(app.setup.testResultModal, 'is-active', true);
|
424
414
|
var index = 1;
|
425
415
|
for (var key in r.data.result)
|
426
416
|
{
|
@@ -436,6 +426,18 @@ module Mushy
|
|
436
426
|
Vue.set(hey.run_test, 'name', previousName);
|
437
427
|
});
|
438
428
|
} };
|
429
|
+
|
430
|
+
configs[key].save = { type: 'button', name: 'Save Changes', foghat: 'free', medium: 'hey', color: 'is-primary', click: function(config) {
|
431
|
+
saveTheFlux({ app: app, config: config });
|
432
|
+
saveTheFlow({ setup: app.setup, flow: app.flow });
|
433
|
+
app.setup.showFlux = false;
|
434
|
+
}
|
435
|
+
};
|
436
|
+
configs[key].cancel = { type: 'button', name: 'Ignore Changes', foghat: 'free', medium: 'hey', color: 'is-warning', click: function() {
|
437
|
+
app.setup.showFlux = false;
|
438
|
+
}
|
439
|
+
};
|
440
|
+
|
439
441
|
}
|
440
442
|
|
441
443
|
var loadThisFlux = function(args)
|
data/lib/mushy/fluxs/filter.rb
CHANGED
@@ -21,13 +21,27 @@ module Mushy
|
|
21
21
|
type: 'keyvalue',
|
22
22
|
value: {},
|
23
23
|
},
|
24
|
+
contains: {
|
25
|
+
description: 'Provide key/value pairs that must be contained.',
|
26
|
+
shrink: true,
|
27
|
+
label: 'Contains',
|
28
|
+
type: 'keyvalue',
|
29
|
+
value: {},
|
30
|
+
},
|
31
|
+
notcontains: {
|
32
|
+
description: 'Provide key/value pairs that must NOT be contained.',
|
33
|
+
shrink: true,
|
34
|
+
label: 'Not Contains',
|
35
|
+
type: 'keyvalue',
|
36
|
+
value: {},
|
37
|
+
},
|
24
38
|
},
|
25
39
|
}
|
26
40
|
end
|
27
41
|
|
28
42
|
def process event, config
|
29
43
|
|
30
|
-
differences = [:equal, :notequal]
|
44
|
+
differences = [:equal, :notequal, :contains, :notcontains]
|
31
45
|
.select { |x| config[x].is_a? Hash }
|
32
46
|
.map { |x| config[x].map { |k, v| { m: x, k: k, v1: v } } }
|
33
47
|
.flatten
|
@@ -42,7 +56,7 @@ module Mushy
|
|
42
56
|
def equal a, b
|
43
57
|
[a, b]
|
44
58
|
.map { |x| numeric?(x) ? x.to_f : x }
|
45
|
-
.map { |x| x
|
59
|
+
.map { |x| nice_string x }
|
46
60
|
.group_by { |x| x }
|
47
61
|
.count == 1
|
48
62
|
end
|
@@ -51,10 +65,23 @@ module Mushy
|
|
51
65
|
equal(a, b) == false
|
52
66
|
end
|
53
67
|
|
68
|
+
def contains a, b
|
69
|
+
return false unless b
|
70
|
+
nice_string(b).include? a.downcase
|
71
|
+
end
|
72
|
+
|
73
|
+
def notcontains a, b
|
74
|
+
contains(a, b) == false
|
75
|
+
end
|
76
|
+
|
54
77
|
def numeric? value
|
55
78
|
Float(value) != nil rescue false
|
56
79
|
end
|
57
80
|
|
81
|
+
def nice_string value
|
82
|
+
value.to_s.strip.downcase
|
83
|
+
end
|
84
|
+
|
58
85
|
end
|
59
86
|
|
60
87
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Mushy
|
2
|
+
|
3
|
+
class Stdout < Flux
|
4
|
+
|
5
|
+
def self.details
|
6
|
+
{
|
7
|
+
name: 'Stdout',
|
8
|
+
description: 'Standard Out',
|
9
|
+
config: {
|
10
|
+
message: {
|
11
|
+
description: 'The message to display.',
|
12
|
+
type: 'text',
|
13
|
+
value: '{{message}}',
|
14
|
+
},
|
15
|
+
},
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def process event, config
|
20
|
+
puts config[:message]
|
21
|
+
nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/mushy.gemspec
CHANGED
@@ -4,7 +4,7 @@ require 'mushy/version'
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'mushy'
|
7
|
-
s.version = '0.
|
7
|
+
s.version = '0.15.3'
|
8
8
|
s.date = '2020-11-23'
|
9
9
|
s.summary = 'Process streams of work using common modules.'
|
10
10
|
s.description = 'This tool assists in the creation and processing of workflows.'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mushy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Cauthon
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- lib/mushy/fluxs/sense_hat_led_matrix.rb
|
211
211
|
- lib/mushy/fluxs/simple_python_program.rb
|
212
212
|
- lib/mushy/fluxs/smtp.rb
|
213
|
+
- lib/mushy/fluxs/stdout.rb
|
213
214
|
- lib/mushy/fluxs/times.rb
|
214
215
|
- lib/mushy/fluxs/write_file.rb
|
215
216
|
- lib/mushy/fluxs/write_json.rb
|