fastlane-plugin-create_remote_config_release_package 0.2.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dcbadde0a9b946ffc91fc55378e45c266febca3c9079961a465fbace14a48e08
4
+ data.tar.gz: 52530b73061ff59d5731e8a1c6a78eb8658af67af6f0efe3b8fac35a7cb8f7cd
5
+ SHA512:
6
+ metadata.gz: 321def4abb217c95041fb3ec3ec2690d49639655479e87b036ffc7c172e4a7e8f6b9f975cf9dcf3ce99dea130b97274dc290773a4b82be63e2a246edb1e12353
7
+ data.tar.gz: 37caf5db2661b4886ab8f49e90cd46f557f4b0f6f59a8845df233b871bf82732d6de565302fe4c0e2f910ea88d1f58089791f5281eac859f9364535abebe2497
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 George Nyakundi <georgen@backbase.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,79 @@
1
+ # create_remote_config_release_package plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-create_remote_config_release_package)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-create_remote_config_release_package`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin create_remote_config_release_package
11
+ ```
12
+
13
+ ## About create_remote_config_release_package
14
+
15
+ Creates a Remote Config release package
16
+
17
+ ## Example
18
+
19
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin.
20
+ Add the gem in the Gemfile
21
+ ```ruby
22
+ gem "fastlane-plugin-create_remote_config_release_package", git: "https://github.com/Backbase/fastlane-plugin-create_remote_config_release_package.git"
23
+ ```
24
+
25
+
26
+ ```ruby
27
+ platform :ios do
28
+ lane :test do
29
+ projectName = "sample-app"
30
+ appTitle = "Sample Application"
31
+ bundleId = "com.sample.app1"
32
+ projectFile = "../path/to/project.xcodeproj"
33
+ campaignJSON = "../path/to/campaign.json"
34
+ parametersJSON = "../path/to/parameters.json"
35
+ targetName = "Target"
36
+
37
+ create_remote_config_release_package(
38
+ project_name: projectName,
39
+ app_title: appTitle,
40
+ bundle_id: bundleId,
41
+ project_file_path: projectFile,
42
+ campaign_json_path: campaignJSON,
43
+ parameters_json_path: parametersJSON,
44
+ target_name: targetName
45
+ )
46
+ end
47
+ end
48
+
49
+ ```
50
+ **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)
51
+
52
+ ## Run tests for this plugin
53
+
54
+ To run both the tests, and code style validation, run
55
+
56
+ ```
57
+ rake
58
+ ```
59
+
60
+ To automatically fix many of the styling issues, use
61
+ ```
62
+ rubocop -a
63
+ ```
64
+
65
+ ## Issues and Feedback
66
+
67
+ For any other issues and feedback about this plugin, please submit it to this repository.
68
+
69
+ ## Troubleshooting
70
+
71
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
72
+
73
+ ## Using _fastlane_ Plugins
74
+
75
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
76
+
77
+ ## About _fastlane_
78
+
79
+ _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).
@@ -0,0 +1,189 @@
1
+ require 'fastlane/action'
2
+ require 'xcodeproj'
3
+ require_relative '../helper/create_remote_config_release_package_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class CreateRemoteConfigReleasePackageAction < Action
8
+ def self.description
9
+ "Creates a Remote Config release package"
10
+ end
11
+
12
+ def self.authors
13
+ ["George Nyakundi"]
14
+ end
15
+
16
+ def self.run(params)
17
+ projectName = params[:project_name]
18
+ appTitle = params[:app_title]
19
+ campaignJSON = params[:campaign_json_path]
20
+ parametersJSON = params[:parameters_json_path]
21
+ bundleId = params[:bundle_id]
22
+ projectFile = params[:project_file_path]
23
+ targetName = params[:target_name]
24
+
25
+ locale_regexp = /^[A-Za-z]{2,3}([_-][A-Za-z]{4})?([_-]([A-Za-z]{2}|[0-9]{3}))?$/
26
+
27
+ campaignJSONfilePath = File.expand_path(campaignJSON)
28
+ campaign_hash = begin
29
+ JSON.parse(File.read(campaignJSONfilePath))
30
+ rescue StandardError
31
+ nil
32
+ end
33
+
34
+ parameterJSONfilePath = File.expand_path(parametersJSON)
35
+ parameters_hash = begin
36
+ JSON.parse(File.read(parameterJSONfilePath))
37
+ rescue StandardError
38
+ nil
39
+ end
40
+
41
+ project = Xcodeproj::Project.open(projectFile)
42
+ locales = []
43
+ known_regions = project.root_object.known_regions
44
+ known_regions.each do |region|
45
+ if region =~ locale_regexp
46
+ locales.push(region)
47
+ end
48
+ end
49
+
50
+ if targetName.strip.empty?
51
+ marketingVersion = other_action.get_version_number(xcodeproj: projectFile)
52
+ else
53
+ marketingVersion = other_action.get_version_number(xcodeproj: projectFile, target: targetName)
54
+ end
55
+ versionNumber = marketingVersion.gsub(/[^0-9]/, '').ljust(7, '0')
56
+
57
+ project_hash = {
58
+ "name" => projectName,
59
+ "applications" => [
60
+ "name" => bundleId,
61
+ "title" => appTitle,
62
+ "releases" => [
63
+ "version" => marketingVersion,
64
+ "versionNumber" => versionNumber,
65
+ "parameters" => parameters_hash || {},
66
+ "campaignSlots" => campaign_hash || [],
67
+ "locales" => locales
68
+ ]
69
+ ]
70
+ }
71
+
72
+ File.write("../project.json", project_hash.to_json)
73
+ zip_name = "#{projectName}-project.zip"
74
+
75
+ Dir.chdir("..") do
76
+ sh("zip -FSr #{zip_name} project.json")
77
+ end
78
+
79
+ manifestHash = {
80
+ "name" => projectName,
81
+ "provisioningItems" => [
82
+ "name" => projectName,
83
+ itemType: "remote-config:/project",
84
+ location: "/#{zip_name}"
85
+ ]
86
+ }
87
+
88
+ File.write("../manifest.json", manifestHash.to_json)
89
+
90
+ # Create a folder to where the provisioning package should be saved
91
+ FileUtils.mkdir_p("releases") unless Dir.exist?("releases")
92
+
93
+ Dir.chdir("..") do
94
+ sh("zip -FSr provisioning_package.zip manifest.json #{zip_name}; rm #{zip_name}; rm manifest.json; rm project.json")
95
+ end
96
+ UI.success("provisioning_package.zip creation Completed")
97
+
98
+ FileUtils.mv('../provisioning_package.zip', './releases/provisioning_package.zip')
99
+
100
+ UI.success("provisioning_package.zip has been moved to releases folder successfully")
101
+ end
102
+
103
+ def self.return_value
104
+ # If your method provides a return value, you can describe here what it does
105
+ end
106
+
107
+ def self.details
108
+ "This action creates a zip file with metadata required for release registration in the Remote config service"
109
+ end
110
+
111
+ def self.available_options
112
+ [
113
+ FastlaneCore::ConfigItem.new(
114
+ key: :project_name,
115
+ env_name: "RC_PROJECT_NAME",
116
+ description: "specifies the project name configured in your client apps. Only use alphanumerics and dashes",
117
+ optional: false,
118
+ type: String,
119
+ verify_block: proc do |value|
120
+ UI.user_error!("No project_name given, pass using `project_name: 'project_name'`") unless value && !value.empty?
121
+ end
122
+ ),
123
+ FastlaneCore::ConfigItem.new(
124
+ key: :app_title,
125
+ env_name: "RC_APP_TITLE",
126
+ description: "specifies the title displayed in the Remote Config App",
127
+ optional: false,
128
+ type: String,
129
+ verify_block: proc do |value|
130
+ UI.user_error!("No app_title given, pass using `app_title: 'app_title'`") unless value && !value.empty?
131
+ end
132
+ ),
133
+ FastlaneCore::ConfigItem.new(
134
+ key: :bundle_id,
135
+ env_name: "RC_BUNDLE_ID",
136
+ description: "specifies the bundle id of the project",
137
+ optional: false,
138
+ type: String,
139
+ verify_block: proc do |value|
140
+ UI.user_error!("No App's bundle id given, pass using `bundle_id: 'bundle_id'`") unless value && !value.empty?
141
+ end
142
+ ),
143
+ FastlaneCore::ConfigItem.new(
144
+ key: :campaign_json_path,
145
+ env_name: "RC_CAMPAIGN_JSON_PATH",
146
+ description: "specifies the path to the campaign json slots",
147
+ optional: false,
148
+ type: String,
149
+ verify_block: proc do |value|
150
+ UI.user_error!("No campaign slots json file path given, pass using `campaign_json_path: 'campaign_json_path'`") unless value && !value.empty?
151
+ end
152
+ ),
153
+ FastlaneCore::ConfigItem.new(
154
+ key: :parameters_json_path,
155
+ env_name: "RC_PARAMETERS_JSON_PATH",
156
+ description: "specifies the path to the parameter json file",
157
+ optional: false,
158
+ type: String,
159
+ verify_block: proc do |value|
160
+ UI.user_error!("No parameter.json file path given, pass using `parameters_json_path: 'parameters_json_path'`") unless value && !value.empty?
161
+ end
162
+ ),
163
+ FastlaneCore::ConfigItem.new(
164
+ key: :project_file_path,
165
+ env_name: "RC_PROJECT_FILE_PATH",
166
+ description: "specifies the path to the Xcode project",
167
+ optional: false,
168
+ type: String,
169
+ verify_block: proc do |value|
170
+ UI.user_error!("No Xcode project path given, pass using `project_file_path: 'project_file_path'`") unless value && !value.empty?
171
+ end
172
+ ),
173
+ FastlaneCore::ConfigItem.new(
174
+ key: :target_name,
175
+ env_name: "RC_TARGET",
176
+ description: "specifies the target",
177
+ optional: true,
178
+ type: String
179
+ )
180
+ ]
181
+ end
182
+
183
+ def self.is_supported?(platform)
184
+ [:ios].include?(platform)
185
+ true
186
+ end
187
+ end
188
+ end
189
+ 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 CreateRemoteConfigReleasePackageHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::CreateRemoteConfigReleasePackageHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the create_remote_config_release_package plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module CreateRemoteConfigReleasePackage
3
+ VERSION = "0.2.1"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/create_remote_config_release_package/version'
2
+
3
+ module Fastlane
4
+ module CreateRemoteConfigReleasePackage
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::CreateRemoteConfigReleasePackage.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-create_remote_config_release_package
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - George Nyakundi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
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: fastlane
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.204.3
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 2.204.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
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: rake
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: rspec
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: rspec_junit_formatter
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 1.12.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.12.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-performance
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: rubocop-require_tools
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description:
154
+ email: georgen@backbase.com
155
+ executables: []
156
+ extensions: []
157
+ extra_rdoc_files: []
158
+ files:
159
+ - LICENSE
160
+ - README.md
161
+ - lib/fastlane/plugin/create_remote_config_release_package.rb
162
+ - lib/fastlane/plugin/create_remote_config_release_package/actions/create_remote_config_release_package_action.rb
163
+ - lib/fastlane/plugin/create_remote_config_release_package/helper/create_remote_config_release_package_helper.rb
164
+ - lib/fastlane/plugin/create_remote_config_release_package/version.rb
165
+ homepage: https://github.com/Backbase/fastlane-plugin-create_remote_config_release_package
166
+ licenses:
167
+ - MIT
168
+ metadata: {}
169
+ post_install_message:
170
+ rdoc_options: []
171
+ require_paths:
172
+ - lib
173
+ required_ruby_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '2.5'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ requirements: []
184
+ rubygems_version: 3.5.13
185
+ signing_key:
186
+ specification_version: 4
187
+ summary: Creates a Remote Config release package
188
+ test_files: []