class JavaClass::Classpath::ConventionClasspath

A Java project by naming convention, contains a classes and a lib folder.

Author

Peter Kofler

Constants

CLASSES

Public Class Methods

new(folder) click to toggle source

Create a classpath for folder / classes.

Calls superclass method
# File lib/javaclass/classpath/convention_classpath.rb, line 20
def initialize(folder)
  super(File.join(folder, CLASSES))
  @root = folder
end
valid_location?(file) click to toggle source

Check if the file is a valid location.

# File lib/javaclass/classpath/convention_classpath.rb, line 14
def self.valid_location?(file)
  FolderClasspath.valid_location?(file) &&
  FolderClasspath.valid_location?(File.join(file, CLASSES))
end

Public Instance Methods

additional_classpath() click to toggle source

Return list of additional classpath elements defined in the lib folder.

# File lib/javaclass/classpath/convention_classpath.rb, line 26
def additional_classpath
  lib = File.join(@root, 'lib')
  if FolderClasspath.valid_location?(lib)
    Dir.entries(lib).map { |e| File.join(lib, e) }.find_all { |e| JarClasspath.valid_location?(e) }
  else
    []
  end
end