-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
monkstone
committed
Feb 20, 2015
1 parent
64585c6
commit fb3fe74
Showing
3 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
|
||
class LibraryLoader | ||
attr_reader :libraries_path | ||
|
||
def initialize | ||
p "init LibraryLoader" | ||
@libraries_path = "#{ENV['HOME']}/.jruby_art/libraries" | ||
@loaded_libraries = Hash.new(false) | ||
end | ||
|
||
# Load a list of Ruby or Java libraries (in that order) | ||
# Usage: load_libraries :opengl, :boids | ||
# | ||
# If a library is put into a 'library' folder next to the sketch it will | ||
# be used instead of the library that ships with Ruby-Processing. | ||
def load_libraries(*args) | ||
installed_java_lib(*args) | ||
end | ||
end | ||
alias_method :load_library, :load_libraries | ||
|
||
|
||
|
||
def installed_java_lib(*args) | ||
libraries = "#{ENV['HOME']}/.jruby_art/libraries/" | ||
args.each do |arg| | ||
lib = File.join(libraries, arg.to_s) | ||
jar_files = File.join(lib, '**', '*.jar') | ||
Dir.glob(jar_files).each do |jar| | ||
require jar | ||
end | ||
end | ||
end | ||
end |