fastlane-plugin-instabug_official 0.1.0 → 0.3.2

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: b67c933b4ca9f6d06070466a29dc207339f6b373
4
- data.tar.gz: c491ba41bce6070a01f7fcc1548effbd1f380965
2
+ SHA256:
3
+ metadata.gz: f8e2c6fb0c54f5a02fb6a2ee091935eddd068585e64eda951402464c14f02a0d
4
+ data.tar.gz: 929cb6261c6567ec406ca6adcc21ef45cabdfa7313e7a2b81e98599576ab89d9
5
5
  SHA512:
6
- metadata.gz: 600dfd95cc106b92cf41952765fe1bd7b696263219b3d016522f0c456e5c07319f7fb30e767ff1890e1fea950fbd9664fed8590fd640f2a8217e2bb2c7df5a47
7
- data.tar.gz: afea82c5cf93fd4ef5a56dba54455cc39eed168a60f3877cbb2a5bf3ca0d4fb7f52303edaaa016f53a22d59e7246c3c49e3eb94601f9cd11366b8607f96f6710
6
+ metadata.gz: 224029210cc658c7f0ba0fcbb1b18655f5dd9d931504f945906fc0b4484a45b3246ee5f7d507d0976c9e79fef9e080fb9541c9ef8028debebc8d71270c34449f
7
+ data.tar.gz: 8bda10637b6e27335170c48574526c5762d08497c17951e9203621720f85928196ef198ebedf09b15b5313f0209e728c0329bf6f9bcf8895a35f9e63dad62e30
data/README.md CHANGED
@@ -12,30 +12,20 @@ fastlane add_plugin instabug_official
12
12
 
13
13
  ## About instabug_official
14
14
 
15
- upload dsyms to instabug
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
- ```ruby
21
- instabug_official(api_token: 'INSTABUG_TOKEN',
22
- # DSYM_OUTPUT_PATH by default (produced by gym command).
23
- # Should be *.zip-file, if not it will be zipped automatically
24
- dsym_path: '/path/to/dsym')
25
- ```
26
- 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`.
27
-
28
- ## Run tests for this plugin
29
-
30
- To run both the tests, and code style validation, run
31
22
 
32
23
  ```
33
- rake
24
+ instabug_official(api_token: "<Instabug token>")
34
25
  ```
35
26
 
36
- To automatically fix many of the styling issues, use
37
27
  ```
