Class: Fastlane::Apprepo::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/apprepo/runner.rb,
lib/fastlane/plugin/apprepo/helper/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.



9
10
11
12
13
# File 'lib/fastlane/plugin/apprepo/runner.rb', line 9

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.



7
8
9
# File 'lib/fastlane/plugin/apprepo/runner.rb', line 7

def options
  @options
end

Instance Method Details

#download_manifestObject



46
47
48
49
50
51
52
53
# File 'lib/fastlane/plugin/apprepo/runner.rb', line 46

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



65
66
67
68
# File 'lib/fastlane/plugin/apprepo/runner.rb', line 65

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



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/apprepo/runner.rb', line 17

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
    UI.success('Finished the upload to Apprepo.')
  else
    UI.success('Binary upload skipped or no binary available.')
  end

  notify unless options[:notify].nil?
end

#upload_binaryObject

Upload the binary to Apprepo



56
57
58
59
60
61
62
63
# File 'lib/fastlane/plugin/apprepo/runner.rb', line 56

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



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fastlane/plugin/apprepo/runner.rb', line 33

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