Sha256: 729882f871969016317f6cbea74c8045ab9219531fce7f2ce4f36896076adca1

Contents?: true

Size: 1.36 KB

Versions: 13

Compression:

Stored size: 1.36 KB

Contents

module IronWorkerNG
  module Feature
    module Node
      module MergeExec
        class Feature < IronWorkerNG::Feature::Base
          attr_reader :path

          def initialize(code, path)
            super(code)

            @path = path
          end

          def hash_string
            Digest::MD5.hexdigest(@path + File.mtime(rebase(@path)).to_i.to_s)
          end

          def bundle(zip)
            IronCore::Logger.debug 'IronWorkerNG', "Bundling node exec with path='#{@path}'"

            zip_add(zip, File.basename(@path), rebase(@path))
          end
        end

        module InstanceMethods
          def merge_exec(path)
            @exec ||= nil 

            unless @exec.nil?
              IronCore::Logger.warn 'IronWorkerNG', "Ignoring attempt to merge node exec with path='#{path}'"
              return
            end

            @exec = IronWorkerNG::Feature::Node::MergeExec::Feature.new(self, path)

            IronCore::Logger.info 'IronWorkerNG', "Merging node exec with path='#{path}'"

            @features << @exec
          end

          alias :exec :merge_exec

          alias :merge_worker :merge_exec
          alias :worker :merge_worker

          def self.included(base)
            IronWorkerNG::Code::Base.register_feature(:name => 'merge_exec', :for_klass => base, :args => 'PATH')
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
iron_worker_ng-0.7.4 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.7.3 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.7.2 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.7.1 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.7.0 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.6.8 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.6.7 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.6.6 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.6.5 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.6.4 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.6.3 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.6.2 lib/iron_worker_ng/feature/node/merge_exec.rb
iron_worker_ng-0.6.1 lib/iron_worker_ng/feature/node/merge_exec.rb