Sha256: 8991b3912358c9bcfee1db42065c2f933a8934479694c415819a08af14b93d00

Contents?: true

Size: 962 Bytes

Versions: 164

Compression:

Stored size: 962 Bytes

Contents

require "danger/plugin_support/gems_resolver"

module Danger
  class PluginFileResolver
    # Takes an array of files, gems or nothing, then resolves them into
    # paths that should be sent into the documentation parser
    def initialize(references)
      @refs = references
    end

    # When given existing paths, map to absolute & existing paths
    # When given a list of gems, resolve for list of gems
    # When empty, imply you want to test the current lib folder as a plugin
    def resolve
      if !refs.nil? and refs.select { |ref| File.file? ref }.any?
        paths = refs.select { |ref| File.file? ref }.map { |path| File.expand_path(path) }
      elsif refs and refs.kind_of? Array
        paths, gems = GemsResolver.new(refs).call
      else
        paths = Dir.glob(File.join(".", "lib/**/*.rb")).map { |path| File.expand_path(path) }
      end

      { paths: paths, gems: gems || [] }
    end

    private

    attr_reader :refs
  end
end

Version data entries

164 entries across 164 versions & 2 rubygems

Version Path
danger-additional-logging-0.0.23 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.22 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.21 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.20 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.19 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.18 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.17 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.16 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.15 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.14 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.13 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.12 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.11 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.10 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.9 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.8 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.7 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.6 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.5 lib/danger/plugin_support/plugin_file_resolver.rb
danger-additional-logging-0.0.4 lib/danger/plugin_support/plugin_file_resolver.rb