fastlane-plugin-sentry 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eedf8ffeb09a61be134683706e0ab09419b2f201
4
- data.tar.gz: 5967e62c0efb55df6136b8a6c8f25cb97b5bf57c
3
+ metadata.gz: fe52a765522b2b77f2616428d31271c6739a6254
4
+ data.tar.gz: f11bf44961e87ab53989b21c9a44c5288d92b48e
5
5
  SHA512:
6
- metadata.gz: 3d3cf80b02975ced953bd69c2ccd605ad174575694ef46050cd76a95018f2f7727474fb168f5aa7885a3a033db5e1e4adc3c80c25cbf92f4379170eb994d0038
7
- data.tar.gz: d8104621c96e78566311bd40e5d1186925e2adf49f374ca3dcc830573c55da8e381e27dc9bb528aa4db2b6e089dfdec7c8316a1ca94f85805697d38eee1c2abb
6
+ metadata.gz: 6faaba7d865fd281f64d8e13d9e3750dc194666da123face8de194c4dc05960d29c9da6dfb2074fd20722f197ceb82ac7228a6bbd9009347ee62a66aa7c56e71
7
+ data.tar.gz: 602c3b563a5ed0bb0887a831d3ac39747725ebc0fb1408c8819479df27d701292502952eb50b349ef36983208c6e7911ce37ad7cea57edff0f26c9d2ebb4d07a
data/README.md CHANGED
@@ -19,6 +19,7 @@ A subset of actions provided by the CLI: https://docs.sentry.io/learn/cli/
19
19
 
20
20
  `auth_token` is the preferred way to authentication method with Sentry. This can be obtained on https://sentry.io/api/.
21
21
  `api_key` still works but will eventually become deprecated. This can be obtained through the settings of your project.
22
+ Also note that as of version `1.2.0` you no longer have to provide the required parameters, we will try to fallback to your `.sentryclirc` config file if possible.
22
23
 
23
24
  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
 
@@ -19,15 +19,11 @@ module Fastlane
19
19
  FastlaneCore::ConfigItem.new(key: :org_slug,
20
20
  env_name: "SENTRY_ORG_SLUG",
21
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),
22
+ optional: true),
25
23
  FastlaneCore::ConfigItem.new(key: :project_slug,
26
24
  env_name: "SENTRY_PROJECT_SLUG",
27
25
  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)
26
+ optional: true)
31
27
  ]
32
28
  end
33
29
 
@@ -40,24 +36,42 @@ module Fastlane
40
36
  org = params[:org_slug]
41
37
  project = params[:project_slug]
42
38
 
39
+ has_org = !org.to_s.empty?
40
+ has_project = !project.to_s.empty?
43
41
  has_api_key = !api_key.to_s.empty?
44
42
  has_auth_token = !auth_token.to_s.empty?
45
43
 
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")
44
+ skip_params_check = false
45
+ if !has_org || !has_project || !has_auth_token
46
+ skip_params_check = fallback_sentry_cli
47
+ end
48
+
49
+ if !skip_params_check
50
+ # Will fail if none or both authentication methods are provided
51
+ if !has_api_key && !has_auth_token
52
+ UI.user_error!("No API key or authentication token found for SentryAction given, pass using `api_key: 'key'` or `auth_token: 'token'`")
53
+ elsif has_api_key && has_auth_token
54
+ UI.user_error!("Both API key and authentication token found for SentryAction given, please only give one")
55
+ elsif has_api_key && !has_auth_token
56
+ UI.deprecated("Please consider switching to auth_token ... api_key will be removed in the future")
57
+ end
58
+ ENV['SENTRY_API_KEY'] = api_key unless api_key.to_s.empty?
59
+ ENV['SENTRY_AUTH_TOKEN'] = auth_token unless auth_token.to_s.empty?
60
+ ENV['SENTRY_URL'] = url unless url.to_s.empty?
61
+ ENV['SENTRY_LOG_LEVEL'] = 'debug' if FastlaneCore::Globals.verbose?
62
+ ENV['SENTRY_ORG'] = Shellwords.escape(org) unless org.to_s.empty?
63
+ ENV['SENTRY_PROJECT'] = Shellwords.escape(project) unless project.to_s.empty?
64
+ else
65
+ UI.important("No config provided, will fallback to .sentryclirc")
53
66
  end
67
+ end
54
68
 
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?
69
+ def self.fallback_sentry_cli
70
+ sentry_cli_result = JSON.parse(`sentry-cli info --config-status-json`)
71
+ return (sentry_cli_result["auth"]["successful"] &&
72
+ !sentry_cli_result["auth"]["type"].nil? &&
73
+ !sentry_cli_result["config"]["org"].nil? &&
74
+ !sentry_cli_result["config"]["project"].nil?)
61
75
  end
62
76
  end
63
77
  end
@@ -1,6 +1,6 @@
1
1
  module Fastlane
2
2
  module Sentry
3
- VERSION = "1.1.0"
4
- CLI_VERSION = "1.6.0"
3
+ VERSION = "1.2.0"
4
+ CLI_VERSION = "1.9.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.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-25 00:00:00.000000000 Z
11
+ date: 2017-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry