Class: Jars::Classpath
- Inherits:
-
Object
- Object
- Jars::Classpath
- Defined in:
- lib/jars/classpath.rb
Constant Summary collapse
- DEPENDENCY_LIST =
'dependencies.list'
Class Method Summary collapse
-
.classpath(scope = nil) ⇒ Object
convenient method.
-
.classpath_string(scope = nil) ⇒ Object
convenient method.
-
.require(scope = nil) ⇒ Object
convenient method.
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
#initialize(spec = nil, deps = nil) ⇒ Classpath
Returns a new instance of Classpath.
24 25 26 27 |
# File 'lib/jars/classpath.rb', line 24 def initialize( spec = nil, deps = nil ) @spec = spec @deps = deps end |
Class Method Details
.classpath(scope = nil) ⇒ Object
convenient method
15 16 17 |
# File 'lib/jars/classpath.rb', line 15 def self.classpath( scope = nil ) new.classpath( scope ) end |
.classpath_string(scope = nil) ⇒ Object
convenient method
20 21 22 |
# File 'lib/jars/classpath.rb', line 20 def self.classpath_string( scope = nil ) new.classpath_string( scope ) end |
.require(scope = nil) ⇒ Object
convenient method
10 11 12 |
# File 'lib/jars/classpath.rb', line 10 def self.require( scope = nil ) new.require( scope ) end |
Instance Method Details
#classpath(scope = nil) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/jars/classpath.rb', line 75 def classpath( scope = nil ) classpath = [] process( scope ) do |jar| classpath << jar.file end classpath end |
#classpath_string(scope = nil) ⇒ Object
92 93 94 |
# File 'lib/jars/classpath.rb', line 92 def classpath_string( scope = nil ) classpath( scope ).join( File::PATH_SEPARATOR ) end |
#mvn ⇒ Object
29 30 31 |
# File 'lib/jars/classpath.rb', line 29 def mvn @mvn ||= MavenExec.new( @spec ) end |
#require(scope = nil) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/jars/classpath.rb', line 60 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 |
#workdir(dirname) ⇒ Object
33 34 35 36 |
# File 'lib/jars/classpath.rb', line 33 def workdir( dirname ) dir = File.join( mvn.basedir, dirname ) dir if File.directory?( dir ) end |