private String addEvidenceFromVersionFile(Dependency dependency, EvidenceType type, File dependencyFile) {
        final File parentDir = dependencyFile.getParentFile();
        String version = null;
        int versionCount = 0;
        if (parentDir != null) {
            final File[] matchingFiles = parentDir.listFiles(new FilenameFilter() {
                @Override
                public boolean accept(File dir, String name) {
                    return name.contains(VERSION_FILE_NAME);
                }
            });
            if (matchingFiles == null) {
                return null;
            }
            for (File f : matchingFiles) {
                try {
                    final List<String> lines = FileUtils.readLines(f, Charset.defaultCharset());
                    if (lines.size() == 1) { //TODO other checking?
                        final String value = lines.get(0).trim();
                        if (version == null || !version.equals(value)) {
                            version = value;
                            versionCount++;
                        }

                        dependency.addEvidence(type, GEMSPEC, "version", value, Confidence.HIGH);
                    }
                } catch (IOException e) {
                    LOGGER.debug("Error reading gemspec", e);
                }
            }
        }
        if (versionCount == 1) {
            return version;
        }
        return null;
    }
private String addEvidenceFromVersionFile ( Dependency dependency , EvidenceType type , File dependencyFile ) { final File parentDir = dependencyFile . getParentFile ( ) ; String version = null ; int versionCount = 0 ; if ( parentDir != null ) { final File [ ] matchingFiles = parentDir . listFiles ( new FilenameFilter ( ) { @ Override public boolean accept ( File dir , String name ) { return name . contains ( VERSION_FILE_NAME ) ; } } ) ; if ( matchingFiles == null ) { return null ; } for ( File f : matchingFiles ) { try { final List < String > lines = FileUtils . readLines ( f , Charset . defaultCharset ( ) ) ; if ( lines . size ( ) == 1 ) { final String value = lines . get ( 0 ) . trim ( ) ; if ( version == null || ! version . equals ( value ) ) { version = value ; versionCount ++ ; } dependency . addEvidence ( type , GEMSPEC , "version" , value , Confidence . HIGH ) ; } } catch ( IOException e ) { LOGGER . debug ( "Error reading gemspec" , e ) ; } } } if ( versionCount == 1 ) { return version ; } return null ; }
Adds evidence from the version file.

@param dependency the dependency being analyzed
@param type the type of evidence to add
@param dependencyFile the dependency being analyzed
@return the version number added