Class: Jars::Classpath
- Inherits:
-
Object
- Object
- Jars::Classpath
- Defined in:
- lib/jars/classpath.rb
Constant Summary collapse
- DEPENDENCY_LIST =
'dependencies.list'
Instance Method Summary collapse
- #classpath(scope = nil) ⇒ Object
- #classpath_string(scope = nil) ⇒ Object
-
#initialize(spec = nil, deps = nil) ⇒ Classpath
constructor
A new instance of Classpath.
- #mvn ⇒ Object
- #require(scope = nil) ⇒ Object
- #workdir(dirname) ⇒ Object
Constructor Details
permalink #initialize(spec = nil, deps = nil) ⇒ Classpath
Returns a new instance of Classpath.
9 10 11 12 |
# File 'lib/jars/classpath.rb', line 9 def initialize( spec = nil, deps = nil ) @spec = spec @deps = deps end |
Instance Method Details
permalink #classpath(scope = nil) ⇒ Object
[View source]
56 57 58 59 60 61 62 |
# File 'lib/jars/classpath.rb', line 56 def classpath( scope = nil ) classpath = [] process( scope ) do |jar| classpath << jar.file end classpath end |
permalink #classpath_string(scope = nil) ⇒ Object
[View source]
72 73 74 |
# File 'lib/jars/classpath.rb', line 72 def classpath_string( scope = nil ) classpath( scope ).join( File::PATH_SEPARATOR ) end |
permalink #mvn ⇒ Object
[View source]
14 15 16 |
# File 'lib/jars/classpath.rb', line 14 def mvn @mvn ||= MavenExec.new( @spec ) end |
permalink #require(scope = nil) ⇒ Object
[View source]
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/jars/classpath.rb', line 41 def require( scope = nil ) process( scope ) do |jar| if jar.scope == :system Kernel.require jar.path else require_jar( *jar.gacv ) end end if scope == nil || scope == :runtime process( :provided ) do |jar| Jars.mark_as_required( *jar.gacv ) end end end |
permalink #workdir(dirname) ⇒ Object
[View source]
18 19 20 21 |
# File 'lib/jars/classpath.rb', line 18 def workdir( dirname ) dir = File.join( mvn.basedir, dirname ) dir if File.directory?( dir ) end |