fastlane-plugin-instabug_official 0.2.1 → 0.3.3

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
- SHA1:
3
- metadata.gz: 29ff81468754f432fd52be59fb0fc1da822b3388
4
- data.tar.gz: 7be9f7181f91b24d09f525135b02372f851a756f
2
+ SHA256:
3
+ metadata.gz: f4cd31e00ccf7d08eb06dae94763d037fa565f15a3a8bf511e2cddaefa0b8853
4
+ data.tar.gz: '09535c86b470bfc082c194e598a80dd1e4fa4f4c7154c29e6b839ea9bfe1888d'
5
5
  SHA512:
6
- metadata.gz: 4cfd391852f4d6fac882fbc28fca509f2f8616394736224d5759312548adbaae6973e37cc1e049639c7ff4e84ed63a47788166654fa1e3b70dfda8cd5e31a81c
7
- data.tar.gz: 2e006fb4fffcc7802a734e4bd9acad7455789538e94f074cba4aab2bef046603cac76a9ee3d906daba5b0512feb223ec868369b544422a3edad8ea821d651030
6
+ metadata.gz: 9946522486b66f56471c30f08e9ed26826b4dc37295f8f6e9ba03cd6e85a71f46541ef0f6473b7dd322a6eea0016e5168340da2b194c5f2d32cb8bf949e933cc
7
+ data.tar.gz: dd9f90f660184d212193d161d231e32e8b538b2282f91933b1393bcccdae9c01e8a35068f7e83fb2e4aba4ba7b0a2e07bb8da27b5bab9b1b1d5f43a7ec96628a
data/README.md CHANGED
@@ -12,27 +12,20 @@ fastlane add_plugin instabug_official
12
12
 
13
13
  ## About instabug_official
14
14
 
15
- upload dsyms to fastlane
15
+ Upload dSYM files to Instabug
16
16
 
17
- **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
17
+ This action is used to upload symbolication files to Instabug. Incase you are not using bitcode, you can use this plug-in
18
+ with `gym` to upload dSYMs generated from your builds. If bitcode is enabled, you can use it with `download_dsyms` to upload dSYMs
19
+ from iTunes connect
18
20
 
19
21
  ## Example
20
22
 
21
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
-
23
- **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
-
25
- ## Run tests for this plugin
26
-
27
- To run both the tests, and code style validation, run
28
-
29
23
  ```
30
- rake
24
+ instabug_official(api_token: "<Instabug token>")
31
25
  ```
32
26
 
33
- To automatically fix many of the styling issues, use
34
27
  ```
35
- rubocop -a
28
+ instabug_official(api_token: "<Instabug token>", dsym_array_paths: ["./App1.dSYM.zip", "./App2.dSYM.zip"])
36
29
  ```
37
30
 
38
31
  ## Issues and Feedback
@@ -1,127 +1,135 @@
1
1
  require 'fileutils'
2
2
  require 'fastlane/action'
3
3
  require_relative '../helper/instabug_official_helper'
4
+ require 'shellwords'
4
5
 
5
6
  module Fastlane
