Sha256: c25052ae364755bcabaa34529af5fe6ef2b8bd38edc0b935acaf3a04bc4ce4cf
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
require_relative '../../feature/php/merge_exec' module IronWorkerNG module Code module Runtime module PHP include IronWorkerNG::Feature::PHP::MergeExec::InstanceMethods def runtime_bundle(zip) zip.get_output_stream(@dest_dir + '__runner__.php') do |runner| runner.write <<PHP_RUNNER <?php /* #{IronWorkerNG.full_version} */ function getArgs() { global $argv; $args = array('task_id' => null, 'dir' => null, 'payload' => array()); foreach ($argv as $k => $v) { if (empty($argv[$k + 1])) continue; if ($v == '-id') $args['task_id'] = $argv[$k + 1]; if ($v == '-d') $args['dir'] = $argv[$k + 1]; if ($v == '-payload' && file_exists($argv[$k + 1])) { $args['payload'] = file_get_contents($argv[$k + 1]); $parsed_payload = json_decode($args['payload']); if ($parsed_payload != NULL) { $args['payload'] = $parsed_payload; } } } return $args; } function getPayload() { $args = getArgs(); return $args['payload']; } require '#{File.basename(@exec.path)}'; PHP_RUNNER end end def runtime_run_code <<RUN_CODE TERM=dumb php __runner__.php "$@" RUN_CODE end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
iron_worker_ng-0.8.3 | lib/iron_worker_ng/code/runtime/php.rb |
iron_worker_ng-0.8.2 | lib/iron_worker_ng/code/runtime/php.rb |
iron_worker_ng-0.8.0 | lib/iron_worker_ng/code/runtime/php.rb |