Skip to content

Commit

Permalink
Opal.use_gem now loads runtime dependencies by default
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Oct 8, 2013
1 parent e5def5e commit fcbfac5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/opal.rb
Expand Up @@ -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).
Expand Down

0 comments on commit fcbfac5

Please sign in to comment.