Sha256: b385720d85503a5adcea1705e0eb7f7c04dce9d6a575778bd975756fbd3a5136

Contents?: true

Size: 1.6 KB

Versions: 13

Compression:

Stored size: 1.6 KB

Contents

module IronWorkerNG
  module Feature
    module Java
      module MergeExec
        class Feature < IronWorkerNG::Feature::Base
          attr_reader :path
          attr_reader :klass

          def initialize(code, path, klass)
            super(code)

            @path = path
            @klass = klass
          end

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

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

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

          def code_for_classpath
            File.basename(@path)
          end
        end

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

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

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

            IronCore::Logger.info 'IronWorkerNG', "Merging java exec with path='#{path}' and class='#{klass}'"

            @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,CLASS')
          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/java/merge_exec.rb
iron_worker_ng-0.7.3 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.7.2 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.7.1 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.7.0 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.6.8 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.6.7 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.6.6 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.6.5 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.6.4 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.6.3 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.6.2 lib/iron_worker_ng/feature/java/merge_exec.rb
iron_worker_ng-0.6.1 lib/iron_worker_ng/feature/java/merge_exec.rb