Class: Crep::Apps

Inherits:
Command
  • Object
show all
Defined in:
lib/crep/command/apps.rb

Constant Summary collapse

DEFAULT_VERSIONS_LIMIT =

options should accept app name and version filter

5

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Apps


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/crep/command/apps.rb', line 29

def initialize(argv)
  super

  @versions_limit = argv.option('versions') || DEFAULT_VERSIONS_LIMIT
  CrepLogger.info("Versions will be limited to #{@versions_limit} per app")

  @identifier = argv.option('identifier')
  CrepLogger.info("Apps will be filtered by identifier: #{@identifier}") if @identifier

  @version = argv.option('version')
  CrepLogger.info("Version will be filtered: #{@version}") if @version

  @build = argv.option('build')
  CrepLogger.info("Build will be filtered: #{@build}") if @build
end

Class Method Details

.optionsObject


12
13
14
15
16
17
18
19
# File 'lib/crep/command/apps.rb', line 12

def self.options
  [
    ['--identifier=<com.company.app>', 'Crep will show app information with this identifier.'],
    ['--version=<7.10.0>', 'An optional filter for the version of an app.'],
    ['--build=<24>', 'An optional filter for the build of an app.'],
    ['--versions=5', "If set, Crep will limit the number of displayed versions per app. #{DEFAULT_VERSIONS_LIMIT} by default."]
  ].concat(super)
end

Instance Method Details

#runObject


45
46
47
48
49
50
51
# File 'lib/crep/command/apps.rb', line 45

def run
  CrepLogger.info('Reporting apps:')

  app_source = HockeyAppAppSource.new
  app_controller = AppController.new(app_source, @identifier, @version, @build, @versions_limit.to_i)
  app_controller.apps
end