Sha256: f860422761364c17c2d24cf123aebec2f73132f984fb2fc4d24fefdef8eb5f33

Contents?: true

Size: 874 Bytes

Versions: 17

Compression:

Stored size: 874 Bytes

Contents

class KeyDependency


  def initialize(attributes={})
    @slug = attributes[:slug]
    @name = attributes.fetch(:as, @slug.titleize)
    @target_versions = attributes.fetch(:target_versions, []).map(&Gem::Version.method(:new))
  end



  attr_reader :slug, :name, :target_versions

  def versions
    @versions ||= KeyDependency.versions_for(self)
  end

  def latest_version
    versions.first
  end

  def to_s
    slug
  end



  def self.all
    @dependency_versions ||= Houston.config.key_dependencies.map do |dependency|
      KeyDependency.new(dependency)
    end
  end



  def self.versions_for(dependency)

    # Right now the only supported dependencies are Ruby Gems
    # In the future, as other kinds of dependencies are supported,
    # we'll support different adapters to fetch their version info
    Rubygems::Gem.new(dependency.slug).versions
  end


end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre app/models/key_dependency.rb
houston-core-0.7.0 app/models/key_dependency.rb
houston-core-0.7.0.beta4 app/models/key_dependency.rb
houston-core-0.7.0.beta3 app/models/key_dependency.rb
houston-core-0.7.0.beta2 app/models/key_dependency.rb
houston-core-0.7.0.beta app/models/key_dependency.rb
houston-core-0.6.3 app/models/key_dependency.rb
houston-core-0.6.2 app/models/key_dependency.rb
houston-core-0.6.1 app/models/key_dependency.rb
houston-core-0.6.0 app/models/key_dependency.rb
houston-core-0.5.6 app/models/key_dependency.rb
houston-core-0.5.5 app/models/key_dependency.rb
houston-core-0.5.4 app/models/key_dependency.rb
houston-core-0.5.3 app/models/key_dependency.rb
houston-core-0.5.2 app/models/key_dependency.rb
houston-core-0.5.1 app/models/key_dependency.rb
houston-core-0.5.0 app/models/key_dependency.rb