class Pod::Command::Blacklist
Attributes
lockfile[R]
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
# File lib/cocoapods-blacklist/command/blacklist.rb, line 32 def initialize(argv) @blacklist = argv.option('config') @warn = argv.flag?('warn') @lockfile_path = argv.shift_argument super end
options()
click to toggle source
Calls superclass method
# File lib/cocoapods-blacklist/command/blacklist.rb, line 25 def self.options [ ['--config=CONFIG', 'Config file or URL for the blacklist'], ['--warn', 'Only warn about use of banned pods'], ].concat(super) end
Public Instance Methods
run()
click to toggle source
# File lib/cocoapods-blacklist/command/blacklist.rb, line 47 def run open(@blacklist) do |f| @blacklist_file = JSON.parse(f.read) end warned = false failed_pods = {} @blacklist_file['pods'].each do |pod| name = pod['name'] if lockfile.pod_names.include? name version = Version.new(lockfile.version(name)) if Requirement.create(pod['versions']).satisfied_by?(version) UI.puts "[!] Validation error: Use of #{name} #{version} for reason: #{pod['reason']}".yellow failed_pods[name] = version warned = true end end end if !warned UI.puts "#{UI.path lockfile.defined_in_file.expand_path} passed blacklist validation".green else failed_pod_string = failed_pods.map { |name, version| "#{name} (#{version})"}.join(", ") unless @warn raise Informative.new("Failed blacklist validation due to use of #{failed_pod_string}") end end end
validate!()
click to toggle source
Calls superclass method
# File lib/cocoapods-blacklist/command/blacklist.rb, line 39 def validate! super @lockfile = @lockfile_path ? Lockfile.from_file(Pathname(@lockfile_path)) : config.lockfile help! 'A lockfile is needed.' unless lockfile help! 'A blacklist file is needed.' unless @blacklist end