Class: Fastlane::Actions::AppliveryAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



47
48
49
# File 'lib/fastlane/plugin/applivery/actions/applivery_action.rb', line 47

def self.authors
  ["Alejandro Jimenez"]
end

.available_optionsObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/fastlane/plugin/applivery/actions/applivery_action.rb', line 51

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :app_id,
      env_name: "APPLIVERY_APP_ID",
      description: "Your application identifier",
      optional: false,
      type: String),

    FastlaneCore::ConfigItem.new(key: :api_key,
      env_name: "APPLIVERY_API_KEY",
      description: "Your developer key",
      optional: false,
      type: String),

    FastlaneCore::ConfigItem.new(key: :name,
      env_name: "APPLIVERY_BUILD_NAME",
      description: "Your build name",
      optional: true,
      type: String),

    FastlaneCore::ConfigItem.new(key: :notes,
      env_name: "APPLIVERY_BUILD_NOTES",
      description: "Your build notes",
      default_value: "Uploaded automatically with fastlane plugin",
      optional: true,
      type: String),

    FastlaneCore::ConfigItem.new(key: :tags,
      env_name: "APPLIVERY_BUILD_TAGS",
      description: "Your build tags",
      optional: true,
      type: String),

    FastlaneCore::ConfigItem.new(key: :build_path,
      env_name: "APPLIVERY_BUILD_PATH",
      description: "Your build path",
      default_value: self.build_path,
      optional: true,
      type: String),

    FastlaneCore::ConfigItem.new(key: :notify,
      env_name: "APPLIVERY_NOTIFY",
      description: "Send an email to your users",
      default_value: true,
      optional: true,
      is_string: false),

    FastlaneCore::ConfigItem.new(key: :autoremove,
      env_name: "APPLIVERY_AUTOREMOVE",
      description: "Automatically remove your application's oldest build",
      default_value: true,
      optional: true,
      is_string: false)
  ]
end

.build_pathObject



33
34
35
36
37
38
39
40
41
# File 'lib/fastlane/plugin/applivery/actions/applivery_action.rb', line 33

def self.build_path
  platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]

  if platform == :ios
    return Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
  else
    return Actions.lane_context[Actions::SharedValues::GRADLE_APK_OUTPUT_PATH]
  end
end

.categoryObject



115
116
117
# File 'lib/fastlane/plugin/applivery/actions/applivery_action.rb', line 115

def self.category
  :beta
end

.descriptionObject



43
44
45
# File 'lib/fastlane/plugin/applivery/actions/applivery_action.rb', line 43

def self.description
  "Upload new build to Applivery"
end

.example_codeObject



119
120
121
122
123
124
125
# File 'lib/fastlane/plugin/applivery/actions/applivery_action.rb', line 119

def self.example_code
  [
    'applivery(
      app_id: "YOUR_APP_ID",
      api_key: "YOUR_APP_SECRET")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


107
108
109
110
111
112
113
# File 'lib/fastlane/plugin/applivery/actions/applivery_action.rb', line 107

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  
  [:ios, :android].include?(platform)
  true
end

.run(params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fastlane/plugin/applivery/actions/applivery_action.rb', line 5

def self.run(params)
  app_id = params[:app_id]
  api_key = params[:api_key]
  name = params[:name]
  notes = params[:notes]
  tags = params[:tags]
  build_path = params[:build_path]
  notify = params[:notify]
  autoremove = params[:autoremove]
  os = Helper::AppliveryHelper.platform

  command = "curl \"https://dashboard.applivery.com/api/builds\""
  command += " -H \"Authorization: #{api_key}\""
  command += " -F app=\"#{app_id}\""
  command += " -F versionName=\"#{name}\""
  command += " -F notes=\"#{notes}\""
  command += " -F notify=#{notify}"
  command += " -F autoremove=#{autoremove}"
  command += " -F os=#{os}"
  command += " -F tags=\"#{tags}\""
  command += " -F deployer=fastlane"
  command += " -F package=@\"#{build_path}\""
  command += Helper::AppliveryHelper.add_integration_number
  command += Helper::AppliveryHelper.add_git_params

  Actions.sh(command)
end