mushy 0.4.0 → 0.4.1

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: 7fdb340186745a43f2930f3b0e60a6538076593f3cb8cf3464fba209ac90d409
4
- data.tar.gz: cbe1b085e5844c4facabd43d5451f6f34b0fc21cba4909460028dd5bab007c5f
3
+ metadata.gz: 78f078fac4fc19b1ee58323ce2ceaed770613dd8c71901a8a9a7f4ba03c5b413
4
+ data.tar.gz: f19bde198e025b8478400fd33bbd8471b688b33b6caac27ae1f78441441bd895
5
5
  SHA512:
6
- metadata.gz: 85af2b856ca023cef5a65fba574b615683b9898c20aea0a87f3aa24c2061382ebfb14eb9a7aee40e6267c7cb34666c12f8c1c939f3a4207a8a7fc90c6114817b
7
- data.tar.gz: 7f21edc8cd3e5f256dc038e16569a402f4d104a81060e08601b65afd325e7c71f2d22e5bdf39b895121034a8551025cbf7db9da62a6d4af1d2724d1ee706247f
6
+ metadata.gz: 6aff2c9d3d21517c385a5d1f5d0464ae37c77f281c32ef3a5f520cd667ad6354399f3be8e589dcd5883e4a8c0c60d321709373dd174dcd27813c77cb99c1958f
7
+ data.tar.gz: cc0c2218bc455af76721edf9f9358828a21a45635c31e4f5b6a049b03c98ba7f83ea2212567426fad6114042d29ccc0a02251ee502be69c16eeeca0763c9cb16
@@ -18,7 +18,7 @@ module Mushy
18
18
  description: 'Run this browser headless.',
19
19
  type: 'boolean',
20
20
  shrink: true,
21
- value: 'true',
21
+ value: '',
22
22
  },
23
23
  timeout: {
24
24
  description: 'The default timeout (in seconds) before closing the browser. Default is 5 seconds.',
@@ -7,11 +7,10 @@ module Mushy
7
7
  details['name'] = 'Screenshot'
8
8
  details['description'] = 'Take a screenshot of the browser.'
9
9
 
10
- details[:config][:path] = {
11
- description: 'The path of the file to save.',
12
- type: 'text',
13
- value: 'picture.jpg',
14
- }
10
+ details[:config].merge!(Mushy::WriteFile.file_saving_config.tap do |x|
11
+ x[x.keys.first][:value] = 'file.jpg'
12
+ end)
13
+
15
14
  details[:config][:quality] = {
16
15
  description: 'The quality of the image, a value beteen 0-100. Only applies to jpg.',
17
16
  type: 'integer',
@@ -33,15 +32,16 @@ module Mushy
33
32
  the_result = input[:result]
34
33
  the_config = input[:config]
35
34
 
35
+ file = Mushy::WriteFile.get_file_from config
36
36
  options = {
37
- path: the_config[:path],
37
+ path: file,
38
38
  full: ['true', ''].include?(the_config[:full].to_s),
39
39
  quality: (the_config[:quality].to_s == '' ? '100' : the_config[:quality]).to_i
40
40
  }
41
41
 
42
42
  the_browser.screenshot options
43
43
 
44
- options
44
+ options.merge the_result
45
45
 
46
46
  end
47
47
 
@@ -6,30 +6,40 @@ module Mushy
6
6
  {
7
7
  name: 'WriteFile',
8
8
  description: 'Write a file.',
9
- config: {
10
- name: {
11
- description: 'The name of the file.',
12
- type: 'text',
13
- value: 'file.csv',
14
- },
15
- directory: {
16
- description: 'The directory in which to write the file. Leave blank for the current directory.',
17
- type: 'text',
18
- value: '',
19
- },
20
- data: {
21
- description: 'The text to write. You can use Liquid templating here to pull data from the event, or write hardcoded data.',
22
- type: 'text',
23
- value: '{{data}}',
24
- },
25
- },
9
+ config: file_saving_config.merge({
10
+ data: {
11
+ description: 'The text to write. You can use Liquid templating here to pull data from the event, or write hardcoded data.',
12
+ type: 'text',
13
+ value: '{{data}}',
14
+ },
15
+ }),
26
16
  }
27
17
  end
28
18
 
29
- def process event, config
30
- file = config[:name]
19
+ def self.file_saving_config
20
+ {
21
+ name: {
22
+ description: 'The name of the file.',
23
+ type: 'text',
24
+ value: 'file.csv',
25
+ },
26
+ directory: {
27
+ description: 'The directory in which to write the file. Leave blank for the current directory.',
28
+ shrink: true,
29
+ type: 'text',
30
+ value: '',
31
+ },
32
+ }
33
+ end
31
34
 
35
+ def self.get_file_from config
36
+ file = config[:name]
32
37
  file = File.join(config[:directory], file) if config[:directory].to_s != ''
38
+ file
39
+ end
40
+
41
+ def process event, config
42
+ file = self.class.get_file_from config
33
43
 
34
44
  File.open(file, 'w') { |f| f.write config[:data] }
35
45
 
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.4.0'
7
+ s.version = '0.4.1'
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.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Cauthon