Sha256: d3c923de901234e7ed7884db379f5e9a3f2d4b780be582ffc47e1e6a5f5957d8

Contents?: true

Size: 916 Bytes

Versions: 11

Compression:

Stored size: 916 Bytes

Contents

module Bowline
  class GemDependency
    attr_accessor :lib, :source
    
    def initialize(name, options = {})
      require 'rubygems' unless Object.const_defined?(:Gem)

      if options[:requirement]
        req = options[:requirement]
      elsif options[:version]
        req = Gem::Requirement.create(options[:version])
      else
        req = Gem::Requirement.default
      end

      @dep = Gem::Dependency.new(name, req)
      @lib      = options[:lib]
      @source   = options[:source]
    end
    
    def add_load_paths
    end
    
    def name
      @dep.name.to_s
    end
    
    def requirement
      r = @dep.version_requirements
      (r == Gem::Requirement.default) ? nil : r
    end
    
    def load
      return if @loaded
      require(@lib || name) unless @lib == false
      @loaded = true
    rescue LoadError
      puts $!.to_s
      $!.backtrace.each { |b| puts b }
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
maccman-bowline-0.1.1 lib/bowline/gem_dependency.rb
maccman-bowline-0.1.10 lib/bowline/gem_dependency.rb
maccman-bowline-0.1.2 lib/bowline/gem_dependency.rb
maccman-bowline-0.1.3 lib/bowline/gem_dependency.rb
maccman-bowline-0.1.4 lib/bowline/gem_dependency.rb
maccman-bowline-0.1.6 lib/bowline/gem_dependency.rb
maccman-bowline-0.1.7 lib/bowline/gem_dependency.rb
maccman-bowline-0.1.8 lib/bowline/gem_dependency.rb
maccman-bowline-0.3.0 lib/bowline/gem_dependency.rb
maccman-bowline-0.3.1 lib/bowline/gem_dependency.rb
bowline-0.1.6 lib/bowline/gem_dependency.rb