Method: LibGems::DependencyList#ok_to_remove?

Defined in:
lib/libgems/dependency_list.rb

#ok_to_remove?(full_name) ⇒ Boolean

Is is ok to remove a gemspec from the dependency list?

If removing the gemspec creates breaks a currently ok dependency, then it is NOT ok to remove the gemspec.

Returns:

  • (Boolean)


120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/libgems/dependency_list.rb', line 120

def ok_to_remove?(full_name)
  gem_to_remove = find_name full_name

  siblings = @specs.find_all { |s|
    s.name == gem_to_remove.name &&
      s.full_name != gem_to_remove.full_name
  }

  deps = []

  @specs.each do |spec|
    spec.dependencies.each do |dep|
      deps << dep if gem_to_remove.satisfies_requirement?(dep)
    end
  end

  deps.all? { |dep|
    siblings.any? { |s|
      s.satisfies_requirement? dep
    }
  }
end