Sha256: 1387b4b841effc5a799009ffb46eaa4868dc1804261505eb7c7ec22077ae2b03

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 Bytes

Contents

if defined? Gem

  module BBLib

    def self.gem_list
      Gem::Specification.map(&:name).uniq
    end

    def self.gem_installed? name
      BBLib.gem_list.include? name
    end

  end

  # Convenience method that will try to download and install a gem before requiring it
  # only if the gem is not already installed
  def require_gem gem, name = nil
    name = gem if name.nil?
    if !BBLib.gem_installed? name
      return false unless Gem.install gem
    end
    require name
  end



end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bblib-0.3.0 lib/gem/bbgem.rb