fastlane-plugin-instabug_official 0.1.0 → 0.2.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: b67c933b4ca9f6d06070466a29dc207339f6b373
4
- data.tar.gz: c491ba41bce6070a01f7fcc1548effbd1f380965
3
+ metadata.gz: 2c672ac49ce11ce6191789c195258bd28bc14422
4
+ data.tar.gz: f8f8c1882b12a9b8bb1530fcfab5f6eb5482ab00
5
5
  SHA512:
6
- metadata.gz: 600dfd95cc106b92cf41952765fe1bd7b696263219b3d016522f0c456e5c07319f7fb30e767ff1890e1fea950fbd9664fed8590fd640f2a8217e2bb2c7df5a47
7
- data.tar.gz: afea82c5cf93fd4ef5a56dba54455cc39eed168a60f3877cbb2a5bf3ca0d4fb7f52303edaaa016f53a22d59e7246c3c49e3eb94601f9cd11366b8607f96f6710
6
+ metadata.gz: e19c829b1ba29dc45016c58436d56371a3e3903cfb482602f627368a0f1fc156974395daf54ceb772ab5ceef22a1201fcd6aba878e6c48ce6f22095dc3c75c53
7
+ data.tar.gz: b80c83561c0861c8447c14c4977aad15d3a0d71c9909e25bdfd4b6417281351889e8d938d80519b09a750c15b3ba538e4dfb0574b0eb5c6974403a23766095ad
data/README.md CHANGED
@@ -12,19 +12,16 @@ fastlane add_plugin instabug_official
12
12
 
13
13
  ## About instabug_official
14
14
 
15
- upload dsyms to instabug
15
+ upload dsyms to fastlane
16
16
 
17
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.
18
18
 
19
19
  ## 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
- ```
20
+
26
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`.
27
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
+
28
25
  ## Run tests for this plugin
29
26
 
30
27
  To run both the tests, and code style validation, run
@@ -1,76 +1,127 @@
1
+ require 'fileutils'
1
2
  require 'fastlane/action'
2
3
  require_relative '../helper/instabug_official_helper'
3
4
 
4
5
  module Fastlane
5
- module Actions
6
- class InstabugOfficialAction < Action
7
- def self.run(params)
8
- api_token = params[:api_token]
9
-
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
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}"
42
+ end
15
43
  end
44
+
45
+ def self.description
46
+ 'upload dsyms to fastlane'
47
+ end
48
+
49
+ def self.authors
50
+ ['Instabug Inc.']
51
+ end
52
+
53
+ def self.return_value
54
+ # If your method provides a return value, you can describe here what it does
55
+ end
16
56
 
17
- endpoint = 'https://api.instabug.com/api/sdk/v3/symbols_files'
57
+ def self.details
58
+ # Optional:
59
+ 'upload dsyms to fastlane'
60
+ end
18
61
 
19
- command = "curl #{endpoint} --write-out %{http_code} --silent --output /dev/null -F symbols_file=@\"#{dsym_zip_path}\" -F application_token=\"#{api_token}\""
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
20
76
 
21
- UI.verbose command
77
+ def self.is_supported?(platform)
78
+ platform == :ios
79
+ true
80
+ end
22
81
 
23
- return command if Helper.test?
82
+ private
24
83
 
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
31
- end
84
+ def self.generate_directory_name
85
+ "Instabug_dsym_files_fastlane"
86
+ end
32
87
 
33
- def self.description
34
- "upload dsyms to instabug"
35
- end
88
+ def self.remove_directory(directory_path)
89
+ FileUtils.rm_rf directory_path
90
+ end
36
91
 
37
- def self.authors
38
- ["Karim_Mousa_89"]
39
- end
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
40
99
 
41
- def self.return_value
42
- # If your method provides a return value, you can describe here what it does
43
- end
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
44
108
 
45
- def self.details
46
- # Optional:
47
- "upload dsyms to instabug"
48
- end
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
49
116
 
50
- def self.available_options
51
- [
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)
67
- ]
68
- end
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
69
124
 
70
- def self.is_supported?(platform)
71
- platform == :ios
72
- true
73
- end
74
- end
75
- end
125
+ end
126
+ end
76
127
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module InstabugOfficial
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
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.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karim_Mousa_89
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-13 00:00:00.000000000 Z
11
+ date: 2019-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -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/Karim-Mohamed-Mousa/fastlane-plugin-instabug-official
152
152
  licenses:
153
153
  - MIT
154
154
  metadata: {}
@@ -168,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 2.5.2
171
+ rubygems_version: 2.6.11
172
172
  signing_key:
173
173
  specification_version: 4
174
- summary: upload dsyms to instabug
174
+ summary: upload dsyms to fastlane
175
175
  test_files: []