class Crep::AppController

Public Class Methods

new(app_source, identifier, version, build, versions_limit) click to toggle source
# File lib/crep/app_controller.rb, line 5
def initialize(app_source, identifier, version, build, versions_limit)
  @identifier = identifier&.downcase
  @version = version
  @build = build
  @versions_limit = versions_limit

  @app_source = app_source
  @app_source.configure
end
versions_as_string_list(versions, limit) click to toggle source
# File lib/crep/app_controller.rb, line 43
def self.versions_as_string_list(versions, limit)
  versions.first(limit).map do |v|
    "#{v.version} (#{v.build})"
  end
end

Public Instance Methods

app_versions_as_string_list(app_identifier) click to toggle source
# File lib/crep/app_controller.rb, line 31
def app_versions_as_string_list(app_identifier)
  versions = @app_source.versions(app_identifier)

  filtered_versions = versions.select do |v|
    version_match = @version ? v.version == @version : true
    build_match = @build ? v.build == @build : true
    version_match && build_match
  end

  AppController.versions_as_string_list(filtered_versions, @versions_limit)
end
apps() click to toggle source
# File lib/crep/app_controller.rb, line 15
def apps
  filtered_apps = @app_source.apps.select do |app|
    @identifier ? app.bundle_identifier.downcase == @identifier : true
  end
  filtered_apps.each do |app|
    report_app(app.public_identifier, app.title)
  end
end
report_app(identifier, title) click to toggle source
# File lib/crep/app_controller.rb, line 24
def report_app(identifier, title)
  puts "\n\t\t" + title
  app_versions_as_string_list(identifier).each do |version_string|
    puts "\t\t#{version_string}"
  end
end