Class: AppRepo::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/apprepo/runner.rb

Overview

Responsible for running

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Runner

Returns a new instance of Runner.



8
9
10
11
12
# File 'lib/apprepo/runner.rb', line 8

def initialize(options)
  self.options = options
  AppRepo::DetectValues.new.run!(self.options)
  FastlaneCore::PrintTable.print_values(config: options, hide_keys: [:repo_password], mask_keys: [:repo_key], title: "apprepo-sftp #{AppRepo::VERSION} Summary")
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/apprepo/runner.rb', line 6

def options
  @options
end

Instance Method Details

#download_manifestObject



42
43
44
45
46
47
48
49
# File 'lib/apprepo/runner.rb', line 42

def download_manifest
  if options[:manifest_path]
    uploader = AppRepo::Uploader.new(options)
    result = uploader.download_manifest_only
    msg = 'Metadata download failed. Check out the error above.'
    UI.user_error!(msg) unless result
  end
end

#notifyObject



61
62
63
64
# File 'lib/apprepo/runner.rb', line 61

def notify
  # should be in metadata
  UI.command_output('TODO: Missing implementation for AppRepo Push Notifier')
end

#runObject

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/CyclomaticComplexity



16
17
18
19
20
21
22
23
24
25
# File 'lib/apprepo/runner.rb', line 16

def run
  UI.success('AppRepo SFTP Uploader running...')
  verify_version unless options[:app_version].to_s.empty?
  has_binary = options[:ipa]
  if !options[:skip_binary_upload] && !options[:build_number] && has_binary
    upload_binary
  end
  UI.success('Finished the upload to AppRepo.')
  notify unless options[:notify].nil?
end

#upload_binaryObject

Upload the binary to AppRepo



52
53
54
55
56
57
58
59
# File 'lib/apprepo/runner.rb', line 52

def upload_binary
  if options[:ipa]
    uploader = AppRepo::Uploader.new(options)
    result = uploader.upload
    msg = 'Binary upload failed. Check out the error above.'
    UI.user_error!(msg) unless result
  end
end

#verify_versionObject

Make sure the version on AppRepo matches the one in the ipa If not, the new version will automatically be created



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/apprepo/runner.rb', line 29

def verify_version
  app_version = options[:app_version]
  msg = "TODO: Test if AppRepo matches '#{app_version}' from the IPA..."
  UI.message(msg)

  # changed = options[:app].ensure_version!(app_version)
  # if changed
  #  UI.success("Successfully set the version to '#{app_version}'")
  # else
  #  UI.success("'#{app_version}' is the latest version on AppRepo")
  # end
end