fastlane-plugin-find_firebase_app_id 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5fe08f6a657674c526e6507eecc88178676f817d0777a262833e3b0c745b89bd
4
+ data.tar.gz: 6123f57263059a7ef3aa0cae514e4015cd74cd9f99b1e3076823d8990eb5ea83
5
+ SHA512:
6
+ metadata.gz: 3a42ea11c8f3735589e56be77854393f4d4b469bffe3e2b4de41821e64a69e3cee9e42fabc0526a43e2e4ae9e549c6ebb781325e8f89b575db47252fb35618f1
7
+ data.tar.gz: 7f2e5dc02e76bb2b5c7758fdbfc47b2d30406076f9a687c98085d1d30e2b3f43f346461efa5292005dae75e4f97ac7560209d2651ad57da8f34c3bad57afb6e0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Tigran Hambardzumyan <tigran@stdevmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # find_firebase_app_id plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-find_firebase_app_id)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-find_firebase_app_id`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin find_firebase_app_id
11
+ ```
12
+
13
+ ## About find_firebase_app_id
14
+
15
+ Based on platform (ios or android) the plugin will search and find Firebase App ID from the GoogleService-Info.plist [iOS] or google-services.json [Android] files.
16
+
17
+ This plugin can be used when you are using same lane for distributing more than one apps. In this case the Firebase App IDs are not static and you require to find it from firebase configuration file to pass value to `firebase_app_distribution` plugin.
18
+
19
+ **Note to Android:** For Android platform it is required to provide `app_identifier`.
20
+
21
+ ## Example
22
+
23
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running
24
+
25
+ ```
26
+ bundle exec fastlane install_plugins
27
+ ```
28
+
29
+ and
30
+
31
+ ```
32
+ bundle exec fastlane ios test
33
+ ```
34
+
35
+ for iOS platform
36
+
37
+ ```
38
+ bundle exec faslane android test
39
+ ```
40
+
41
+ for Android.
42
+
43
+ ## Run tests for this plugin
44
+
45
+ To run both the tests, and code style validation, run
46
+
47
+ ```
48
+ rake
49
+ ```
50
+
51
+ To automatically fix many of the styling issues, use
52
+ ```
53
+ rubocop -a
54
+ ```
55
+
56
+ ## Troubleshooting
57
+
58
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
59
+
60
+ ## Using _fastlane_ Plugins
61
+
62
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
63
+
64
+ ## About _fastlane_
65
+
66
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
67
+
68
+ ## Author
69
+
70
+ Tigran Hambardzumyan, tigran@stdevmail.com
71
+
72
+ ## Support
73
+
74
+ Feel free to [open issuses](https://github.com/stdevteam/fastlane-plugin-find_firebase_app_id/issues/new) with any suggestions, bug reports, feature requests, questions.
75
+
76
+ ## Let us know!
77
+
78
+ We’d be really happy if you sent us links to your projects where you use our component. Just send an email to developer@stdevmail.com and do let us know if you have any questions or suggestion.
79
+
80
+ ## License
81
+
82
+ The plugin is available under the MIT license. See the [LICENSE](./LICENSE) file for more info.
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/find_firebase_app_id/version'
2
+
3
+ module Fastlane
4
+ module FindFirebaseAppId
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::FindFirebaseAppId.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,116 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/find_firebase_app_id_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ GOOGLE_APP_ID = :GOOGLE_APP_ID
8
+ end
9
+
10
+ class FindFirebaseAppIdAction < Action
11
+ def self.run(params)
12
+ platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
13
+
14
+ if platform == :ios || platform.nil?
15
+ app_id = find_ios_app_id(params)
16
+ end
17
+
18
+ if platform == :android
19
+ app_id = find_android_app_id(params)
20
+ end
21
+
22
+ if app_id.to_s == ''
23
+ UI.user_error!("Can't find app id with provided information.")
24
+ end
25
+
26
+ # Store the id in the shared hash
27
+ Actions.lane_context[SharedValues::GOOGLE_APP_ID] = app_id
28
+ app_id
29
+ end
30
+
31
+ def self.find_ios_app_id(params)
32
+ filename = "GoogleService-Info.plist"
33
+ file_paths = Find.find('./').select { |p| p.include?(filename) }
34
+ if file_paths.any?
35
+ plist = file_paths.first
36
+ GetInfoPlistValueAction.run(path: plist, key: 'GOOGLE_APP_ID')
37
+ else
38
+ UI.user_error!("#{filename} file is missing, please make sure you have added.")
39
+ end
40
+ end
41
+
42
+ def self.find_android_app_id(params)
43
+ filename = "google-services.json"
44
+ file_paths = Find.find('./').select { |p| p.include?(filename) }
45
+ if file_paths.any?
46
+ json_path = file_paths.first
47
+ app_identifier = params[:app_identifier]
48
+ begin
49
+ json = File.read(json_path) # try to read json strong from file
50
+ result = JSON.parse(json) # try to parse and see if it's valid JSON data
51
+ rescue => ex
52
+ UI.user_error!("Can't parse content of #{filename} as a json, please make sure you are using correct file: #{ex}")
53
+ end
54
+ client = result['client'].select { |c| c['client_info']['android_client_info']['package_name'] == app_identifier }
55
+ if client.any?
56
+ client.first['client_info']['mobilesdk_app_id']
57
+ else
58
+ UI.user_error!("#{filename} file doesn't contain configurations for #{app_identifier} application.")
59
+ end
60
+ else
61
+ UI.user_error!("#{filename} file is missing, please make sure you have added.")
62
+ end
63
+ end
64
+
65
+ #####################################################
66
+ # @!group Documentation
67
+ #####################################################
68
+
69
+ def self.description
70
+ "Helper plugin which will allow to find Firebase App ID from GoogleService-Info.plist [iOS] or google-services.json [Android]."
71
+ end
72
+
73
+ def self.authors
74
+ ["Tigran Hambardzumyan"]
75
+ end
76
+
77
+ def self.output
78
+ [
79
+ ['GOOGLE_APP_ID', 'The Firebase App Id']
80
+ ]
81
+ end
82
+
83
+ def self.return_value
84
+ "Returns a Firebase App ID."
85
+ end
86
+
87
+ def self.details
88
+ "Based on platform (ios or android) the plugin will search and find Firebase App ID from the GoogleService-Info.plist [iOS] or google-services.json [Android] files.\n" \
89
+ "This plugin can be used when you are using same lane for distributing more than one apps. In this case the Firebase App IDs are not static and you require to find it from firebase configuration file to pass value to `firebase_app_distribution` plugin."
90
+ end
91
+
92
+ def self.available_options
93
+ [
94
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
95
+ env_name: "FIND_FIREBASE_APP_ID_APP_IDENTIFIER",
96
+ description: "The app identifier to find Firebase App ID (Required: for Android platform)",
97
+ optional: true,
98
+ type: String)
99
+ ]
100
+ end
101
+
102
+ def self.example_code
103
+ [
104
+ <<-CODE
105
+ app_id = find_firebase_app_id
106
+ CODE
107
+ ]
108
+ end
109
+
110
+ def self.is_supported?(platform)
111
+ [:ios, :android].include?(platform)
112
+ true
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+
6
+ module Helper
7
+ class FindFirebaseAppIdHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::FindFirebaseAppIdHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the find_firebase_app_id plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module FindFirebaseAppId
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,175 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-find_firebase_app_id
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Tigran Hambardzumyan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-12-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec_junit_formatter
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'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.49.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.49.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-require_tools
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: fastlane
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.137.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.137.0
139
+ description:
140
+ email: tigran@stdevmail.com
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/find_firebase_app_id.rb
148
+ - lib/fastlane/plugin/find_firebase_app_id/actions/find_firebase_app_id_action.rb
149
+ - lib/fastlane/plugin/find_firebase_app_id/helper/find_firebase_app_id_helper.rb
150
+ - lib/fastlane/plugin/find_firebase_app_id/version.rb
151
+ homepage: https://github.com/stdevteam/fastlane-plugin-find_firebase_app_id
152
+ licenses:
153
+ - MIT
154
+ metadata: {}
155
+ post_install_message:
156
+ rdoc_options: []
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ requirements: []
170
+ rubygems_version: 3.0.3
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Helper plugin which will allow to find Firebase App ID from GoogleService-Info.plist
174
+ [iOS] or google-services.json [Android].
175
+ test_files: []