Sha256: 4240ff239d00634a1cb118a6dcf2bc5110bfd15f4edf1196b6731f43fc243a63

Contents?: true

Size: 965 Bytes

Versions: 4

Compression:

Stored size: 965 Bytes

Contents

require 'fileutils'

module IronWorkerNG
  module Feature
    class Base
      def initialize(code)
        @code = code
      end

      def rebase(path)
        @code.base_dir + path
      end

      def zip_add(zip, dest, src)
        new_src, clean = IronWorkerNG::Fetcher.fetch(src, true)

        new_src = File.expand_path(new_src) unless new_src.nil?

        if new_src.nil? || (not File.exists?(new_src))
          IronCore::Logger.error 'IronWorkerNG', "Can't find src with path='#{src}'", IronCore::Error
        end

        src = new_src

        if File.directory?(src)
          Dir.glob(src + '/**/**') do |path|
            zip.add(@code.dest_dir + dest + path[src.length .. -1], path)
          end
        else
          zip.add(@code.dest_dir + dest, src)
        end

        unless clean.nil?
          FileUtils.rm_f(clean)
        end
      end

      def hash_string
        ''
      end

      def bundle(zip)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iron_worker_ng-0.8.4 lib/iron_worker_ng/feature/base.rb
iron_worker_ng-0.8.3 lib/iron_worker_ng/feature/base.rb
iron_worker_ng-0.8.2 lib/iron_worker_ng/feature/base.rb
iron_worker_ng-0.8.0 lib/iron_worker_ng/feature/base.rb