fastlane-plugin-sentry 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf9cb26bc2e7b56fa2fce4970cc350ef6dc6d490
4
- data.tar.gz: 39f0986bc20407588207060eb07d60bb1894dcec
3
+ metadata.gz: eedf8ffeb09a61be134683706e0ab09419b2f201
4
+ data.tar.gz: 5967e62c0efb55df6136b8a6c8f25cb97b5bf57c
5
5
  SHA512:
6
- metadata.gz: ea16d9baeb7ef7066cd413dfeb0e6c7126c1b3ffab67cca359275e8a607e1b6c54cc274cf11584e22c50aad3862bf8117c31579eac28bf9b5268f4a86c94624e
7
- data.tar.gz: 7bbd51e5a73abc0623ff80f0fa4f15d3a9416a9d16b787c44de76db35545cff3df98301363573890af0eefd930fb37b964740a80956240f9ffe7f76980c2c71f
6
+ metadata.gz: 3d3cf80b02975ced953bd69c2ccd605ad174575694ef46050cd76a95018f2f7727474fb168f5aa7885a3a033db5e1e4adc3c80c25cbf92f4379170eb994d0038
7
+ data.tar.gz: d8104621c96e78566311bd40e5d1186925e2adf49f374ca3dcc830573c55da8e381e27dc9bb528aa4db2b6e089dfdec7c8316a1ca94f85805697d38eee1c2abb
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Josh Holtz <josh@rokkincat.com>
3
+ Copyright (c) 2017 Sentry
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -11,9 +11,18 @@ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To ge
11
11
  fastlane add_plugin sentry
12
12
  ```
13
13
 
14
- ## About sentry
14
+ ## Sentry Actions
15
15
 
16
- This action allows you to upload symbolication files to Sentry.
16
+ A subset of actions provided by the CLI: https://docs.sentry.io/learn/cli/
17
+
18
+ #### Authentication & Configuration
19
+
20
+ `auth_token` is the preferred way to authentication method with Sentry. This can be obtained on https://sentry.io/api/.
21
+ `api_key` still works but will eventually become deprecated. This can be obtained through the settings of your project.
22
+
23
+ The following environment variables may be used in place of parameters: `SENTRY_API_KEY`, `SENTRY_AUTH_TOKEN`, `SENTRY_ORG_SLUG`, and `SENTRY_PROJECT_SLUG`.
24
+
25
+ #### Uploading Symbolication Files
17
26
 
18
27
  ```ruby