38
- rubocop -a
28
+ instabug_official(api_token: "<Instabug token>", dsym_array_paths: ["./App1.dSYM.zip", "./App2.dSYM.zip"])
39
29
  ```
40
30
 
41
31
  ## Issues and Feedback
@@ -1,69 +1,94 @@
1
+ require 'fileutils'
1
2
  require 'fastlane/action'
2
3
  require_relative '../helper/instabug_official_helper'
4
+ require 'shellwords'
3
5
 
4
6
  module Fastlane
5
7
  module Actions
6
8
  class InstabugOfficialAction < Action
7
9
  def self.run(params)
8
- api_token = params[:api_token]
10
+ @instabug_dsyms_directory = 'Instabug_dsym_files_fastlane'
9
11
 
10
- if params[:dsym_path].end_with?('.zip')
11
- dsym_zip_path = params[:dsym_path].shellescape
12
- else
13
- dsym_path = params[:dsym_path]
14
- dsym_zip_path = ZipAction.run(path: dsym_path).shellescape
15
- end
12
+ UI.verbose 'Running Instabug Action'
13
+ api_token = params[:api_token]
16
14
 
17
- endpoint = 'https://api.instabug.com/api/sdk/v3/symbols_files'
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="
18
17
 
19
- command = "curl #{endpoint} --write-out %{http_code} --silent --output /dev/null -F symbols_file=@\"#{dsym_zip_path}\" -F application_token=\"#{api_token}\""
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]
20
25
 
21
- UI.verbose command
26
+ dsym_paths.uniq!
27
+ UI.verbose 'dsym_paths: ' + dsym_paths.inspect
22
28
 
23
- return command if Helper.test?
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
32
+ end
24
33
 
25
- result = Actions.sh(command)
26
- if result == "200"
27
- UI.success 'dSYM is successfully uploaded to Instabug 🤖'
28
- else
29
- UI.error "Something went wrong during Instabug dSYM upload. Status code is #{result}"
30
- end
34
+ generate_instabug_directory
35
+
36
+ UI.verbose 'Directory name: ' + @instabug_dsyms_directory
37
+ copy_dsym_paths_into_directory(dsym_paths, @instabug_dsyms_directory)
38
+
39
+ command = build_single_file_command(command, @instabug_dsyms_directory)
40
+
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
48
+
49
+ # Cleanup zip file and directory
50
+ cleanup_instabug_directory
31
51
  end
32
52
 
33
53
  def self.description
34
- "upload dsyms to instabug"
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"
35
61
  end
36
62
 
37
63
  def self.authors
38
- ["Karim_Mousa_89"]
64
+ ['Instabug Inc.']
39
65
  end
40
66
 
41
67
  def self.return_value
42
68
  # If your method provides a return value, you can describe here what it does
43
69
  end
44
70
 
45
- def self.details
46
- # Optional:
47
- "upload dsyms to instabug"
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
+ ]
48
76
  end
49
77
 
50
78
  def self.available_options
51
79
  [
52
- FastlaneCore::ConfigItem.new(key: :api_token,
53
- env_name: 'FL_INSTABUG_API_TOKEN', # The name of the environment variable
54
- description: 'API Token for Instabug', # a short description of this parameter
55
- verify_block: proc do |value|
56
- UI.user_error!("No API token for InstabugAction given, pass using `api_token: 'token'`") unless value && !value.empty?
57
- end),
58
- FastlaneCore::ConfigItem.new(key: :dsym_path,
59
- env_name: 'FL_INSTABUG_DSYM_PATH',
60
- description: 'Path to *.dSYM file',
61
- default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH],
62
- is_string: true,
63
- optional: true,
64
- verify_block: proc do |value|
65
- UI.user_error!("dSYM file doesn't exists") unless File.exist?(value)
66
- end)
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')
67
92
  ]
68
93
  end
69
94
 
@@ -71,6 +96,40 @@ module Fastlane
71
96
  platform == :ios
72
97
  true
73
98
  end
99
+
100
+ def self.generate_instabug_directory
101
+ cleanup_instabug_directory
102
+ FileUtils.mkdir_p @instabug_dsyms_directory
103
+ end
104
+
105
+ def self.cleanup_instabug_directory
106
+ FileUtils.rm_f "#{@instabug_dsyms_directory}.zip"
107
+ FileUtils.rm_rf @instabug_dsyms_directory
108
+ end
109
+
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).shellescape
130
+ end
131
+ command + "@\"#{Shellwords.shellescape(file_path)}\""
132
+ end
74
133
  end
75
134
  end
76
135
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module InstabugOfficial
3
- VERSION = "0.1.0"
3
+ VERSION = "0.3.2"
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.1.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
- - Karim_Mousa_89
7
+ - Instabug
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-13 00:00:00.000000000 Z
11
+ date: 2021-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -137,7 +137,7 @@ dependencies:
137
137
  - !ruby/object:Gem::Version
138
138
  version: 2.80.0
139
139
  description:
140
- email: eng.karim.mousa.89@gmail.com
140
+ email: iosteam@instabug.com
141
141
  executables: []
142
142
  extensions: []
143
143
  extra_rdoc_files: []
@@ -148,7 +148,7 @@ files:
148
148
  - lib/fastlane/plugin/instabug_official/actions/instabug_official_action.rb
149
149
  - lib/fastlane/plugin/instabug_official/helper/instabug_official_helper.rb
150
150
  - lib/fastlane/plugin/instabug_official/version.rb
151
- homepage: https://github.com/K-Mousa/fastlane-plugin-instabug
151
+ homepage: https://github.com/Instabug/fastlane-plugin-instabug-official
152
152
  licenses:
153
153
  - MIT
154
154
  metadata: {}
@@ -167,9 +167,8 @@ 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.5.2
170
+ rubygems_version: 3.1.2
172
171
  signing_key:
173
172
  specification_version: 4
174
- summary: upload dsyms to instabug
173
+ summary: Plugin to upload DSYMs to Instabug Dashboard.
175
174
  test_files: []