Sha256: 1d118f7d9c1124f567f40313def6ca6d87f958f5f98a7fda93b38d629020505b

Contents?: true

Size: 700 Bytes

Versions: 7

Compression:

Stored size: 700 Bytes

Contents

module GitCompound
  module Worker
    # Worker that detects conflicting dependencies
    #
    class ConflictingDependencyChecker < Worker
      def initialize
        @components = []
      end

      def visit_component(component)
        if conflict_exists?(component)
          raise ConflictingDependencyError,
                "Conflicting dependency detected in component `#{component.name}`!"
        end
        @components << component
      end

      private

      def conflict_exists?(component)
        @components.any? do |other|
          !(component == other && component.version == other.version) &&
            component.path == other.path
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
git_compound-0.2.2 lib/git_compound/worker/conflicting_dependency_checker.rb
git_compound-0.2.1 lib/git_compound/worker/conflicting_dependency_checker.rb
git_compound-0.2.0 lib/git_compound/worker/conflicting_dependency_checker.rb
git_compound-0.1.2 lib/git_compound/worker/conflicting_dependency_checker.rb
git_compound-0.1.1 lib/git_compound/worker/conflicting_dependency_checker.rb
git_compound-0.1.0 lib/git_compound/worker/conflicting_dependency_checker.rb
git_compound-0.0.10 lib/git_compound/worker/conflicting_dependency_checker.rb