Class: Fastlane::Actions::CodepushLoginAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/codepush/actions/codepush_login_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



26
27
28
# File 'lib/fastlane/plugin/codepush/actions/codepush_login_action.rb', line 26

def self.authors
  ['Pranit Harekar']
end

.available_optionsObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fastlane/plugin/codepush/actions/codepush_login_action.rb', line 37

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :login_token,
      env_name: 'APP_CENTER_LOGIN_TOKEN',
      description: "App center login token to access CodePush service, optional if ENV['APP_CENTER_LOGIN_TOKEN'] is set",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :enforce,
      type: TrueClass,
      optional: true,
      default_value: false,
      description: "Enforce logout before login"
    )
  ]
end

.descriptionObject



22
23
24
# File 'lib/fastlane/plugin/codepush/actions/codepush_login_action.rb', line 22

def self.description
  'CodePush login action'
end

.detailsObject



33
34
35
# File 'lib/fastlane/plugin/codepush/actions/codepush_login_action.rb', line 33

def self.details
  'Log in to App Center to access CodePush service. You can pass token via login_token param or set APP_CENTER_LOGIN_TOKEN environment variable. If none were passed your action will be blocked with UI prompt.'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/fastlane/plugin/codepush/actions/codepush_login_action.rb', line 56

def self.is_supported?(platform)
  true
end

.return_valueObject



30
31
# File 'lib/fastlane/plugin/codepush/actions/codepush_login_action.rb', line 30

def self.return_value
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fastlane/plugin/codepush/actions/codepush_login_action.rb', line 7

def self.run(params)
  if params[:enforce] == true
    Helper::CodepushLoginHelper.logout
  end

  unless Helper::CodepushLoginHelper.is_logged_in
    if params[:login_token].instance_of?(String)
      Helper::CodepushLoginHelper.(params[:login_token])
    else
      UI.user_error!('đŸ’¥Missing login_token param')
      UI.message!('Note: You can either pass login_token or set APP_CENTER_LOGIN_TOKEN environment variable')
    end
  end
end