mushy 0.0.1 → 0.0.2

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.
@@ -10,26 +10,25 @@ module Mushy
10
10
  name: {
11
11
  description: 'The name of the file.',
12
12
  type: 'text',
13
- value: 'records',
13
+ value: 'file.csv',
14
14
  },
15
15
  directory: {
16
16
  description: 'The directory in which to write the file. Leave blank for the current directory.',
17
17
  type: 'text',
18
- value: 'records',
18
+ value: '',
19
19
  },
20
- path: {
21
- description: 'The path to the data to write.',
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
22
  type: 'text',
23
- value: 'records',
23
+ value: '{{data}}',
24
24
  },
25
25
  },
26
26
  }
27
27
  end
28
28
 
29
29
  def process event, config
30
- data = event[config[:path].to_sym] || event[config[:path].to_s]
31
30
 
32
- File.open(config[:name], 'w') { |f| f.write data }
31
+ File.open(config[:name], 'w') { |f| f.write config[:data] }
33
32
 
34
33
  {}
35
34
  end
@@ -2,53 +2,49 @@ require 'sinatra'
2
2
 
3
3
  require_relative 'mushy'
4
4
 
5
+ the_file = 'hey.json'
6
+
5
7
  get '/' do
6
- File.read(File.join(File.dirname(__FILE__), 'public', 'index.html'))
8
+ Mushy::Builder::Index.file
9
+ end
10
+
11
+ get '/dark.css' do
12
+ content_type :css
13
+ Mushy::Builder::Dark.file
14
+ end
15
+
16
+ get '/axios.js' do
17
+ content_type :js
18
+ Mushy::Builder::Axios.file
19
+ end
20
+
21
+ get '/vue.js' do
22
+ content_type :js
23
+ Mushy::Builder::Vue.file
24
+ end
25
+
26
+ get '/flow' do
27
+ content_type :json
28
+ Mushy::Builder::Api.get_flow(the_file).to_json
7
29
  end
8
30
 
9
31
  get '/fluxs' do
10
32
  content_type :json
11
- {
12
- fluxs: Mushy::Flux.all.select { |x| x.respond_to? :details }.map do |flux|
13
- details = flux.details
14
- details[:config][:incoming_split] = { type: 'text', description: 'Split an incoming event into multiple events by this key, an each event will be processed independently.' }
15
- details[:config][:outgoing_split] = { type: 'text', description: 'Split an outgoing event into multiple events by this key.' }
16
- details[:config][:merge] = { type: 'text', description: 'A comma-delimited list of fields from the event to carry through. Use * to merge all fields.' }
17
- details[:config][:group] = { type: 'text', description: 'Group events by a field, which is stored in a key. The format is group_by|group_key.' }
18
- details[:config][:limit] = { type: 'integer', description: 'Limit the number of events to this number.' }
19
- details[:config][:join] = { type: 'text', description: 'Join all of the events from this flux into one event, under this name.' }
20
- details[:config][:sort] = { type: 'text', description: 'Sort by this key.' }
21
- details[:config][:model] = { type: 'keyvalue', description: 'Reshape the outgoing events.', value: {} }
22
-
23
- details[:config]
24
- .select { |_, v| v[:type] == 'keyvalue' }
25
- .select { |_, v| v[:editors].nil? }
26
- .each do |_, v|
27
- v[:editors] = [
28
- { id: 'new_key', target: 'key', field: { type: 'text', value: '', default: '' } },
29
- { id: 'new_value', target: 'value', field: { type: 'text', value: '', default: '' } }
30
- ]
31
- end
32
-
33
- details
34
- end
35
- }.to_json
33
+ Mushy::Builder::Api.get_fluxs.to_json
36
34
  end
37
35
 
38
36
  post '/run' do
39
37
  content_type :json
40
38
 
41
- data = SymbolizedHash.new JSON.parse(request.body.read)
42
-
43
- event = SymbolizedHash.new JSON.parse(data[:setup][:event].to_json)
44
-
45
- config = SymbolizedHash.new data[:config]
39
+ result = Mushy::Builder::Api.run request.body.read
46
40
 
47
- flux = Mushy::Flow.build_flux( { type: data[:setup][:flux], config: config } )
41
+ { result: result }.to_json
42
+ end
48
43
 
49
- result = flux.execute event
44
+ post '/save' do
45
+ content_type :json
50
46
 
51
- result = [result].flatten
47
+ result = Mushy::Builder::Api.save the_file, request.body.read
52
48
 
53
49
  { result: result }.to_json
54
50
  end
@@ -4,10 +4,10 @@ require 'mushy/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'mushy'
7
- s.version = '0.0.1'
7
+ s.version = '0.0.2'
8
8
  s.date = '2020-11-23'
9
9
  s.summary = 'Process streams of work using common modules.'
10
- s.description = 'Process streams of work using common modules.'
10
+ s.description = 'This tool assists in the creation and processing of workflows.'
11
11
  s.authors = ['Darren Cauthon']
12
12
  s.email = 'darren@cauthon.com'
13
13
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.license = 'MIT'
18
18
 
19
19
  s.add_development_dependency 'minitest'
20
+ s.add_runtime_dependency 'thor'
20
21
  s.add_runtime_dependency 'liquid'
21
22
  s.add_runtime_dependency 'ferrum'
22
23
  s.add_runtime_dependency 'nokogiri'
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.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Cauthon
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: liquid
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +94,7 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
- description: Process streams of work using common modules.
97
+ description: This tool assists in the creation and processing of workflows.
84
98
  email: darren@cauthon.com
85
99
  executables:
86
100
  - mushy
@@ -89,6 +103,11 @@ extra_rdoc_files: []
89
103
  files:
90
104
  - bin/mushy
91
105
  - lib/mushy.rb
106
+ - lib/mushy/builder/api.rb
107
+ - lib/mushy/builder/axios.rb
108
+ - lib/mushy/builder/dark.rb
109
+ - lib/mushy/builder/index.rb
110
+ - lib/mushy/builder/vue.rb
92
111
  - lib/mushy/event.rb
93
112
  - lib/mushy/flow.rb
94
113
  - lib/mushy/flux.rb
@@ -106,7 +125,6 @@ files:
106
125
  - lib/mushy/run.rb
107
126
  - lib/mushy/runner.rb
108
127
  - lib/mushy/version.rb
109
- - lib/public/index.html
110
128
  - lib/site.rb
111
129
  - mushy.gemspec
112
130
  - note.txt