Sha256: 96642bcd41ed22846e86370d8ccf9e17b99a8598a9601107c50ff6a46ead1dd9

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

require 'pathname'

module IronWorkerNG
  module Feature
    module Common
      module MergeFile
        class Feature < IronWorkerNG::Feature::Base
          attr_reader :path
          attr_reader :dest

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

            @path = path
            @dest = dest
            @dest = Pathname.new(dest).cleanpath.to_s + '/' unless @dest.empty?
          end

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

          def bundle(container)
            IronCore::Logger.debug 'IronWorkerNG', "Bundling file with path='#{@path}' and dest='#{@dest}'"

            container_add(container, @dest + File.basename(@path), rebase(@path))
          end
        end

        module InstanceMethods
          def merge_file(path, dest = '')
            IronCore::Logger.info 'IronWorkerNG', "Merging file with path='#{path}' and dest='#{dest}'"

            @features << IronWorkerNG::Feature::Common::MergeFile::Feature.new(self, path, dest)
          end

          alias :file :merge_file
        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/feature/common/merge_file.rb
iron_worker_ng-0.10.1 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.10.0 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.9.6 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.9.5 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.9.4 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.9.2 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.9.1 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.9.0 lib/iron_worker_ng/feature/common/merge_file.rb