Sha256: 64e00fe4bd34d651578dc63810217db81e895245e4affc49f11ba740c51e8790

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

require_relative '../feature/ruby/merge_gem'

module IronWorkerNG
  module Code
    class Builder < IronWorkerNG::Code::Base
      def initialize(*args, &block)
        @features = []
        @fixators = []

        @base_dir = ''
        @dest_dir = ''

        runtime(:ruby)
      end

      def bundle(container)
        @exec = IronWorkerNG::Feature::Ruby::MergeExec::Feature.new(self, '__builder__.rb', nil)

        super(container)

        container.get_output_stream(@dest_dir + '__builder__.sh') do |builder|
          builder.write <<BUILDER_SH
# #{IronWorkerNG.full_version}
#{remote_build_command}
BUILDER_SH
        end

        container.get_output_stream(@dest_dir + '__builder__.rb') do |builder|
          builder.write <<BUILDER_RUBY
# #{IronWorkerNG.full_version}

require 'iron_worker_ng'
require 'json'

exit 1 unless system('cd __build__ && sh ../__builder__.sh && cd ..')

Dir.chdir('__build__')

code = IronWorkerNG::Code::Base.new
code.inside_builder = true

code.name params[:code_name]
code.dir '.'

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

9 entries across 9 versions & 1 rubygems

Version Path
iron_worker_ng-0.10.2 lib/iron_worker_ng/code/builder.rb
iron_worker_ng-0.10.1 lib/iron_worker_ng/code/builder.rb
iron_worker_ng-0.10.0 lib/iron_worker_ng/code/builder.rb
iron_worker_ng-0.9.6 lib/iron_worker_ng/code/builder.rb
iron_worker_ng-0.9.5 lib/iron_worker_ng/code/builder.rb
iron_worker_ng-0.9.4 lib/iron_worker_ng/code/builder.rb
iron_worker_ng-0.9.2 lib/iron_worker_ng/code/builder.rb
iron_worker_ng-0.9.1 lib/iron_worker_ng/code/builder.rb
iron_worker_ng-0.9.0 lib/iron_worker_ng/code/builder.rb