6
- module Actions
7
- class InstabugOfficialAction < Action
8
- def self.run(params)
9
- UI.verbose "Running Instabug Action"
10
- api_token = params[:api_token]
11
-
12
- endpoint = 'https://api.instabug.com/api/sdk/v3/symbols_files'
13
- command = "curl #{endpoint} --write-out %{http_code} --silent --output /dev/null -F os=\"ios\" -F application_token=\"#{api_token}\" -F symbols_file="
14
-
15
- dsym_paths = (params[:dsym_array_paths] || []).uniq
16
- UI.verbose "dsym_paths: " + dsym_paths.inspect
17
-
18
-
19
- if dsym_paths.empty?
20
- directory_name = fastlane_dsyms_filename
21
- if directory_name.empty?
22
- UI.error "Fastlane dSYMs file is not found! make sure you're using Fastlane action [download_dsyms] to download your dSYMs from App Store Connect"
23
- return
24
- end
25
- else
26
- directory_name = generate_directory_name
27
- UI.verbose "Directory name: " + directory_name
28
- copy_dsym_paths_into_directory(dsym_paths, directory_name)
29
- end
30
-
31
- command = build_single_file_command(command, directory_name)
32
-
33
- puts command
34
-
35
- result = Actions.sh(command)
36
- if result == '200'
37
- UI.success 'dSYM is successfully uploaded to Instabug 🤖'
38
- UI.verbose 'Removing The directory'
39
- remove_directory(directory_name)
40
- else
41
- UI.error "Something went wrong during Instabug dSYM upload. Status code is #{result}"
7
+ module Actions
8
+ class InstabugOfficialAction < Action
9
+ def self.run(params)
10
+ @instabug_dsyms_directory = 'Instabug_dsym_files_fastlane'
11
+
12
+ UI.verbose 'Running Instabug Action'
13
+ api_token = params[:api_token]
14
+
15
+ endpoint = 'https://api.instabug.com/api/sdk/v3/symbols_files'
16
+ command = "curl #{endpoint} --write-out %{http_code} --silent --output /dev/null -F os=\"ios\" -F application_token=\"#{api_token}\" -F symbols_file="
17
+
18
+ dsym_paths = []
19
+ # Add paths provided by the user
20
+ dsym_paths += (params[:dsym_array_paths] || [])
21
+ # Add dSYMs generaed by `gym`
22
+ dsym_paths += [Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH]] if Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH]
23
+ # Add dSYMs downloaded from iTC
24
+ dsym_paths += Actions.lane_context[SharedValues::DSYM_PATHS] if Actions.lane_context[SharedValues::DSYM_PATHS]
25
+
26
+ dsym_paths.uniq!
27
+ UI.verbose 'dsym_paths: ' + dsym_paths.inspect
28
+
29
+ if dsym_paths.empty?
30
+ UI.error "Fastlane dSYMs file is not found! make sure you're using Fastlane action [download_dsyms] to download your dSYMs from App Store Connect"
31
+ return
42
32
  end
43
- end
44
-
45
- def self.description
46
- 'upload dsyms to fastlane'
47
- end
48
33
 
49
- def self.authors
50
- ['Instabug Inc.']
51
- end
34
+ generate_instabug_directory
52
35
 
53
- def self.return_value
54
- # If your method provides a return value, you can describe here what it does
55
- end
36
+ UI.verbose 'Directory name: ' + @instabug_dsyms_directory
37
+ copy_dsym_paths_into_directory(dsym_paths, @instabug_dsyms_directory)
56
38
 
57
- def self.details
58
- # Optional:
59
- 'upload dsyms to fastlane'
60
- end
39
+ command = build_single_file_command(command, @instabug_dsyms_directory)
61
40
 
62
- def self.available_options
63
- [
64
- FastlaneCore::ConfigItem.new(key: :api_token,
65
- env_name: 'FL_INSTABUG_API_TOKEN', # The name of the environment variable
66
- description: 'API Token for Instabug', # a short description of this parameter
67
- verify_block: proc do |value|
68
- UI.user_error!("No API token for InstabugAction given, pass using `api_token: 'token'`") unless value && !value.empty?
69
- end),
70
- FastlaneCore::ConfigItem.new(key: :dsym_array_paths,
71
- type: Array,
72
- optional: true,
73
- description: 'Array of paths to *.dSYM files')
74
- ]
75
- end
41
+ result = Actions.sh(command)
42
+ if result == '200'
43
+ UI.success 'dSYM is successfully uploaded to Instabug 🤖'
44
+ UI.verbose 'Removing The directory'
45
+ else
46
+ UI.error "Something went wrong during Instabug dSYM upload. Status code is #{result}"
47
+ end
76
48
 
77
- def self.is_supported?(platform)
78
- platform == :ios
79
- true
80
- end
49
+ # Cleanup zip file and directory
50
+ cleanup_instabug_directory
51
+ end
52
+
53
+ def self.description
54
+ "Upload dSYM files to Instabug"
55
+ end
56
+
57
+ def self.details
58
+ "This action is used to upload symbolication files to Instabug. Incase you are not using bitcode, you can use this plug-in
59
+ with `gym` to upload dSYMs generated from your builds. If bitcode is enabled, you can use it with `download_dsyms` to upload dSYMs
60
+ from iTunes connect"
61
+ end
81
62
 
82
- private
63
+ def self.authors
64
+ ['Instabug Inc.']
65
+ end
83
66
 
84
- def self.generate_directory_name
85
- "Instabug_dsym_files_fastlane"
86
- end
67
+ def self.return_value
68
+ # If your method provides a return value, you can describe here what it does
69
+ end
87
70
 
