mushy 0.2.2 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e6ffdfb09e494e5ddbbf2a6dde4c33c2b29a0ac19af467bd00cb77b6f899067
4
- data.tar.gz: 4835fd407a77f62612d629994f323d37d4ea1b8f2053fa10c2b47141898659fe
3
+ metadata.gz: 8c7cd35133c18b25798aa2d8f41b917435e2eb2c766c8bd0798413bd86787d54
4
+ data.tar.gz: 06bf70b427dbb2ae5611cfe6d7fce4f6eff1910b291a768fc22ff6de67dd7330
5
5
  SHA512:
6
- metadata.gz: 236092d1c7ee52ec2f19815cd3e48f90d1178943b02ddfd8c966034599770ad4cadd43dace1ae2a66b960fadd75a5f382911eeb1d7667219d3bc65964d191a75
7
- data.tar.gz: 4e5a52fed081e20c0096ad4e6df08c5c46236776ccb0d4d01a3c69ac1e9244e628525ba8328df2bd201ed711a5afec05d3e41aa2156c279e8b00f2c01ee7ac8b
6
+ metadata.gz: 6b382bab1d6384c96b0c0b3da3e94fb6adb578103b8372509719288dcbb82b2b0e19d9b3a6711ad0dd678ded5af296d527d4142de9bfe2446d7dda464aeaf7ed
7
+ data.tar.gz: 00e17640e86de55782f0876318d8a1c18415c0a8f80f8c2891a79b28ddf7260ee8c199b67d3e78ea6ea7c2f710453df33297ccc10d58caab4bfcc47548c0ccad
@@ -51,10 +51,10 @@ module Mushy
51
51
  ],
52
52
  },
53
53
  carry_cookies_from: {
54
- description: 'Carry the cookies from this path in the event.',
54
+ description: 'Carry the cookies from this path in the event. Defaults to "cookies".',
55
55
  type: 'text',
56
56
  shrink: true,
57
- value: 'cookies',
57
+ value: '',
58
58
  },
59
59
  headers: {
60
60
  description: 'Headers for the web request. These can be received from a previous browser event with {{headers}}, or can be typed manually.',
@@ -63,10 +63,10 @@ module Mushy
63
63
  value: {},
64
64
  },
65
65
  carry_headers_from: {
66
- description: 'Carry the headers from this path in the event.',
66
+ description: 'Carry the headers from this path in the event. Defaults to "headers".',
67
67
  type: 'text',
68
68
  shrink: true,
69
- value: 'headers',
69
+ value: '',
70
70
  },
71
71
  wait_before_closing: {
72
72
  description: 'Wait this many seconds before closing the browser.',
@@ -117,7 +117,8 @@ module Mushy
117
117
  end
118
118
 
119
119
  def get_the_cookies_from event, config
120
- cookies = (event[config[:carry_cookies_from].to_sym])
120
+ carry_cookies_from = config[:carry_cookies_from].to_s == '' ? 'cookies' : config[:carry_cookies_from]
121
+ cookies = event[carry_cookies_from.to_sym]
121
122
  cookies = [] unless cookies.is_a?(Array)
122
123
  config[:cookies] = [] unless config[:cookies].is_a?(Array)
123
124
  config[:cookies].each { |x| cookies << x }
@@ -125,7 +126,8 @@ module Mushy
125
126
  end
126
127
 
127
128
  def get_the_headers_from event, config
128
- headers = (event[config[:carry_headers_from].to_sym])
129
+ carry_headers_from = config[:carry_headers_from].to_s == '' ? 'headers' : config[:carry_headers_from]
130
+ headers = event[carry_headers_from.to_sym]
129
131
  headers = {} unless headers.is_a?(Hash)
130
132
  config[:headers] = {} unless config[:headers].is_a?(Hash)
131
133
  config[:headers].each { |k, v| headers[k] = v }
@@ -4,10 +4,30 @@ module Mushy
4
4
 
5
5
  class ReadCsv < Flux
6
6
 
7
+ def self.details
8
+ {
9
+ name: 'ReadCsv',
10
+ description: 'Read CSV content into events.',
11
+ config: {
12
+ data: {
13
+ description: 'The data to convert to a CSV.',
14
+ type: 'text',
15
+ value: '{{data}}',
16
+ },
17
+ headers: {
18
+ description: 'The CSV contains headers. Defaults to false.',
19
+ type: 'boolean',
20
+ shrink: true,
21
+ value: '',
22
+ },
23
+ },
24
+ }
25
+ end
26
+
7
27
  def process event, config
8
- data = event[config[:key]]
28
+ data = config[:data]
9
29
 
10
- headers = config[:headers].to_s.strip.downcase == 'true' ? true : false
30
+ headers = config[:headers].to_s.strip.downcase == 'true'
11
31
 
12
32
  rows = CSV.new data, headers: headers
13
33
 
@@ -0,0 +1,44 @@
1
+ module Mushy
2
+
3
+ class ReadFile < Flux
4
+
5
+ def self.details
6
+ {
7
+ name: 'ReadFile',
8
+ description: 'Read a file.',
9
+ config: {
10
+ name: {
11
+ description: 'The name of the file to read.',
12
+ type: 'text',
13
+ value: 'file.csv',
14
+ },
15
+ directory: {
16
+ description: 'The directory in which to read the file. Leave blank for the current directory.',
17
+ type: 'text',
18
+ shrink: true,
19
+ value: '',
20
+ },
21
+ path: {
22
+ description: 'The path in the event to return the contents of the file.',
23
+ type: 'text',
24
+ value: 'content',
25
+ },
26
+ },
27
+ }
28
+ end
29
+
30
+ def process event, config
31
+ file = config[:name]
32
+
33
+ file = File.join(config[:directory], file) if config[:directory].to_s != ''
34
+
35
+ content = File.open(file).read
36
+
37
+ {
38
+ config[:path] => content
39
+ }
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -27,12 +27,15 @@ module Mushy
27
27
  end
28
28
 
29
29
  def process event, config
30
+ file = config[:name]
30
31
 
31
- File.open(config[:name], 'w') { |f| f.write config[:data] }
32
+ file = File.join(config[:directory], file) if config[:directory].to_s != ''
33
+
34
+ File.open(file, 'w') { |f| f.write config[:data] }
32
35
 
33
36
  {}
34
37
  end
35
38
 
36
39
  end
37
40
 
38
- end
41
+ 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.2.2'
7
+ s.version = '0.2.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.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Cauthon
@@ -150,6 +150,7 @@ files:
150
150
  - lib/mushy/fluxs/ls.rb
151
151
  - lib/mushy/fluxs/parse_html.rb
152
152
  - lib/mushy/fluxs/read_csv.rb
153
+ - lib/mushy/fluxs/read_file.rb
153
154
  - lib/mushy/fluxs/screenshot.rb
154
155
  - lib/mushy/fluxs/write_file.rb
155
156
  - lib/mushy/masher.rb