Sha256: a1182ddbaeab194e103a909634d75f0835655639bce97b69d990a2049fe3cf7e
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iron_worker_ng-0.8.4 | lib/iron_worker_ng/code/runtime/php.rb |