19
28
  sentry_upload_dsym(
@@ -25,11 +34,49 @@ sentry_upload_dsym(
25
34
  )
26
35
  ```
27
36
 
28
- `auth_token` is the preferred way to authentication method with Sentry. This can be obtained on https://sentry.io/api/.
37
+ The `SENTRY_DSYM_PATH` environment variable may be used in place of the `dsym_path` parameter.
29
38
 
30
- `api_key` still works but will eventually become deprecated. This can be obtained through the settings of your project.
39
+ #### Creating & Finalizing Releases
40
+
41
+ ```ruby
42
+ sentry_create_release(
43
+ api_key: '...',
44
+ auth_token: '...',
45
+ org_slug: '...',
46
+ project_slug: '...',
47
+ version: '...', # release version to create
48
+ finalize: true # Whether to finalize the release. If not provided or false, the release can be finalized using the sentry_finalize_release action
49
+ )
50
+ ```
31
51
 
32
- The following environment variables may be used in place of parameters: `SENTRY_API_KEY`, `SENTRY_AUTH_TOKEN`, `SENTRY_ORG_SLUG`, `SENTRY_PROJECT_SLUG`, and `SENTRY_DSYM_PATH`.
52
+ #### Uploading Files & Sourcemaps
53
+
54
+ Useful for uploading build artifacts and JS sourcemaps for react-native apps built using fastlane.
55
+
56
+ ```ruby
57
+ sentry_upload_file(
58
+ api_key: '...',
59
+ auth_token: '...',
60
+ org_slug: '...',
61
+ project_slug: '...',
62
+ version: '...',
63
+ dist: '...', # distribution of the release usually the buildnumber
64
+ file: 'main.jsbundle' # file to upload
65
+ )
66
+ ```
67
+
68
+ ```ruby
69
+ sentry_upload_sourcemap(
70
+ api_key: '...',
71
+ auth_token: '...',
72
+ org_slug: '...',
73
+ project_slug: '...',
74
+ version: '...',
75
+ dist: '...', # distribution of the release usually the buildnumber
76
+ sourcemap: 'main.jsbundle.map', # sourcemap to upload
77
+ rewrite: true
78
+ )
79
+ ```
33
80
 
34
81
  ## Issues and Feedback
35
82
 
@@ -0,0 +1,59 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryCreateReleaseAction < Action
4
+ def self.run(params)
5
+ require 'shellwords'
6
+
7
+ Helper::SentryHelper.check_sentry_cli!
8
+ Helper::SentryConfig.parse_api_params(params)
9
+
10
+ version = params[:version]
11
+ finalize_arg = params[:finalize] ? ' --finalize' : ''
12
+
13
+ command = "sentry-cli releases new '#{Shellwords.escape(version)}' #{finalize_arg}"
14
+
15
+ Helper::SentryHelper.call_sentry_cli(command)
16
+ UI.success("Successfully created release: #{version}")
17
+ end
18
+
19
+ #####################################################
20
+ # @!group Documentation
21
+ #####################################################
22
+
23
+ def self.description
24
+ "Create new releases for a project on Sentry"
25
+ end
26
+
27
+ def self.details
28
+ [
29
+ "This action allows you to create new releases for a project on Sentry.",
30
+ "See https://docs.sentry.io/learn/cli/releases/#creating-releases for more information."
31
+ ].join(" ")
32
+ end
33
+
34
+ def self.available_options
35
+ Helper::SentryConfig.common_api_config_items + [
36
+ FastlaneCore::ConfigItem.new(key: :version,
37
+ description: "Release version to create on Sentry"),
38
+ FastlaneCore::ConfigItem.new(key: :finalize,
39
+ description: "Whether to finalize the release. If not provided or false, the release can be finalized using the finalize_release action",
40
+ default_value: false,
41
+ is_string: false,
42
+ optional: true)
43
+ ]
44
+ end
45
+
46
+ def self.return_value
47
+ nil
48
+ end
49
+
50
+ def self.authors
51
+ ["wschurman"]
52
+ end
53
+
54
+ def self.is_supported?(platform)
55
+ true
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,53 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryFinalizeReleaseAction < Action
4
+ def self.run(params)
5
+ require 'shellwords'
6
+
7
+ Helper::SentryHelper.check_sentry_cli!
8
+ Helper::SentryConfig.parse_api_params(params)
9
+
10
+ version = params[:version]
11
+
12
+ command = "sentry-cli releases finalize '#{Shellwords.escape(version)}'"
13
+
14
+ Helper::SentryHelper.call_sentry_cli(command)
15
+ UI.success("Successfully finalized release: #{version}")
16
+ end
17
+
18
+ #####################################################
19
+ # @!group Documentation
20
+ #####################################################
21
+
22
+ def self.description
23
+ "Finalize a release for a project on Sentry"
24
+ end
25
+
26
+ def self.details
27
+ [
28
+ "This action allows you to finalize releases created for a project on Sentry.",
29
+ "See https://docs.sentry.io/learn/cli/releases/#finalizing-releases for more information."
30
+ ].join(" ")
31
+ end
32
+
33
+ def self.available_options
34
+ Helper::SentryConfig.common_api_config_items + [
35
+ FastlaneCore::ConfigItem.new(key: :version,
36
+ description: "Release version to finalize on Sentry")
37
+ ]
38
+ end
39
+
40
+ def self.return_value
41
+ nil
42
+ end
43
+
44
+ def self.authors
45
+ ["wschurman"]
46
+ end
47
+
48
+ def self.is_supported?(platform)
49
+ true
50
+ end
51
+ end
52
+ end
53
+ end
@@ -2,107 +2,24 @@ module Fastlane
2
2
  module Actions
3
3
  class SentryUploadDsymAction < Action
4
4
  def self.run(params)
5
- check_sentry_cli!
6
-
7
- # Params - API
8
- url = params[:url]
9
- auth_token = params[:auth_token]
10
- api_key = params[:api_key]
11
- org = params[:org_slug]
12
- project = params[:project_slug]
5
+ Helper::SentryHelper.check_sentry_cli!
6
+ Helper::SentryConfig.parse_api_params(params)
13
7
 
14
8
  # Params - dSYM
15
9
  dsym_path = params[:dsym_path]
16
10
  dsym_paths = params[:dsym_paths] || []
17
11
 
18
- has_api_key = !api_key.to_s.empty?
19
- has_auth_token = !auth_token.to_s.empty?
20
-
21
- # Will fail if none or both authentication methods are provided
22
- if !has_api_key && !has_auth_token
23
- UI.user_error!("No API key or authentication token found for SentryAction given, pass using `api_key: 'key'` or `auth_token: 'token'`")
24
- elsif has_api_key && has_auth_token
25
- UI.user_error!("Both API key and authentication token found for SentryAction given, please only give one")
26
- elsif has_api_key && !has_auth_token
27
- UI.deprecated("Please consider switching to auth_token ... api_key will be removed in the future")
28
- end
29
-
30
- ENV['SENTRY_API_KEY'] = api_key unless api_key.to_s.empty?
31
- ENV['SENTRY_AUTH_TOKEN'] = auth_token unless auth_token.to_s.empty?
32
- ENV['SENTRY_URL'] = url unless url.to_s.empty?
33
- ENV['SENTRY_LOG_LEVEL'] = 'debug' if FastlaneCore::Globals.verbose?
34
-
35
12
  # Verify dsym(s)
36
13
  dsym_paths += [dsym_path] unless dsym_path.nil?
37
14
  dsym_paths = dsym_paths.map { |path| File.absolute_path(path) }
38
15
  dsym_paths.each do |path|
39
- UI.user_error!("dSYM does not exist at path: #{path}") unless File.exists? path
40
- end
41
-
42
- UI.success("sentry-cli #{Fastlane::Sentry::CLI_VERSION} installed!")
43
- call_sentry_cli(dsym_paths, org, project)
44
- UI.success("Successfully uploaded dSYMs!")
45
- end
46
-
47
- def self.check_sentry_cli!
48
- if !`which sentry-cli`.include?('sentry-cli')
49
- UI.error("You have to install sentry-cli version #{Fastlane::Sentry::CLI_VERSION} to use this plugin")
50
- UI.error("")
51
- UI.error("Install it using:")
52
- UI.command("brew install getsentry/tools/sentry-cli")
53
- UI.error("OR")
54
- UI.command("curl -sL https://sentry.io/get-cli/ | bash")
55
- UI.error("If you don't have homebrew, visit http://brew.sh")
56
- UI.user_error!("Install sentry-cli and start your lane again!")
57
- end
58
-
59
- sentry_cli_version = Gem::Version.new(`sentry-cli --version`.scan(/(?:\d+\.?){3}/).first)
60
- required_version = Gem::Version.new(Fastlane::Sentry::CLI_VERSION)
61
- if sentry_cli_version < required_version
62
- UI.user_error!("Your sentry-cli is outdated, please upgrade to at least version #{Fastlane::Sentry::CLI_VERSION} and start your lane again!")
16
+ UI.user_error!("dSYM does not exist at path: #{path}") unless File.exist? path
63
17
  end
64
- end
65
18
 
66
- def self.call_sentry_cli(dsym_paths, org, project)
67
- UI.message "Starting sentry-cli..."
68
- require 'open3'
69
- require 'shellwords'
70
- org = Shellwords.escape(org)
71
- project = Shellwords.escape(project)
72
- error = []
73
- command = "sentry-cli upload-dsym '#{dsym_paths.join("','")}' --org #{org} --project #{project}"
74
- if FastlaneCore::Globals.verbose?
75
- UI.verbose("sentry-cli command:\n\n")
76
- UI.command("#{command}")
77
- UI.verbose("\n\n")
78
- end
79
- Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
80
- while line = stderr.gets do
81
- error << line.strip!
82
- end
83
- while line = stdout.gets do
84
- UI.message(line.strip!)
85
- end
86
- exit_status = wait_thr.value
87
- unless exit_status.success? && error.empty?
88
- handle_error(error)
89
- end
90
- end
91
- end
19
+ command = "sentry-cli upload-dsym '#{dsym_paths.join("','")}'"
92
20
 
93
- def self.handle_error(errors)
94
- fatal = false
95
- for error in errors do
96
- if error
97
- if /error/.match(error)
98
- UI.error("#{error}")
99
- fatal = true
100
- else
101
- UI.verbose("#{error}")
102
- end
103
- end
104
- end
105
- UI.user_error!('Error while trying to upload dSYM to Sentry') unless !fatal
21
+ Helper::SentryHelper.call_sentry_cli(command)
22
+ UI.success("Successfully uploaded dSYMs!")
106
23
  end
107
24
 
108
25
  #####################################################
@@ -122,50 +39,18 @@ module Fastlane
122
39
  end
123
40
 
124
41
  def self.available_options
125
- [
126
- FastlaneCore::ConfigItem.new(key: :url,
127
- env_name: "SENTRY_URL",
128
- description: "Url for Sentry",
129
- is_string: true,
130
- optional: true
131
- ),
132
- FastlaneCore::ConfigItem.new(key: :auth_token,
133
- env_name: "SENTRY_AUTH_TOKEN",
134
- description: "Authentication token for Sentry",
135
- optional: true),
136
- FastlaneCore::ConfigItem.new(key: :api_key,
137
- env_name: "SENTRY_API_KEY",
138
- description: "API key for Sentry",
139
- optional: true),
140
- FastlaneCore::ConfigItem.new(key: :org_slug,
141
- env_name: "SENTRY_ORG_SLUG",
142
- description: "Organization slug for Sentry project",
143
- verify_block: proc do |value|
144
- UI.user_error!("No organization slug for SentryAction given, pass using `org_slug: 'org'`") unless value and !value.empty?
145
- end),
146
- FastlaneCore::ConfigItem.new(key: :project_slug,
147
- env_name: "SENTRY_PROJECT_SLUG",
148
- description: "Project slug for Sentry",
149
- verify_block: proc do |value|
150
- UI.user_error!("No project slug for SentryAction given, pass using `project_slug: 'project'`") unless value and !value.empty?
151
- end),
42
+ Helper::SentryConfig.common_api_config_items + [
152
43
  FastlaneCore::ConfigItem.new(key: :dsym_path,
153
44
  env_name: "SENTRY_DSYM_PATH",
154
45
  description: "Path to your symbols file. For iOS and Mac provide path to app.dSYM.zip",
155
46
  default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH],
156
- optional: true,
157
- verify_block: proc do |value|
158
- # validation is done in the action
159
- end),
47
+ optional: true),
160
48
  FastlaneCore::ConfigItem.new(key: :dsym_paths,
161
49
  env_name: "SENTRY_DSYM_PATHS",
162
50
  description: "Path to an array of your symbols file. For iOS and Mac provide path to app.dSYM.zip",
163
51
  default_value: Actions.lane_context[SharedValues::DSYM_PATHS],
164
52
  is_string: false,
165
- optional: true,
166
- verify_block: proc do |value|
167
- # validation is done in the action
168
- end)
53
+ optional: true)
169
54
 
170
55
  ]
171
56
  end
@@ -0,0 +1,66 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryUploadFileAction < Action
4
+ def self.run(params)
5
+ require 'shellwords'
6
+
7
+ Helper::SentryHelper.check_sentry_cli!
8
+ Helper::SentryConfig.parse_api_params(params)
9
+
10
+ version = params[:version]
11
+ file = params[:file]
12
+ file_url_arg = params[:file_url] ? "'#{params[:file_url]}'" : ''
13
+ dist_arg = params[:dist] ? "--dist '#{params[:dist]}'" : ''
14
+
15
+ command = "sentry-cli releases files '#{Shellwords.escape(version)}' upload #{file} #{file_url_arg} #{dist_arg}"
16
+
17
+ Helper::SentryHelper.call_sentry_cli(command)
18
+ UI.success("Successfully uploaded files to release: #{version}")
19
+ end
20
+
21
+ #####################################################
22
+ # @!group Documentation
23
+ #####################################################
24
+
25
+ def self.description
26
+ "Upload files to a release of a project on Sentry"
27
+ end
28
+
29
+ def self.details
30
+ [
31
+ "This action allows you to upload files to a release of a project on Sentry.",
32
+ "See https://docs.sentry.io/learn/cli/releases/#upload-files for more information."
33
+ ].join(" ")
34
+ end
35
+
36
+ def self.available_options
37
+ Helper::SentryConfig.common_api_config_items + [
38
+ FastlaneCore::ConfigItem.new(key: :version,
39
+ description: "Release version on Sentry"),
40
+ FastlaneCore::ConfigItem.new(key: :dist,
41
+ description: "Distribution in release"),
42
+ FastlaneCore::ConfigItem.new(key: :file,
43
+ description: "Path to the file to upload",
44
+ verify_block: proc do |value|
45
+ UI.user_error! "Could not find file at path '#{value}'" unless File.exist?(value)
46
+ end),
47
+ FastlaneCore::ConfigItem.new(key: :file_url,
48
+ description: "Optional URL we should associate with the file",
49
+ optional: true)
50
+ ]
51
+ end
52
+
53
+ def self.return_value
54
+ nil
55
+ end
56
+
57
+ def self.authors
58
+ ["wschurman"]
59
+ end
60
+
61
+ def self.is_supported?(platform)
62
+ true
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,99 @@
1
+ module Fastlane
2
+ module Actions
3
+ class SentryUploadSourcemapAction < Action
4
+ def self.run(params)
5
+ require 'shellwords'
6
+
7
+ Helper::SentryHelper.check_sentry_cli!
8
+ Helper::SentryConfig.parse_api_params(params)
9
+
10
+ version = params[:version]
11
+ sourcemap = params[:sourcemap]
12
+
13
+ rewrite_arg = params[:rewrite] ? '--rewrite' : ''
14
+ strip_prefix_arg = params[:strip_prefix] ? '--strip-prefix' : ''
15
+ strip_common_prefix_arg = params[:strip_common_prefix] ? '--strip-common-prefix' : ''
16
+ url_prefix_arg = params[:url_prefix] ? "--url-prefix '#{params[:url_prefix]}'" : ''
17
+ dist_arg = params[:dist] ? "--dist '#{params[:dist]}'" : ''
18
+
19
+ command = [
20
+ "sentry-cli",
21
+ "releases",
22
+ "files",
23
+ "'#{Shellwords.escape(version)}'",
24
+ "upload-sourcemaps",
25
+ sourcemap.to_s,
26
+ rewrite_arg,
27
+ strip_prefix_arg,
28
+ strip_common_prefix_arg,
29
+ url_prefix_arg,
30
+ dist_arg
31
+ ].join(" ")
32
+
33
+ Helper::SentryHelper.call_sentry_cli(command)
34
+ UI.success("Successfully uploaded files to release: #{version}")
35
+ end
36
+
37
+ #####################################################
38
+ # @!group Documentation
39
+ #####################################################
40
+
41
+ def self.description
42
+ "Upload a sourcemap to a release of a project on Sentry"
43
+ end
44
+
45
+ def self.details
46
+ [
47
+ "This action allows you to upload a sourcemap to a release of a project on Sentry.",
48
+ "See https://docs.sentry.io/learn/cli/releases/#upload-sourcemaps for more information."
49
+ ].join(" ")
50
+ end
51
+
52
+ def self.available_options
53
+ Helper::SentryConfig.common_api_config_items + [
54
+ FastlaneCore::ConfigItem.new(key: :version,
55
+ description: "Release version on Sentry"),
56
+ FastlaneCore::ConfigItem.new(key: :dist,
57
+ description: "Distribution in release"),
58
+ FastlaneCore::ConfigItem.new(key: :sourcemap,
59
+ description: "Path to the sourcemap to upload",
60
+ verify_block: proc do |value|
61
+ UI.user_error! "Could not find sourcemap at path '#{value}'" unless File.exist?(value)
62
+ end),
63
+ FastlaneCore::ConfigItem.new(key: :rewrite,
64
+ description: "Rewrite the sourcemaps before upload",
65
+ default_value: false,
66
+ is_string: false,
67
+ optional: true),
68
+ FastlaneCore::ConfigItem.new(key: :strip_prefix,
69
+ conflicting_options: [:strip_common_prefix],
70
+ description: "Chop-off a prefix from uploaded files",
71
+ default_value: false,
72
+ is_string: false,
73
+ optional: true),
74
+ FastlaneCore::ConfigItem.new(key: :strip_common_prefix,
75
+ conflicting_options: [:strip_prefix],
76
+ description: "Automatically guess what the common prefix is and chop that one off",
77
+ default_value: false,
78
+ is_string: false,
79
+ optional: true),
80
+ FastlaneCore::ConfigItem.new(key: :url_prefix,
81
+ description: "Sets a URL prefix in front of all files",
82
+ optional: true)
83
+ ]
84
+ end
85
+
86
+ def self.return_value
87
+ nil
88
+ end
89
+
90
+ def self.authors
91
+ ["wschurman"]
92
+ end
93
+
94
+ def self.is_supported?(platform)
95
+ true
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,64 @@
1
+ module Fastlane
2
+ module Helper
3
+ class SentryConfig
4
+ def self.common_api_config_items
5
+ [
6
+ FastlaneCore::ConfigItem.new(key: :url,
7
+ env_name: "SENTRY_URL",
8
+ description: "Url for Sentry",
9
+ is_string: true,
10
+ optional: true),
11
+ FastlaneCore::ConfigItem.new(key: :auth_token,
12
+ env_name: "SENTRY_AUTH_TOKEN",
13
+ description: "Authentication token for Sentry",
14
+ optional: true),
15
+ FastlaneCore::ConfigItem.new(key: :api_key,
16
+ env_name: "SENTRY_API_KEY",
17
+ description: "API key for Sentry",
18
+ optional: true),
19
+ FastlaneCore::ConfigItem.new(key: :org_slug,
20
+ env_name: "SENTRY_ORG_SLUG",
21
+ description: "Organization slug for Sentry project",
22
+ verify_block: proc do |value|
23
+ UI.user_error!("No organization slug for SentryAction given, pass using `org_slug: 'org'`") unless value and !value.empty?
24
+ end),
25
+ FastlaneCore::ConfigItem.new(key: :project_slug,
26
+ env_name: "SENTRY_PROJECT_SLUG",
27
+ description: "Project slug for Sentry",
28
+ verify_block: proc do |value|
29
+ UI.user_error!("No project slug for SentryAction given, pass using `project_slug: 'project'`") unless value and !value.empty?
30
+ end)
31
+ ]
32
+ end
33
+
34
+ def self.parse_api_params(params)
35
+ require 'shellwords'
36
+
37
+ url = params[:url]
38
+ auth_token = params[:auth_token]
39
+ api_key = params[:api_key]
40
+ org = params[:org_slug]
41
+ project = params[:project_slug]
42
+
43
+ has_api_key = !api_key.to_s.empty?
44
+ has_auth_token = !auth_token.to_s.empty?
45
+
46
+ # Will fail if none or both authentication methods are provided
47
+ if !has_api_key && !has_auth_token
48
+ UI.user_error!("No API key or authentication token found for SentryAction given, pass using `api_key: 'key'` or `auth_token: 'token'`")
49
+ elsif has_api_key && has_auth_token
50
+ UI.user_error!("Both API key and authentication token found for SentryAction given, please only give one")
51
+ elsif has_api_key && !has_auth_token
52
+ UI.deprecated("Please consider switching to auth_token ... api_key will be removed in the future")
53
+ end
54
+
55
+ ENV['SENTRY_API_KEY'] = api_key unless api_key.to_s.empty?
56
+ ENV['SENTRY_AUTH_TOKEN'] = auth_token unless auth_token.to_s.empty?
57
+ ENV['SENTRY_URL'] = url unless url.to_s.empty?
58
+ ENV['SENTRY_LOG_LEVEL'] = 'debug' if FastlaneCore::Globals.verbose?
59
+ ENV['SENTRY_ORG'] = Shellwords.escape(org) unless org.to_s.empty?
60
+ ENV['SENTRY_PROJECT'] = Shellwords.escape(project) unless project.to_s.empty?
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,11 +1,63 @@
1
1
  module Fastlane
2
2
  module Helper
3
3
  class SentryHelper
4
- # class methods that you define here become available in your action
5
- # as `Helper::SentryHelper.your_method`
6
- #
7
- def self.show_message
8
- UI.message("Hello from the sentry plugin helper!")
4
+ def self.check_sentry_cli!
5
+ unless `which sentry-cli`.include?('sentry-cli')
6
+ UI.error("You have to install sentry-cli version #{Fastlane::Sentry::CLI_VERSION} to use this plugin")
7
+ UI.error("")
8
+ UI.error("Install it using:")
9
+ UI.command("brew install getsentry/tools/sentry-cli")
10
+ UI.error("OR")
11
+ UI.command("curl -sL https://sentry.io/get-cli/ | bash")
12
+ UI.error("If you don't have homebrew, visit http://brew.sh")
13
+ UI.user_error!("Install sentry-cli and start your lane again!")
14
+ end
15
+
16
+ sentry_cli_version = Gem::Version.new(`sentry-cli --version`.scan(/(?:\d+\.?){3}/).first)
17
+ required_version = Gem::Version.new(Fastlane::Sentry::CLI_VERSION)
18
+ if sentry_cli_version < required_version
19
+ UI.user_error!("Your sentry-cli is outdated, please upgrade to at least version #{Fastlane::Sentry::CLI_VERSION} and start your lane again!")
20
+ end
21
+
22
+ UI.success("sentry-cli #{sentry_cli_version} installed!")
23
+ end
24
+
25
+ def self.call_sentry_cli(command)
26
+ UI.message "Starting sentry-cli..."
27
+ require 'open3'
28
+ error = []
29
+ if FastlaneCore::Globals.verbose?
30
+ UI.verbose("sentry-cli command:\n\n")
31
+ UI.command(command.to_s)
32
+ UI.verbose("\n\n")
33
+ end
34
+ Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
35
+ while (line = stderr.gets)
36
+ error << line.strip!
37
+ end
38
+ while (line = stdout.gets)
39
+ UI.message(line.strip!)
40
+ end
41
+ exit_status = wait_thr.value
42
+ unless exit_status.success? && error.empty?
43
+ handle_error(error)
44
+ end
45
+ end
46
+ end
47
+
48
+ def self.handle_error(errors)
49
+ fatal = false
50
+ for error in errors do
51
+ if error
52
+ if error =~ /error/
53
+ UI.error(error.to_s)
54
+ fatal = true
55
+ else
56
+ UI.verbose(error.to_s)
57
+ end
58
+ end
59
+ end
60
+ UI.user_error!('Error while calling Sentry CLI') if fatal
9
61
  end
10
62
  end
11
63
  end
@@ -1,6 +1,6 @@
1
1
  module Fastlane
2
2
  module Sentry
3
- VERSION = "1.0.4"
4
- CLI_VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
+ CLI_VERSION = "1.6.0"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-sentry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
- - Josh Holtz
7
+ - Sentry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-24 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: fastlane
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +81,7 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: 2.10.0
69
83
  description:
70
- email: josh@rokkincat.com
84
+ email: hello@sentry.io
71
85
  executables: []
72
86
  extensions: []
73
87
  extra_rdoc_files: []
@@ -75,7 +89,12 @@ files:
75
89
  - LICENSE
76
90
  - README.md
77
91
  - lib/fastlane/plugin/sentry.rb
92
+ - lib/fastlane/plugin/sentry/actions/sentry_create_release.rb
93
+ - lib/fastlane/plugin/sentry/actions/sentry_finalize_release.rb
78
94
  - lib/fastlane/plugin/sentry/actions/sentry_upload_dsym.rb
95
+ - lib/fastlane/plugin/sentry/actions/sentry_upload_file.rb
96
+ - lib/fastlane/plugin/sentry/actions/sentry_upload_sourcemap.rb
97
+ - lib/fastlane/plugin/sentry/helper/sentry_config.rb
79
98
  - lib/fastlane/plugin/sentry/helper/sentry_helper.rb
80
99
  - lib/fastlane/plugin/sentry/version.rb
81
100
  homepage: https://github.com/getsentry/sentry-fastlane