Skip to content

Instantly share code, notes, and snippets.

@LBRapid
Created April 30, 2014 20:20
Show Gist options
  • Save LBRapid/11437277 to your computer and use it in GitHub Desktop.
Save LBRapid/11437277 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
$stdout.sync = true
require File.join(File.expand_path('../..', __FILE__), %w[lib falkor])
puts 'You should not run this command with any worker running. Are all workers stopped [y/n]?'
exit 0 unless 'y' == gets.chomp.downcase
puts 'Update all legacy transforms [y/n]?'
def update_legacy_transforms_for_flow(flow)
return if flow.tranforms.empty?
new_transforms = []
flow.transforms.each do |transform|
transform.source = transform.source.to_s.prepend("//nomustache\r\n")
new_transforms << transform
end
flow.transforms = new_transforms
flow.save
puts "Successfully migrated transforms for flow #{flow.name}!"
end
if 'y' == gets.chomp.downcase
Flow.unscoped.all.each { |flow| update_legacy_transforms_for_flow(flow) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment