Sha256: 8fa2ec3ccd42f41bf53aed4a6561eb2c1b8f06b770a5448ce05a54555b0495e8

Contents?: true

Size: 1.49 KB

Versions: 41

Compression:

Stored size: 1.49 KB

Contents

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

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

            @path = path
            @dest = dest + (dest.empty? || dest.end_with?('/') ? '' : '/')
          end

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

            if (not @code.full_remote_build) || (not IronWorkerNG::Fetcher.remote?(rebase(@path)))
              container_add(container, @dest + File.basename(@path), rebase(@path))
            end
          end

          def build_command
            if @code.remote_build_command || @code.full_remote_build
              if @code.full_remote_build && IronWorkerNG::Fetcher.remote?(rebase(@path))
                "dir '#{rebase(@path)}', '#{@dest}'"
              else
                "dir '#{@code.dest_dir}#{@dest}#{File.basename(@path)}', '#{@dest}'"
              end
            else
              nil
            end
          end
        end

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

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

          alias :dir :merge_dir
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
iron_worker_ng-1.6.10 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.6.9 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.6.8 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.6.7 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.6.6 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.6.5 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.6.4 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.6.3 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.6.2 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.6.1 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.5.2 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.5.1 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.5.0 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.4.2 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.4.1 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.4.0 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.3.0 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.2.0 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.1.0 lib/iron_worker_ng/feature/common/merge_dir.rb
iron_worker_ng-1.0.4 lib/iron_worker_ng/feature/common/merge_dir.rb