remove unused actions and methods
This commit is contained in:
parent
5be3987ea3
commit
e44811d1b7
|
|
@ -1,7 +1,6 @@
|
|||
$appName = File.basename(Dir['../*.xcworkspace'].first, '.*')
|
||||
|
||||
require_relative 'fastlane/touchlane/lib/touchlane'
|
||||
require_relative 'managers/managers'
|
||||
|
||||
# ugly hack to add support for custom storage
|
||||
|
||||
|
|
@ -120,7 +119,6 @@ private_lane :buildConfiguration do |options|
|
|||
installDependencies(options)
|
||||
|
||||
run_code_generation_phase_if_needed(options)
|
||||
generate_enabled_features_extension_if_needed(options)
|
||||
|
||||
if !(options[:uploadToFabric] || options[:uploadToAppStore])
|
||||
options[:skip_package_ipa] = true
|
||||
|
|
@ -194,28 +192,6 @@ private_lane :buildArchive do |options|
|
|||
)
|
||||
end
|
||||
|
||||
lane :CreatePushCertificate do |options|
|
||||
configuration = get_configuration_for_type(options[:type] || "development")
|
||||
options = configuration.to_options.merge(options)
|
||||
|
||||
certificates_path = File.expand_path "../Certificates"
|
||||
Dir.mkdir(certificates_path) unless File.directory?(certificates_path)
|
||||
|
||||
app_identifier = options[:app_identifier]
|
||||
|
||||
get_push_certificate(
|
||||
development: options[:development].nil? ? true : options[:development],
|
||||
generate_p12: true,
|
||||
active_days_limit: 30, # create new certificate if old one will expire in 30 days
|
||||
save_private_key: false,
|
||||
app_identifier: (app_identifier.is_a? Array) ? app_identifier.first : app_identifier,
|
||||
username: options[:username] || options[:apple_id],
|
||||
team_id: options[:team_id],
|
||||
p12_password: "123", # empty password won't work with Pusher
|
||||
output_path: certificates_path
|
||||
)
|
||||
end
|
||||
|
||||
lane :SyncCodeSigning do |options|
|
||||
configuration_type = Touchlane::ConfigurationType.from_type(options[:type])
|
||||
options = fill_up_options_using_configuration_type(options, configuration_type)
|
||||
|
|
@ -414,34 +390,6 @@ def get_google_services_plist_path(app_target_folder_name, configuration_type)
|
|||
File.expand_path "../#{app_target_folder_name}/Resources/GoogleService-Info.plist"
|
||||
end
|
||||
|
||||
def generate_enabled_features_extension_if_needed(options)
|
||||
app_target_folder_name = options[:appName] || $appName
|
||||
|
||||
project_enabled_features_file_path = File.expand_path "../#{app_target_folder_name}/Resources/Features/Enabled.swift"
|
||||
build_settings_file_path = File.expand_path "../common/build_settings.yaml"
|
||||
|
||||
unless is_feature_extension_needed?(options, project_enabled_features_file_path)
|
||||
return
|
||||
end
|
||||
|
||||
if options[:features].nil?
|
||||
builder_features_list = [] # If Enabled.swift exists and features option is nil we need to create empty extension to avoid unexpected features
|
||||
else
|
||||
builder_features_list = options[:features]
|
||||
.split(",").map { |feature_name| feature_name.strip } # [ "Feature1", "Feature2", "Feature3" ]
|
||||
end
|
||||
|
||||
build_settings_features_list = Managers::FileManager.load_from_file_YAML(build_settings_file_path)["features"]
|
||||
|
||||
enabled_features_extension = Touchlane::Features.generate_enabled_features_extension(builder_features_list, build_settings_features_list)
|
||||
|
||||
Managers::FileManager.save_data_to_file(project_enabled_features_file_path, enabled_features_extension)
|
||||
end
|
||||
|
||||
def is_feature_extension_needed?(options, project_enabled_features_file_path)
|
||||
!options[:features].nil? || File.exists?(project_enabled_features_file_path)
|
||||
end
|
||||
|
||||
def set_xcconfig_for_configuration_of_project(lane_name, configuration, xcodeproj_path)
|
||||
require 'xcodeproj'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
require_relative '../../../../managers/managers'
|
||||
require_relative '../../../../templates/templates'
|
||||
|
||||
module Touchlane
|
||||
class Features
|
||||
|
||||
def self.generate_enabled_features_extension(builder_features_list, build_settings_features_list)
|
||||
|
||||
# Check is entered features contains in configuration file
|
||||
features_diff = builder_features_list - build_settings_features_list
|
||||
|
||||
unless features_diff.empty?
|
||||
raise "Unexpected features: " + features_diff.join(', ')
|
||||
end
|
||||
|
||||
# Generate enabled features extension from feature names
|
||||
enabled_features_extension_template = Templates::FeatureTemplates.enabled_features_extension
|
||||
utils = Managers::TemplateManager.new(builder_features_list)
|
||||
|
||||
utils.render(enabled_features_extension_template).strip
|
||||
end
|
||||
|
||||
private_class_method :new
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
require 'yaml'
|
||||
require 'json'
|
||||
|
||||
module Managers
|
||||
class FileManager
|
||||
|
||||
def self.save_data_to_file(path, data)
|
||||
unless File.exists? path
|
||||
raise "Unable to save data to file at #{path}"
|
||||
else
|
||||
File.open(path, "w") do |f|
|
||||
f.write(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.load_from_file_YAML(path)
|
||||
unless File.exists? path
|
||||
raise "Unable to load data from file at #{path}"
|
||||
else
|
||||
YAML.load_file(path)
|
||||
end
|
||||
end
|
||||
|
||||
def self.save_data_to_file_in_json(path, data)
|
||||
json_data = JSON.pretty_generate(data)
|
||||
save_data_to_file(path, json_data)
|
||||
end
|
||||
|
||||
private_class_method :new
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
require 'erb'
|
||||
|
||||
module Managers
|
||||
class TemplateManager
|
||||
|
||||
include ERB::Util
|
||||
|
||||
attr_accessor :items
|
||||
|
||||
def initialize(items)
|
||||
@items = items
|
||||
end
|
||||
|
||||
def render(template)
|
||||
ERB.new(template).result(binding)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
module Managers
|
||||
require_relative "lib/file_manager"
|
||||
require_relative "lib/template_manager"
|
||||
end
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
module Templates
|
||||
require_relative "templates/features_templates"
|
||||
end
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
module Templates
|
||||
module FeatureTemplates
|
||||
|
||||
def self.features_enum
|
||||
"
|
||||
// MARK: - Generated feature toggles
|
||||
|
||||
public enum Feature: String, Codable, RawRepresentable, CaseIterable {
|
||||
<% for @item in @items %>
|
||||
case <%= @item %>
|
||||
<% end %>
|
||||
}
|
||||
"
|
||||
end
|
||||
|
||||
def self.enabled_features_extension
|
||||
"
|
||||
// MARK: - Generated enabled features
|
||||
|
||||
public extension Feature {
|
||||
|
||||
static var enabled: [Feature] {
|
||||
[
|
||||
<% for @item in @items %>
|
||||
\.<%= @item %>,
|
||||
<% end %>
|
||||
]
|
||||
}
|
||||
}
|
||||
"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue