mushy 0.1.0 → 0.1.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 +11 -9
- data/lib/mushy/builder/api.rb +9 -0
- data/lib/mushy/flow.rb +3 -1
- data/lib/mushy/flux.rb +1 -0
- data/lib/mushy/fluxs/browser.rb +13 -1
- data/lib/mushy/fluxs/cli.rb +20 -0
- data/lib/mushy/fluxs/filter.rb +23 -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: 5f516df95fc3919dd7d02ffe32228fd96364c06a56595ae8a7e986d406abc3af
|
4
|
+
data.tar.gz: c2dc07c4f8ad462134d674aeb4006eeabff5a07abee0d20d1ec5ff89312f80e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2e8a4bc112300daeb8089a455c10ef7c6842524a0a8dc3a00aa0c8715ecee836eff17f89c461ead76ae4ba716c56e49e436be57e8f163de3a57d8fe8249e816
|
7
|
+
data.tar.gz: ef23272c88796185deb60fd11ad9a326b3dd4a84d2df7aa86830727e72408811eda47a2fb13e59cb481b6a0fb0ad505a7ee4c606cf50b6478e7dc0d7303c0371
|
data/bin/mushy
CHANGED
@@ -3,18 +3,20 @@
|
|
3
3
|
require 'thor'
|
4
4
|
require 'mushy'
|
5
5
|
|
6
|
-
class
|
6
|
+
class MushyCLI < Thor
|
7
|
+
|
8
|
+
argument :file
|
9
|
+
argument :values, optional: true, type: :hash
|
7
10
|
|
8
11
|
desc "start FILE", "Run this workflow file."
|
9
|
-
def start
|
10
|
-
|
11
|
-
puts content
|
12
|
+
def start
|
13
|
+
Mushy::Builder::Api.start file, values
|
12
14
|
end
|
13
15
|
|
14
16
|
desc "build FILE", 'Build a flow.'
|
15
|
-
def build
|
17
|
+
def build
|
16
18
|
|
17
|
-
|
19
|
+
MushyCLI.set_special( { method: 'build', file: file } )
|
18
20
|
|
19
21
|
end
|
20
22
|
|
@@ -28,14 +30,14 @@ class RailsCLI < Thor
|
|
28
30
|
|
29
31
|
end
|
30
32
|
|
31
|
-
|
33
|
+
MushyCLI.start(ARGV)
|
32
34
|
|
33
|
-
exit unless
|
35
|
+
exit unless MushyCLI.get_special
|
34
36
|
|
35
37
|
require 'sinatra'
|
36
38
|
enable :run
|
37
39
|
|
38
|
-
the_file =
|
40
|
+
the_file = MushyCLI.get_special[:file]
|
39
41
|
|
40
42
|
get '/' do
|
41
43
|
Mushy::Builder::Index.file
|
data/lib/mushy/builder/api.rb
CHANGED
@@ -28,6 +28,15 @@ module Mushy
|
|
28
28
|
|
29
29
|
end
|
30
30
|
|
31
|
+
def self.start file, event
|
32
|
+
file = "#{file}.json" unless file.downcase.end_with?('.json')
|
33
|
+
flow = File.open(file).read
|
34
|
+
flow = Mushy::Flow.parse flow
|
35
|
+
flux = flow.fluxs.select { |x| x.type == 'Cli' }.first
|
36
|
+
|
37
|
+
Mushy::Runner.new.start event, flux, flow
|
38
|
+
end
|
39
|
+
|
31
40
|
def self.get_flow file
|
32
41
|
puts "trying to get: #{file}"
|
33
42
|
file = "#{file}.json" unless file.downcase.end_with?('.json')
|
data/lib/mushy/flow.rb
CHANGED
@@ -18,8 +18,10 @@ module Mushy
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.build_flux record
|
21
|
-
|
21
|
+
type = record[:type] || record['type'] || record[:flux] || record['flux'] || 'Flux'
|
22
|
+
flux = Object.const_get("Mushy::#{type}").new
|
22
23
|
flux.id = record[:id] || record['id'] || flux.id
|
24
|
+
flux.type = type
|
23
25
|
flux.config = SymbolizedHash.new(record[:config] || record['config'])
|
24
26
|
flux
|
25
27
|
end
|
data/lib/mushy/flux.rb
CHANGED
data/lib/mushy/fluxs/browser.rb
CHANGED
@@ -20,6 +20,12 @@ module Mushy
|
|
20
20
|
shrink: true,
|
21
21
|
value: 'true',
|
22
22
|
},
|
23
|
+
timeout: {
|
24
|
+
description: 'The default timeout (in seconds) before closing the browser. Default is 5 seconds.',
|
25
|
+
type: 'integer',
|
26
|
+
shrink: true,
|
27
|
+
value: '',
|
28
|
+
},
|
23
29
|
execute: {
|
24
30
|
description: 'Javascript to run after the page is loaded.',
|
25
31
|
type: 'textarea',
|
@@ -74,7 +80,11 @@ module Mushy
|
|
74
80
|
|
75
81
|
def process event, config
|
76
82
|
|
77
|
-
|
83
|
+
timeout = config[:timeout] ? config[:timeout].to_i : 5
|
84
|
+
|
85
|
+
browser = Ferrum::Browser.new(
|
86
|
+
headless: (config[:headless].to_s != 'false'),
|
87
|
+
timeout: timeout)
|
78
88
|
|
79
89
|
get_the_cookies_from(event, config).each { |c| browser.cookies.set(c) }
|
80
90
|
|
@@ -88,6 +98,8 @@ module Mushy
|
|
88
98
|
|
89
99
|
result = {
|
90
100
|
url: browser.url,
|
101
|
+
status: browser.network.status,
|
102
|
+
title: browser.frames[0].title,
|
91
103
|
cookies: browser.cookies.all.map { |k, v| v.instance_variable_get('@attributes') },
|
92
104
|
headers: browser.headers.get,
|
93
105
|
body: browser.body
|
data/lib/mushy/fluxs/filter.rb
CHANGED
@@ -2,6 +2,29 @@ module Mushy
|
|
2
2
|
|
3
3
|
class Filter < Flux
|
4
4
|
|
5
|
+
def self.details
|
6
|
+
{
|
7
|
+
name: 'Filter',
|
8
|
+
description: 'Filters events based on criteria.',
|
9
|
+
config: {
|
10
|
+
equal: {
|
11
|
+
description: 'Provide key/value pairs that must match in the event.',
|
12
|
+
shrink: true,
|
13
|
+
label: 'Equal To',
|
14
|
+
type: 'keyvalue',
|
15
|
+
value: {},
|
16
|
+
},
|
17
|
+
notequal: {
|
18
|
+
description: 'Provide key/value pairs that must NOT match in the event.',
|
19
|
+
shrink: true,
|
20
|
+
label: 'Not Equal To',
|
21
|
+
type: 'keyvalue',
|
22
|
+
value: {},
|
23
|
+
},
|
24
|
+
},
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
5
28
|
def process event, config
|
6
29
|
|
7
30
|
differences = [:equal, :notequal]
|
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.1.
|
7
|
+
s.version = '0.1.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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Cauthon
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/mushy/fluxs/bash.rb
|
143
143
|
- lib/mushy/fluxs/browser.rb
|
144
144
|
- lib/mushy/fluxs/build_csv.rb
|
145
|
+
- lib/mushy/fluxs/cli.rb
|
145
146
|
- lib/mushy/fluxs/collection.rb
|
146
147
|
- lib/mushy/fluxs/filter.rb
|
147
148
|
- lib/mushy/fluxs/format.rb
|