Class: Fastlane::Helper::ReleaseVersionHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/release_version/helper/release_version_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ReleaseVersionHelper

Returns a new instance of ReleaseVersionHelper.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fastlane/plugin/release_version/helper/release_version_helper.rb', line 11

def initialize(config)
  require 'deliver'
  self.options = config

  # Check requirements
  has_data = (options[:app_identifier].to_s.length != 0 && options[:app_version].to_s.length != 0)
  has_app = (options[:ipa].to_s.length != 0)
  if !has_data && !has_app
    UI.error("You need to provide an app_identifier and an app_version or a path to an IPA file")
    return
  end

  # Logging into AppStore Connect
  

  # Get app identifier
  UI.message("Getting app identifier")
  Deliver::DetectValues.new.find_app_identifier(options)
  if options[:app_identifier].to_s.length != 0
    UI.success("Found application identifier: #{options[:app_identifier]}")
  else
    UI.error("Could not find an app_identifier")
  end

  # Get app version
  UI.message("Getting app version")
  Deliver::DetectValues.new.find_version(options)
  if options[:app_version].to_s.length != 0
    UI.success("Found application version: #{options[:app_version]}")
  else
    UI.error("Could not find an app_version")
  end

  # Get applications
  UI.message("Find app from AppStore Connect")
  Deliver::DetectValues.new.find_app(options)
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



9
10
11
# File 'lib/fastlane/plugin/release_version/helper/release_version_helper.rb', line 9

def options
  @options
end

Instance Method Details

#loginObject



49
50
51
52
53
54
# File 'lib/fastlane/plugin/release_version/helper/release_version_helper.rb', line 49

def 
  UI.message("Login to App Store Connect (#{options[:username]})")
  Spaceship::Tunes.(options[:username])
  Spaceship::Tunes.select_team
  UI.message("Login successful")
end

#rejectObject

Try to reject the application



71
72
73
74
75
76
77
78
79
80
# File 'lib/fastlane/plugin/release_version/helper/release_version_helper.rb', line 71

def reject
  app = options[:app]
  if app != nil
    if app.reject_version_if_possible!
      UI.success("Successfully rejected previous version!")
    else
      UI.error("Application cannot be rejected")
    end
  end
end

#releaseObject

Try to release the application



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fastlane/plugin/release_version/helper/release_version_helper.rb', line 57

def release
  app = options[:app]
  if app != nil
    begin
      app.release!
    rescue
      UI.error("Failed to release application.")
    else
      UI.success("Successfully released the application")
    end
  end
end