Sha256: 066e54ce508301127afbb4103e64379b3dbc11a1233f41b3219e1e3dc107a38e

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

module IronWorkerNG
  module Feature
    module Java
      module MergeJar
        class Feature < IronWorkerNG::Feature::Base
          attr_reader :path

          def initialize(path)
            unless File.exist?(path)
              IronCore::Logger.error 'IronWorkerNG', "Can't find java jar with path='#{path}'"
              raise IronCore::IronError.new("Can't find java jar with path='#{path}'")
            end

            @path = File.expand_path(path)
          end

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

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

            zip.add(File.basename(@path), @path)
          end

          def code_for_classpath
            File.basename(@path)
          end
        end

        module InstanceMethods
          def merge_jar(path)
            IronCore::Logger.info 'IronWorkerNG', "Merging java jar with path='#{path}'"

            @features << IronWorkerNG::Feature::Java::MergeJar::Feature.new(path)
          end

          alias :jar :merge_jar

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iron_worker_ng-0.5.1 lib/iron_worker_ng/feature/java/merge_jar.rb
iron_worker_ng-0.5.0 lib/iron_worker_ng/feature/java/merge_jar.rb
iron_worker_ng-0.4.3 lib/iron_worker_ng/feature/java/merge_jar.rb
iron_worker_ng-0.4.2 lib/iron_worker_ng/feature/java/merge_jar.rb