88
- def self.remove_directory(directory_path)
89
- FileUtils.rm_rf directory_path
90
- end
71
+ def self.example_code
72
+ [
73
+ 'instabug_official(api_token: "<Instabug token>")',
74
+ 'instabug_official(api_token: "<Instabug token>", dsym_array_paths: ["./App1.dSYM.zip", "./App2.dSYM.zip"])'
75
+ ]
76
+ end
91
77
 
92
- def self.copy_dsym_paths_into_directory(dsym_paths, directory_path)
93
- FileUtils.rm "Instabug_dsym_files_fastlane.zip", :force => true
94
- FileUtils.mkdir_p directory_path
95
- dsym_paths.each do |path|
96
- FileUtils.copy_entry(path, "#{directory_path}/#{File.basename(path)}") if File.exist?(path)
97
- end
98
- end
78
+ def self.available_options
79
+ [
80
+ FastlaneCore::ConfigItem.new(key: :api_token,
81
+ env_name: 'FL_INSTABUG_API_TOKEN', # The name of the environment variable
82
+ description: 'API Token for Instabug', # a short description of this parameter
83
+ verify_block: proc do |value|
84
+ unless value && !value.empty?
85
+ UI.user_error!("No API token for InstabugAction given, pass using `api_token: 'token'`")
86
+ end
87
+ end),
88
+ FastlaneCore::ConfigItem.new(key: :dsym_array_paths,
89
+ type: Array,
90
+ optional: true,
91
+ description: 'Array of paths to *.dSYM files')
92
+ ]
93
+ end
99
94
 
100
- def self.build_single_file_command(command, dsym_path)
101
- file_path = if dsym_path.end_with?('.zip')
102
- dsym_path.shellescape
103
- else
104
- ZipAction.run(path: dsym_path).shellescape
105
- end
106
- command + "@\"#{file_path}\""
107
- end
95
+ def self.is_supported?(platform)
96
+ platform == :ios
97
+ true
98
+ end
108
99
 
109
- # this is a fallback scenario incase of dSYM paths are not provided.
110
- # We use the dSYMs folder from iTC
111
- def self.fastlane_dsyms_filename
112
- paths = Dir["./**/*.dSYM.zip"]
113
- if paths.empty?
114
- return ""
115
- end
100
+ def self.generate_instabug_directory
101
+ cleanup_instabug_directory
102
+ FileUtils.mkdir_p @instabug_dsyms_directory
103
+ end
116
104
 
117
- iTunesConnectdSYMs = paths[0]
118
- iTunesConnectdSYMs ["./"] = ""
119
- renamediTunesConnectdSYMs = iTunesConnectdSYMs.clone
120
- renamediTunesConnectdSYMs [".dSYM"] = "-iTC"
121
- File.rename(iTunesConnectdSYMs, renamediTunesConnectdSYMs)
122
- default_value = renamediTunesConnectdSYMs
123
- end
105
+ def self.cleanup_instabug_directory
106
+ FileUtils.rm_f "#{@instabug_dsyms_directory}.zip"
107
+ FileUtils.rm_rf @instabug_dsyms_directory
108
+ end
124
109
 
125
- end
126
- end
110
+ def self.remove_directory(directory_path)
111
+ FileUtils.rm_rf directory_path
112
+ end
113
+
114
+ def self.copy_dsym_paths_into_directory(dsym_paths, directory_path)
115
+ dsym_paths.each do |path|
116
+ if File.extname(path) == '.dSYM'
117
+ destination_path = "#{directory_path}/#{File.basename(path)}"
118
+ FileUtils.copy_entry(path, destination_path) if File.exist?(path)
119
+ else
120
+ Actions.sh("unzip -n #{Shellwords.shellescape(path)} -d #{Shellwords.shellescape(directory_path)}")
121
+ end
122
+ end
123
+ end
124
+
125
+ def self.build_single_file_command(command, dsym_path)
126
+ file_path = if dsym_path.end_with?('.zip')
127
+ dsym_path.shellescape
128
+ else
129
+ ZipAction.run(path: dsym_path, include: [], exclude: []).shellescape
130
+ end
131
+ command + "@\"#{Shellwords.shellescape(file_path)}\""
132
+ end
133
+ end
134
+ end
127
135
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module InstabugOfficial
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-instabug_official
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instabug
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-05 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -167,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.6.11
170
+ rubygems_version: 3.1.2
172
171
  signing_key:
173
172
  specification_version: 4
174
173
  summary: Plugin to upload DSYMs to Instabug Dashboard.