Class: JBundler::Vendor

Inherits:
Object
  • Object
show all
Defined in:
lib/jbundler/vendor.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ Vendor

Returns a new instance of Vendor.



4
5
6
# File 'lib/jbundler/vendor.rb', line 4

def initialize( dir )
  @dir = File.expand_path( dir )
end

Instance Method Details

#clearObject



18
19
20
21
22
23
# File 'lib/jbundler/vendor.rb', line 18

def clear
  FileUtils.mkdir_p( @dir )
  Dir[ File.join( @dir, '*' ) ].each do |f|
    FileUtils.rm_f( f )
  end
end

#require_jarsObject



12
13
14
15
16
# File 'lib/jbundler/vendor.rb', line 12

def require_jars
  Dir[ File.join( @dir, '*' ) ].each do |f|
    require f
  end
end

#setup(classpath_file) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/jbundler/vendor.rb', line 25

def setup( classpath_file )
  classpath_file.require_classpath
  FileUtils.mkdir_p( @dir )
  JBUNDLER_CLASSPATH.each do |f|
    FileUtils.cp( f, File.join( @dir,
                                File.basename( f ) ) )
  end
end

#vendored?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/jbundler/vendor.rb', line 8

def vendored?
  File.exists?( @dir ) && Dir[ File.join( @dir, '*' ) ].size > 0
end