-if node[:lsb][:release].to_f >= 16.04
- apt_source "brightbox-ruby-ng" do
- action :delete
- end
-else
- apt_source "brightbox-ruby-ng" do
- url "http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu"
- key "C3173AA6"
- end
+repository_actions = Hash.new do |_, repository|
+ node[:apt][:sources].include?(repository) ? :add : :remove
+end
+
+apt_repository "brightbox-ruby-ng" do
+ action repository_actions["brightbox-ruby-ng"]
+ uri "ppa:brightbox/ruby-ng"