Skip to content

Instantly share code, notes, and snippets.

@jbgutierrez
Forked from danielmfern/settings_workflows.rb
Created December 19, 2024 11:14
Show Gist options
  • Save jbgutierrez/c0c98085f7ea5866f4254854440e403d to your computer and use it in GitHub Desktop.
Save jbgutierrez/c0c98085f7ea5866f4254854440e403d to your computer and use it in GitHub Desktop.
wfs = [["ac", nil],
["bk",
[{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
{"workflow_id"=>"image-generate-marketplaces-bk",
"conditions"=>
{"m"=>"and",
"g"=>
[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
{"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
{"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
["md",
[{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
{"workflow_id"=>"image-generate-marketplaces-md",
"conditions"=>
{"m"=>"and",
"g"=>
[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
{"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
{"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
["lf",
[{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
{"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
["oy",
[{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
{"workflow_id"=>"image-generate-marketplaces-oy",
"conditions"=>
{"m"=>"and",
"g"=>
[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
{"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
{"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
["pb",
[{"workflow_id"=>"image-generate-widths",
"conditions"=>
{"m"=>"and",
"g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}, {"filename_does_not_match"=>".*.-[aA]19[mM].(mov|MOV|mp4|MP4|jpg|JPG|jpeg|JPEG)"}]}},
{"workflow_id"=>"image-generate-marketplaces-pb",
"conditions"=>
{"m"=>"and",
"g"=>
[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
{"filename_does_not_match"=>".*.-[aA]19[mM].(mov|MOV|mp4|MP4|jpg|JPG|jpeg|JPEG)"},
{"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
{"workflow_id"=>"image-remove-background", "conditions"=>{"m"=>"and", "g"=>[{"filename_matches"=>".*.-[aA]19[mM].(jpg|jpeg|JPG|JPEG)"}]}},
{"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
["st",
[{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
{"workflow_id"=>"image-generate-marketplaces-st",
"conditions"=>
{"m"=>"and",
"g"=>
[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
{"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
{"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
["zh",
[{"workflow_id"=>"image-generate-widths", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]}]}},
{"workflow_id"=>"image-generate-marketplaces-zh",
"conditions"=>
{"m"=>"and",
"g"=>
[{"file_type_in"=>["jpg", "JPG", "jpeg", "JPEG", "png", "PNG"]},
{"filename_does_not_match"=>"M[0-9]{10}-[a-zA-Z]{1,3}[0-9]{0,2}?[a-zA-Z]?_[a-zA-Z]{2}.(jpg|JPG|png|PNG|gif|GIF|webm|WEBM|mp4|MP4|zip|ZIP)"}]}},
{"workflow_id"=>"video-transcoder", "conditions"=>{"m"=>"and", "g"=>[{"file_type_in"=>["mov", "MOV", "MP4", "mp4"]}]}}]],
["za", []]]
Current.user = User.first;
wfs.each do |code, wf|
Current.account = Account.find_by(code: code);
Setting.create!(key: 'workflows', value: wf, notes: 'Workflows to be executed on Amanda')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment