-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TreeRewriter::Enforcer #727
base: master
Are you sure you want to change the base?
Conversation
Well, in general I like it (the only thing is that I don't really like half-abstract classes that are partially implemented), but what's important it seems to be a breaking change 😞 . Yes, kwargs of
^ and that's only what I've found by pulling reverse dependencies from rubygems.org (there can be more in non-gem github repos and I have no idea how to check them). I guess we have to keep interface of the constructor. Is it possible to keep it as is and still use a separate class? Also, is this PR only about refactoring? script to pull reverse depsrequire 'open-uri'
require 'json'
require 'fileutils'
ROOT = File.expand_path('', __dir__)
REPOS_ROOT = File.join(ROOT, 'repos')
FileUtils.mkdir_p(REPOS_ROOT)
def get_json(url)
JSON.parse(URI.open(url).read)
rescue
{}
end
def download_gem(gem_name:, gem_uri:)
if File.exists?("repos/#{gem_name}.gem")
puts "Skipping wget repos/#{gem_name}.gem"
else
`wget #{gem_uri} -O repos/#{gem_name}.gem`
end
end
def unpack_gem(gem_name)
if File.directory?("repos/#{gem_name}")
puts "Skipping gem unpack repos/#{gem_name}.gem"
else
`gem unpack repos/#{gem_name}.gem --target repos`
end
end
deps = get_json('https://rubygems.org/api/v1/gems/parser/reverse_dependencies.json')
p deps
deps.sort.each do |gem_name|
gem_info = get_json("https://rubygems.org/api/v1/gems/#{gem_name}.json")
gem_uri = gem_info['gem_uri']
download_gem(gem_name: gem_name, gem_uri: gem_uri)
unpack_gem(gem_name)
end |
I should have been less lazy and document the whole thing; actually, kwargs of Another way to see it is that I could definitely make the base Given these, do you feel this is a worthwhile route? |
Oh, right, I missed that there's still
Yes,
I wasn't referring to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Y)
This PR isolates conflict handling in an
Enforcer
class. A basic implementation with policty of:accept
,:warn
or:raise
and aDiagnosticsEngine
insures compatibility.@iliabylich I didn't update the documentation much, I wanted to know if you thought this was a more worthwhile approach or than #15, or if it overcomplicates things.