Class: Fastlane::Actions::RavenAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



35
36
37
# File 'lib/fastlane/plugin/raven/actions/raven_action.rb', line 35

def self.authors
  ["Marten Klitzke"]
end

.available_optionsObject



46
47
48
49
50
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
# File 'lib/fastlane/plugin/raven/actions/raven_action.rb', line 46

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :token,
      env_name: "RAVEN_SENTRY_TOKEN",
      description: "A valid Sentry API Token",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :organization,
      env_name: "RAVEN_SENTRY_ORG",
      description: "Your Sentry Organization name",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :project,
      env_name: "RAVEN_SENTRY_PROJECT",
      description: "Your Sentry Project name",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :version,
      env_name: "RAVEN_SENTRY_VERSION",
      description: "The Version of the new Release",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :sourcemaps,
      env_name: "RAVEN_SENTRY_SOURCEMAPS",
      description: "Path to the Sourcemaps",
      optional: false,
      type: Array
    ),
    FastlaneCore::ConfigItem.new(
      key: :filename_prefix,
      env_name: "RAVEN_SENTRY_FILENAME_PREFIX",
      description: "Prefix for the Sourcemaps Files",
      optional: true,
      type: String
    )
  ]
end

.descriptionObject



31
32
33
# File 'lib/fastlane/plugin/raven/actions/raven_action.rb', line 31

def self.description
  "Create new Sentry/Raven Release and Upload Sourcemaps"
end

.detailsObject



43
44
# File 'lib/fastlane/plugin/raven/actions/raven_action.rb', line 43

def self.details
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/fastlane/plugin/raven/actions/raven_action.rb', line 93

def self.is_supported?(platform)
  true
end

.return_valueObject



39
40
41
# File 'lib/fastlane/plugin/raven/actions/raven_action.rb', line 39

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



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

def self.run(params)
  client = Sentry::Client.new(params[:token], "#{params[:organization]}/#{params[:project]}")
  UI.message("Creating new Release")
  response = client.create_release(params[:version])
  if response.response_code == 200
    UI.message("Release already exists..")
  elsif response.response_code == 201
    UI.success("Created new Release for Version: #{params[:version]}")
  else
    UI.user_error!("Failed to lookup/create a new Release")
  end
  UI.message("Uploading Sourcemaps")

  params[:sourcemaps].each do |sourcemap|
    response = client.upload_release_artifact(params[:version], sourcemap, params[:filename_prefix])
    if (200..300).cover?(response.response_code)
      UI.success("Uploaded all Sourcemaps for Version: #{params[:version]}")
    elsif (301..499).cover?(response.response_code)
      UI.message("Sourcemaps allready present for Version: #{params[:version]}")
    else
      UI.user_error!("Failed to upload Sourcemaps for Version: #{params[:version]}")
    end
  end
end