Sha256: ef7e1a1ffdf802bc789a991cd949885b5e833fe77c5a0c13b5f54cd18d7d4e61

Contents?: true

Size: 925 Bytes

Versions: 8

Compression:

Stored size: 925 Bytes

Contents

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

          def initialize(path, dest)
            @path = File.expand_path(path)
            @dest = dest
          end

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

          def bundle(zip)
            zip.add(@dest + File.basename(@path), @path)
          end
        end

        module InstanceMethods
          def merge_file(path, dest = '')
            @features << IronWorkerNG::Feature::Common::MergeFile::Feature.new(path, dest)
          end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
iron_worker_ng-0.1.14 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.1.13 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.1.12 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.1.11 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.1.10 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.1.9 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.1.8 lib/iron_worker_ng/feature/common/merge_file.rb
iron_worker_ng-0.1.7 lib/iron_worker_ng/feature/common/merge_file.rb