Sha256: 602a3e93ce6c80103918b3bd88b5b454308489c2411ad8d11bdebe0f5df3f58a
Contents?: true
Size: 1.94 KB
Versions: 1
Compression:
Stored size: 1.94 KB
Contents
require_relative '../feature/ruby/merge_gem' module IronWorkerNG module Code class Builder < IronWorkerNG::Code::Base attr_accessor :builder_remote_build_command def initialize(*args, &block) @features = [] @fixators = [] @base_dir = '' @dest_dir = '' @remote_build_command = nil @full_remote_build = false runtime(:ruby) end def bundle(container, local = false) @exec = IronWorkerNG::Feature::Common::MergeExec::Feature.new(self, '__builder__.rb', {}) super(container, local) if builder_remote_build_command container.get_output_stream(@dest_dir + '__builder__.sh') do |builder| builder.write <<BUILDER_SH # #{IronWorkerNG.full_version} #{builder_remote_build_command} BUILDER_SH end end container.get_output_stream(@dest_dir + '__builder__.rb') do |builder| builder.write <<BUILDER_RUBY # #{IronWorkerNG.full_version} require 'json' File.open('.gemrc', 'w') do |gemrc| gemrc.puts('gem: --no-ri --no-rdoc') end puts `gem install iron_worker_ng -v #{IronWorkerNG::VERSION}` require 'iron_worker_ng' IronWorkerNG::Feature::Ruby::MergeGem.merge_binary = true code = IronWorkerNG::Code::Base.new(params[:code_name]) if File.exists?('__builder__.sh') pre_build_list = Dir.glob('__build__/**/**') exit 1 unless system('cd __build__ && sh ../__builder__.sh && cd ..') post_build_list = Dir.glob('__build__/**/**') (post_build_list.sort - pre_build_list.sort).each do |new_file| code.file(new_file, File.dirname(new_file[10 .. -1])) if File.file?(new_file) end end code.install(true) require 'bundler/setup' client = IronWorkerNG::Client.new(JSON.parse(params[:client_options])) res = client.codes.create(code, JSON.parse(params[:codes_create_options])) client.tasks.set_progress(iron_task_id, :msg => res.marshal_dump.to_json) BUILDER_RUBY end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iron_worker_ng-0.13.1 | lib/iron_worker_ng/code/builder.rb |