Sha256: 3d0559e79c0fe3873edc0d0af57f951034ff81b62a06c0c466521c01e128034e

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

module IronWorkerNG
  module Code
    module Runtime
      module Node
        include IronWorkerNG::Feature::Common::MergeExec::InstanceMethods

        def runtime_bundle(container, local = false)
          container.get_output_stream(@dest_dir + 'node_modules/node_helper.js') do |runner|
            runner.write <<NODE_RUNNER
/* #{IronWorkerNG.full_version} */

var fs = require('fs');
var params = null;
var task_id = null;
var config = null;

process.argv.forEach(function(val, index, array) {
  if (val == "-payload") {
    params = JSON.parse(fs.readFileSync(process.argv[index + 1], 'utf8'));
  }

  if (val == "-config") {
    config = JSON.parse(fs.readFileSync(process.argv[index + 1], 'utf8'));
  }

  if (val == "-id") {
    task_id = process.argv[index + 1];
  }
});

exports.params = params;
exports.config = config;
exports.task_id = task_id;

NODE_RUNNER
          end
        end

        def runtime_run_code(local = false)
          <<RUN_CODE
node #{File.basename(@exec.path)} "$@"
RUN_CODE
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iron_worker_ng-1.3.0 lib/iron_worker_ng/code/runtime/node.rb
iron_worker_ng-1.2.0 lib/iron_worker_ng/code/runtime/node.rb
iron_worker_ng-1.1.0 lib/iron_worker_ng/code/runtime/node.rb
iron_worker_ng-1.0.4 lib/iron_worker_ng/code/runtime/node.rb
iron_worker_ng-1.0.3 lib/iron_worker_ng/code/runtime/node.rb