Sha256: dfe01f52a731dbe9749efb0245b08f75ad82b44e992ab997556660d9bc889487

Contents?: true

Size: 875 Bytes

Versions: 3

Compression:

Stored size: 875 Bytes

Contents

# encoding: utf-8
module Mutx
  class Execution

    def self.run! execution_request_data

        result = Mutx::Results::Result.new(execution_request_data)
        Mutx::Support::Log.debug "Result created with id => #{result.id}" if Mutx::Support::Log

        Dir.mkdir "#{Dir.pwd}/mutx/out" unless Dir.exist? "#{Dir.pwd}/mutx/out"
        Dir.mkdir "#{Dir.pwd}/mutx/out/#{result.id}/attachment"

        result.save!

        Mutx::Support::Log.debug "Execution type #{result.task_type}" if Mutx::Support::Log
        Mutx::Workers::Executor.perform_async(result.id)
        Mutx::Support::Log.debug "#{result.task_type.capitalize}(#{result.id}) started" if Mutx::Support::Log
        result.id
    end

    def self.attachment_path
      id = ARGV.select{|arg| arg.start_with? "_id="}.first.split("=").last
      "#{Dir.pwd}/mutx/out/#{id}/attachment"
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mutx-0.1.45 lib/mutx/execution.rb
mutx-0.1.44 lib/mutx/execution.rb
mutx-0.1.43 lib/mutx/execution.rb