fastlane-plugin-wpmreleasetoolkit 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +339 -0
- data/README.md +38 -0
- data/bin/drawText +19 -0
- data/ext/drawText/extconf.rb +36 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit.rb +16 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/README.md +20 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb +53 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +171 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb +63 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +103 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +83 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_preflight.rb +54 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +69 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +58 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +77 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +89 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +79 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +68 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb +63 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +79 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +115 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +71 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotifx_prechecks.rb +78 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb +106 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +51 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb +52 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +56 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/circleci_trigger_job_action.rb +63 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb +56 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +59 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +91 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +89 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_list_action.rb +64 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +90 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +170 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +247 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/removebranchprotection_action.rb +57 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setbranchprotection_action.rb +56 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +81 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +96 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_apply_action.rb +139 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_download_action.rb +57 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_setup_action.rb +86 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +139 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb +134 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb +77 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb +79 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +92 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +74 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +78 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +68 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +87 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +114 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +62 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +60 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +70 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +63 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_current_branch_is_hotfix.rb +40 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +52 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +64 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +47 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +60 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +121 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotifx_prechecks.rb +78 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +167 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_translators_strings.rb +93 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +40 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +81 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +56 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +46 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +152 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +359 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +475 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb +91 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +282 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/encryption_helper.rb +51 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb +93 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +224 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +135 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +74 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +80 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +208 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb +348 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +107 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +182 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +399 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/release_notes_helper.rb +21 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +40 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +86 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +5 -0
- metadata +449 -0
@@ -0,0 +1,170 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../../helper/metadata_update_helper.rb'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class GpUpdateMetadataSourceAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
# fastlane will take care of reading in the parameter and fetching the environment variable:
|
9
|
+
UI.message "Parameter .po file path: #{params[:po_file_path]}"
|
10
|
+
UI.message "Release version: #{params[:release_version]}"
|
11
|
+
|
12
|
+
# Init
|
13
|
+
create_block_parsers(params[:release_version], params[:source_files])
|
14
|
+
|
15
|
+
# Do
|
16
|
+
check_source_files(params[:source_files])
|
17
|
+
temp_po_name = create_temp_po(params)
|
18
|
+
swap_po(params[:po_file_path], temp_po_name)
|
19
|
+
|
20
|
+
UI.message "File #{params[:po_file_path]} updated!"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Verifies that all the source files are available
|
24
|
+
# to this action
|
25
|
+
def self.check_source_files(source_files)
|
26
|
+
source_files.values.each do |file_path|
|
27
|
+
UI.user_error!("Couldn't find file at path '#{file_path}'") unless File.exist?(file_path)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Creates a temp po file merging
|
32
|
+
# new data for known tags
|
33
|
+
# and the data already in the original
|
34
|
+
# .po fo the others.
|
35
|
+
def self.create_temp_po(params)
|
36
|
+
orig = params[:po_file_path]
|
37
|
+
target = self.create_target_file_path(orig)
|
38
|
+
|
39
|
+
# Clear if older exists
|
40
|
+
File.delete(target) if File.exist? target
|
41
|
+
|
42
|
+
# Create the new one
|
43
|
+
begin
|
44
|
+
File.open(target, 'a') do |fw|
|
45
|
+
File.open(orig, 'r').each do |fr|
|
46
|
+
write_target_block(fw, fr)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
rescue
|
50
|
+
File.delete(target) if File.exist? target
|
51
|
+
raise
|
52
|
+
end
|
53
|
+
|
54
|
+
target
|
55
|
+
end
|
56
|
+
|
57
|
+
# Deletes the old po and moves the temp one
|
58
|
+
# to the final location
|
59
|
+
def self.swap_po(orig_file_path, temp_file_path)
|
60
|
+
File.delete(orig_file_path) if File.exist? orig_file_path
|
61
|
+
File.rename(temp_file_path, orig_file_path)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Generates the temp file path
|
65
|
+
def self.create_target_file_path(orig_file_path)
|
66
|
+
"#{File.dirname(orig_file_path)}/#{File.basename(orig_file_path, '.*')}.tmp"
|
67
|
+
end
|
68
|
+
|
69
|
+
# Creates the block instances
|
70
|
+
def self.create_block_parsers(release_version, block_files)
|
71
|
+
@blocks = []
|
72
|
+
|
73
|
+
# Inits default handler
|
74
|
+
@blocks.push Fastlane::Helper::UnknownMetadataBlock.new
|
75
|
+
|
76
|
+
# Init special handlers
|
77
|
+
block_files.each do |key, file_path|
|
78
|
+
if key == :release_note
|
79
|
+
@blocks.push Fastlane::Helper::ReleaseNoteMetadataBlock.new(key, file_path, release_version)
|
80
|
+
elsif key == :whats_new
|
81
|
+
@blocks.push Fastlane::Helper::WhatsNewMetadataBlock.new(key, file_path, release_version)
|
82
|
+
else
|
83
|
+
@blocks.push Fastlane::Helper::StandardMetadataBlock.new(key, file_path)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# Sets the default
|
88
|
+
@current_block = @blocks[0]
|
89
|
+
end
|
90
|
+
|
91
|
+
# Manages tags depending on the type
|
92
|
+
def self.write_target_block(fw, line)
|
93
|
+
if is_block_id(line)
|
94
|
+
key = line.split(' ')[1].tr('\"', '')
|
95
|
+
@blocks.each do |block|
|
96
|
+
@current_block = block if block.is_handler_for(key)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
@current_block = @blocks.first if is_comment(line)
|
101
|
+
|
102
|
+
@current_block.handle_line(fw, line)
|
103
|
+
end
|
104
|
+
|
105
|
+
def self.is_block_id(line)
|
106
|
+
line.start_with?('msgctxt')
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.is_comment(line)
|
110
|
+
line.start_with?('#')
|
111
|
+
end
|
112
|
+
|
113
|
+
#####################################################
|
114
|
+
# @!group Documentation
|
115
|
+
#####################################################
|
116
|
+
|
117
|
+
def self.description
|
118
|
+
'Updates a .po file with new data from .txt files'
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.details
|
122
|
+
'You can use this action to update the .po file that contains the string to load to GlotPress for localization.'
|
123
|
+
end
|
124
|
+
|
125
|
+
def self.available_options
|
126
|
+
# Define all options your action supports.
|
127
|
+
|
128
|
+
# Below a few examples
|
129
|
+
[
|
130
|
+
FastlaneCore::ConfigItem.new(key: :po_file_path,
|
131
|
+
env_name: 'FL_UPDATE_METADATA_SOURCE_PO_FILE_PATH',
|
132
|
+
description: 'The path of the .po file to update',
|
133
|
+
is_string: true,
|
134
|
+
verify_block: proc do |value|
|
135
|
+
UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && (!value.empty?)
|
136
|
+
UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
|
137
|
+
end),
|
138
|
+
FastlaneCore::ConfigItem.new(key: :release_version,
|
139
|
+
env_name: 'FL_UPDATE_METADATA_SOURCE_RELEASE_VERSION',
|
140
|
+
description: 'The release version of the app (to use to mark the release notes)',
|
141
|
+
verify_block: proc do |value|
|
142
|
+
UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && (!value.empty?)
|
143
|
+
end),
|
144
|
+
FastlaneCore::ConfigItem.new(key: :source_files,
|
145
|
+
env_name: 'FL_UPDATE_METADATA_SOURCE_SOURCE_FILES',
|
146
|
+
description: 'The hash with the path to the source files and the key to use to include their content',
|
147
|
+
is_string: false,
|
148
|
+
verify_block: proc do |value|
|
149
|
+
UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && (!value.empty?)
|
150
|
+
end),
|
151
|
+
]
|
152
|
+
end
|
153
|
+
|
154
|
+
def self.output
|
155
|
+
end
|
156
|
+
|
157
|
+
def self.return_value
|
158
|
+
# If your method provides a return value, you can describe here what it does
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.authors
|
162
|
+
['loremattei']
|
163
|
+
end
|
164
|
+
|
165
|
+
def self.is_supported?(platform)
|
166
|
+
[:ios, :android].include?(platform)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
@@ -0,0 +1,247 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'fastlane/action'
|
3
|
+
require 'active_support/all'
|
4
|
+
require_relative '../../helper/promo_screenshots_helper.rb'
|
5
|
+
|
6
|
+
module Fastlane
|
7
|
+
module Actions
|
8
|
+
class PromoScreenshotsAction < Action
|
9
|
+
def self.run(params)
|
10
|
+
UI.message 'Creating Promo Screenshots'
|
11
|
+
UI.message "#{self.check_path(params[:orig_folder])} Original Screenshot Source: #{params[:orig_folder]}"
|
12
|
+
UI.message "#{self.check_path(params[:metadata_folder])} Translation source: #{params[:metadata_folder]}"
|
13
|
+
|
14
|
+
config = helper.read_json(params[:config_file])
|
15
|
+
|
16
|
+
translationDirectories = subdirectories_for_path(params[:metadata_folder])
|
17
|
+
imageDirectories = subdirectories_for_path(params[:orig_folder])
|
18
|
+
|
19
|
+
unless helper.can_resolve_path(params[:output_folder])
|
20
|
+
UI.message "✅ Created Output Folder: #{params[:output_folder]}"
|
21
|
+
FileUtils.mkdir_p(params[:output_folder])
|
22
|
+
else
|
23
|
+
UI.message "#{self.check_path(params[:output_folder])} Output Folder: #{params[:output_folder]}"
|
24
|
+
end
|
25
|
+
|
26
|
+
outputDirectory = helper.resolve_path(params[:output_folder])
|
27
|
+
|
28
|
+
## If there are no translated screenshot images (whether it's because they haven't been generated yet,
|
29
|
+
## or because we aren't using them), just use the translated directories.
|
30
|
+
languages = if imageDirectories == []
|
31
|
+
translationDirectories
|
32
|
+
## And vice-versa.
|
33
|
+
elsif translationDirectories == []
|
34
|
+
imageDirectories
|
35
|
+
## If there are original screenshots and translations available, use only locales that exist in both.
|
36
|
+
else
|
37
|
+
imageDirectories & translationDirectories
|
38
|
+
end
|
39
|
+
|
40
|
+
UI.message("💙 Creating Promo Screenshots for: #{languages.join(', ')}")
|
41
|
+
|
42
|
+
confirm_directory_overwrite(params[:output_folder], 'the existing promo screenshots') unless params[:force]
|
43
|
+
|
44
|
+
# Create a hash of devices, keyed by device name
|
45
|
+
devices = config['devices']
|
46
|
+
devices = Hash[devices.map { |device| device['name'] }.zip(devices)]
|
47
|
+
|
48
|
+
stylesheet_path = config['stylesheet']
|
49
|
+
|
50
|
+
entries = build_entries(config['entries'], languages, outputDirectory, params)
|
51
|
+
|
52
|
+
bar = ProgressBar.new(entries.count, :bar, :counter, :eta, :rate)
|
53
|
+
|
54
|
+
Parallel.map(entries, finish: lambda { |_item, _i, _result|
|
55
|
+
bar.increment!
|
56
|
+
}) do |entry|
|
57
|
+
device = devices[entry['device']]
|
58
|
+
|
59
|
+
UI.message("Unable to find device #{entry['device']}.") if device.nil?
|
60
|
+
|
61
|
+
width = device['canvas_size'][0]
|
62
|
+
height = device['canvas_size'][1]
|
63
|
+
|
64
|
+
canvas = helper.create_image(width, height)
|
65
|
+
canvas = helper.draw_background_to_canvas(canvas, entry)
|
66
|
+
|
67
|
+
canvas = helper.draw_device_frame_to_canvas(device, canvas)
|
68
|
+
canvas = helper.draw_caption_to_canvas(entry, canvas, device, stylesheet_path)
|
69
|
+
canvas = helper.draw_screenshot_to_canvas(entry, canvas, device)
|
70
|
+
canvas = helper.draw_attachments_to_canvas(entry, canvas)
|
71
|
+
|
72
|
+
# Automatically create intermediate directories for output
|
73
|
+
output_filename = entry['filename']
|
74
|
+
dirname = File.dirname(output_filename)
|
75
|
+
|
76
|
+
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
77
|
+
|
78
|
+
canvas.write(output_filename)
|
79
|
+
canvas.destroy!
|
80
|
+
|
81
|
+
# Run the GC in the same thread to clean up after RMagick
|
82
|
+
GC.start
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.confirm_directory_overwrite(path, description)
|
87
|
+
if File.exist?(path)
|
88
|
+
if UI.confirm("Do you want to overwrite #{description}?")
|
89
|
+
FileUtils.rm_rf(path)
|
90
|
+
Dir.mkdir(path)
|
91
|
+
else
|
92
|
+
UI.user_error!("Exiting to avoid overwriting #{description}.")
|
93
|
+
end
|
94
|
+
else
|
95
|
+
Dir.mkdir(path)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.subdirectories_for_path(path)
|
100
|
+
subdirectories = []
|
101
|
+
|
102
|
+
return [] unless helper.can_resolve_path(path)
|
103
|
+
|
104
|
+
resolved_path = helper.resolve_path(path)
|
105
|
+
|
106
|
+
Dir.chdir(resolved_path) do
|
107
|
+
subdirectories = Dir['*'].select { |o| File.directory?(o) }.sort
|
108
|
+
end
|
109
|
+
|
110
|
+
subdirectories
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.check_path(path)
|
114
|
+
self.helper.can_resolve_path(path) ? '✅' : '🚫'
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.helper
|
118
|
+
return Fastlane::Helper::PromoScreenshots.new
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.description
|
122
|
+
'Generate promo screenshots'
|
123
|
+
end
|
124
|
+
|
125
|
+
def self.authors
|
126
|
+
['Lorenzo Mattei']
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.return_value
|
130
|
+
# If your method provides a return value, you can describe here what it does
|
131
|
+
end
|
132
|
+
|
133
|
+
def self.details
|
134
|
+
# Optional:
|
135
|
+
'Creates promo screenshots starting from standard ones'
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.available_options
|
139
|
+
[
|
140
|
+
FastlaneCore::ConfigItem.new(key: :orig_folder,
|
141
|
+
env_name: 'PROMOSS_ORIG',
|
142
|
+
description: 'The directory containing the original screenshots',
|
143
|
+
optional: false,
|
144
|
+
is_string: true),
|
145
|
+
FastlaneCore::ConfigItem.new(key: :output_folder,
|
146
|
+
env_name: 'PROMOSS_OUTPUT',
|
147
|
+
description: 'The path of the folder to save the promo screenshots',
|
148
|
+
optional: false,
|
149
|
+
is_string: true),
|
150
|
+
|
151
|
+
FastlaneCore::ConfigItem.new(key: :metadata_folder,
|
152
|
+
env_name: 'PROMOSS_METADATA_FOLDER',
|
153
|
+
description: 'The directory containing the translation data',
|
154
|
+
optional: false,
|
155
|
+
is_string: true),
|
156
|
+
|
157
|
+
FastlaneCore::ConfigItem.new(key: :config_file,
|
158
|
+
env_name: 'PROMOSS_CONFIG_FILE',
|
159
|
+
description: 'The path to the file containing the promo screenshot configuration',
|
160
|
+
optional: true,
|
161
|
+
is_string: true,
|
162
|
+
default_value: 'screenshots.json'),
|
163
|
+
|
164
|
+
FastlaneCore::ConfigItem.new(key: :force,
|
165
|
+
env_name: 'PROMOSS_FORCE_CREATION',
|
166
|
+
description: 'Overwrite existing promo screenshots without asking first?',
|
167
|
+
optional: true,
|
168
|
+
is_string: false,
|
169
|
+
default_value: false),
|
170
|
+
]
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.is_supported?(platform)
|
174
|
+
true
|
175
|
+
end
|
176
|
+
|
177
|
+
def self.build_entries(config_entries, languages, output_directory, params)
|
178
|
+
config_entries
|
179
|
+
.flat_map do |entry|
|
180
|
+
languages.map do |language|
|
181
|
+
newEntry = entry.deep_dup
|
182
|
+
|
183
|
+
# Not every output file will have a screenshot, so handle cases where no
|
184
|
+
# screenshot file is defined
|
185
|
+
if !entry['screenshot'].nil? && !entry['filename'].nil?
|
186
|
+
newEntry['screenshot'] = helper.resolve_path(params[:orig_folder]) + language + entry['screenshot']
|
187
|
+
newEntry['filename'] = output_directory + language + entry['filename']
|
188
|
+
elsif !entry['screenshot'].nil? && entry['filename'].nil?
|
189
|
+
newEntry['screenshot'] = helper.resolve_path(params[:orig_folder]) + language + entry['screenshot']
|
190
|
+
newEntry['filename'] = output_directory + language + entry['screenshot']
|
191
|
+
elsif entry['screenshot'].nil? && !entry['filename'].nil?
|
192
|
+
newEntry['filename'] = output_directory + language + entry['filename']
|
193
|
+
else
|
194
|
+
puts newEntry
|
195
|
+
abort 'Unable to find output file names'
|
196
|
+
end
|
197
|
+
|
198
|
+
newEntry['locale'] = language
|
199
|
+
|
200
|
+
# Localize file paths for text
|
201
|
+
newEntry['text'].sub!('{locale}', language.dup) unless entry['text'].nil?
|
202
|
+
|
203
|
+
# Map attachments paths to their localized versions
|
204
|
+
newEntry['attachments'] = [] if newEntry['attachments'].nil?
|
205
|
+
|
206
|
+
newEntry['attachments'].each do |attachment|
|
207
|
+
## If there are no translated screenshot images (whether it's because they haven't been generated yet,
|
208
|
+
## or because we aren't using them), just use the translated directories.
|
209
|
+
## And vice-versa.
|
210
|
+
## If there are original screenshots and translations available, use only locales that exist in both.
|
211
|
+
# Create a hash of devices, keyed by device name
|
212
|
+
# Not every output file will have a screenshot, so handle cases where no
|
213
|
+
# screenshot file is defined
|
214
|
+
# Localize file paths for text
|
215
|
+
# Map attachments paths to their localized versions
|
216
|
+
# Automatically create intermediate directories for output
|
217
|
+
# Run the GC in the same thread to clean up after RMagick
|
218
|
+
# If your method provides a return value, you can describe here what it does
|
219
|
+
# Optional:
|
220
|
+
attachment['file']&.sub!('{locale}', language.dup)
|
221
|
+
|
222
|
+
## If there are no translated screenshot images (whether it's because they haven't been generated yet,
|
223
|
+
## or because we aren't using them), just use the translated directories.
|
224
|
+
## And vice-versa.
|
225
|
+
## If there are original screenshots and translations available, use only locales that exist in both.
|
226
|
+
# Create a hash of devices, keyed by device name
|
227
|
+
# Not every output file will have a screenshot, so handle cases where no
|
228
|
+
# screenshot file is defined
|
229
|
+
# Localize file paths for text
|
230
|
+
# Map attachments paths to their localized versions
|
231
|
+
# Automatically create intermediate directories for output
|
232
|
+
# Run the GC in the same thread to clean up after RMagick
|
233
|
+
# If your method provides a return value, you can describe here what it does
|
234
|
+
# Optional:
|
235
|
+
attachment['text']&.sub!('{locale}', language.dup)
|
236
|
+
end
|
237
|
+
|
238
|
+
newEntry
|
239
|
+
end
|
240
|
+
end
|
241
|
+
.sort do |x, y|
|
242
|
+
x['filename'] <=> y['filename']
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../../helper/github_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class RemovebranchprotectionAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
repository = params[:repository]
|
9
|
+
branch_name = params[:branch]
|
10
|
+
branch_prot = {}
|
11
|
+
|
12
|
+
branch_url = "https://api.github.com/repos/#{repository}/branches/" + branch_name
|
13
|
+
branch_prot[:restrictions] = { url: branch_url + '/protection/restrictions', users_url: branch_url + '/protection/restrictions/users', teams_url: branch_url + '/protection/restrictions/teams', users: [], teams: [] }
|
14
|
+
branch_prot[:enforce_admins] = nil
|
15
|
+
branch_prot[:required_pull_request_reviews] = { url: branch_url + '/protection/required_pull_request_reviews', dismiss_stale_reviews: false, require_code_owner_reviews: false }
|
16
|
+
|
17
|
+
Fastlane::Helper::GithubHelper.github_client().unprotect_branch(repository, branch_name, branch_prot)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.description
|
21
|
+
"Removes the 'release branch' protection state for the specified branch"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.authors
|
25
|
+
['Lorenzo Mattei']
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.return_value
|
29
|
+
# If your method provides a return value, you can describe here what it does
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.details
|
33
|
+
# Optional:
|
34
|
+
"Sets the 'release branch' protection state for the specified branch"
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.available_options
|
38
|
+
[
|
39
|
+
FastlaneCore::ConfigItem.new(key: :repository,
|
40
|
+
env_name: 'GHHELPER_REPOSITORY',
|
41
|
+
description: 'The remote path of the GH repository on which we work',
|
42
|
+
optional: false,
|
43
|
+
type: String),
|
44
|
+
FastlaneCore::ConfigItem.new(key: :branch,
|
45
|
+
env_name: 'GHHELPER_BRANCH',
|
46
|
+
description: 'The branch to unprotect',
|
47
|
+
optional: false,
|
48
|
+
type: String),
|
49
|
+
]
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.is_supported?(platform)
|
53
|
+
true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|