Skip to content

Commit

Permalink
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/opal.rb
Original file line number Diff line number Diff line change
@@ -34,8 +34,14 @@ def self.append_path(path)
paths << path
end

def self.use_gem(gem_name)
Opal.append_path File.join(Gem::Specification.find_by_name(gem_name).gem_dir, 'lib')
def self.use_gem(gem_name, include_dependecies = true)
spec = Gem::Specification.find_by_name(gem_name)

spec.runtime_dependencies.each do |dependency|
use_gem dependency.name
end if include_dependecies

Opal.append_path File.join(spec.gem_dir, 'lib')
end

# Private, don't add to these directly (use .append_path instead).

0 comments on commit fcbfac5

Please sign in to comment.