module ConcourseObjects::Resources

Public Class Methods

find(name) click to toggle source
# File lib/concourse-objects/resources.rb, line 92
def self.find(name)
  named_resources.find do |resource|
    name === resource.const_get(:RESOURCE_NAME)
  end
end
licensed(license) click to toggle source
# File lib/concourse-objects/resources.rb, line 104
def self.licensed(license)
  licensed_resources.select do |resource|
    license === resource.const_get(:RESOURCE_LICENSE)
  end
end
licensed_resources() click to toggle source
# File lib/concourse-objects/resources.rb, line 86
def self.licensed_resources
  resources.select do |resource|
    resource.const_defined?(:RESOURCE_LICENSE)
  end
end
licenses() click to toggle source
# File lib/concourse-objects/resources.rb, line 110
def self.licenses
  resources.group_by do |resource|
    resource.const_get(:RESOURCE_LICENSE) if resource.const_defined?(:RESOURCE_LICENSE)
  end.sort_by do |key, value|
    value.count
  end.reverse.to_h
end
named(name) click to toggle source
# File lib/concourse-objects/resources.rb, line 98
def self.named(name)
  named_resources.select do |resource|
    name === resource.const_get(:RESOURCE_NAME)
  end
end
named_resources() click to toggle source
# File lib/concourse-objects/resources.rb, line 80
def self.named_resources
  resources.select do |resource|
    resource.const_defined?(:RESOURCE_NAME)
  end
end
owned_by(owner) click to toggle source
# File lib/concourse-objects/resources.rb, line 126
def self.owned_by(owner)
  owned_resources.select do |resource|
    owner === resource.const_get(:GITHUB_OWNER)
  end
end
owned_resources() click to toggle source
# File lib/concourse-objects/resources.rb, line 74
def self.owned_resources
  resources.select do |resource|
    resource.const_defined?(:GITHUB_OWNER)
  end
end
owners() click to toggle source
# File lib/concourse-objects/resources.rb, line 118
def self.owners
  resources.group_by do |resource|
    resource.const_get(:GITHUB_OWNER) if resource.const_defined?(:GITHUB_OWNER)
  end.sort_by do |key, value|
    value.count
  end.reverse.to_h
end
resources() click to toggle source
# File lib/concourse-objects/resources.rb, line 68
def self.resources
  constants(false).map do |constant|
    const_get(constant)
  end
end