Module: Fastlane::Helper::ConfigurationHelper
- Included in:
- BranchHelper
- Defined in:
- lib/fastlane/plugin/branch/helper/configuration_helper.rb
Instance Method Summary collapse
- #app_link_subdomains_from_params(params) ⇒ Object
- #custom_domains_from_params(params) ⇒ Object
- #domains_from_params(params) ⇒ Object
- #keys_from_params(params) ⇒ Object
- #xcodeproj_path_from_params(params) ⇒ Object
Instance Method Details
#app_link_subdomains_from_params(params) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fastlane/plugin/branch/helper/configuration_helper.rb', line 47 def app_link_subdomains_from_params(params) app_link_subdomain = params[:app_link_subdomain] live_key = params[:live_key] test_key = params[:test_key] return [] if live_key.nil? and test_key.nil? return [] if app_link_subdomain.nil? domains = [] unless live_key.nil? domains += [ "#{app_link_subdomain}.app.link", "#{app_link_subdomain}-alternate.app.link" ] end unless test_key.nil? domains += [ "#{app_link_subdomain}.test-app.link", "#{app_link_subdomain}-alternate.test-app.link" ] end domains end |
#custom_domains_from_params(params) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fastlane/plugin/branch/helper/configuration_helper.rb', line 70 def custom_domains_from_params(params) domains = params[:domains] return [] if domains.nil? if domains.kind_of? Array domains = domains.map(&:to_s) elsif domains.kind_of? String domains = domains.split(",") else raise ArgumentError, "Unsupported type #{domains.class.name} for :domains key" end domains end |
#domains_from_params(params) ⇒ Object
41 42 43 44 45 |
# File 'lib/fastlane/plugin/branch/helper/configuration_helper.rb', line 41 def domains_from_params(params) app_link_subdomains = app_link_subdomains_from_params params custom_domains = custom_domains_from_params params (app_link_subdomains + custom_domains).uniq end |
#keys_from_params(params) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/fastlane/plugin/branch/helper/configuration_helper.rb', line 4 def keys_from_params(params) live_key = params[:live_key] test_key = params[:test_key] keys = {} keys[:live] = live_key unless live_key.nil? keys[:test] = test_key unless test_key.nil? keys end |
#xcodeproj_path_from_params(params) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fastlane/plugin/branch/helper/configuration_helper.rb', line 13 def xcodeproj_path_from_params(params) return params[:xcodeproj] if params[:xcodeproj] # Adapted from commit_version_bump # https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/actions/commit_version_bump.rb#L21 # This may not be a git project. Search relative to the Gemfile. repo_path = Bundler.root all_xcodeproj_paths = Dir[File.(File.join(repo_path, '**/*.xcodeproj'))] # find an xcodeproj (ignoring the Cocoapods one) xcodeproj_paths = Fastlane::Actions.ignore_cocoapods_path(all_xcodeproj_paths) # no projects found: error UI.user_error!('Could not find a .xcodeproj in the current repository\'s working directory.') and return nil if xcodeproj_paths.count == 0 # too many projects found: error if xcodeproj_paths.count > 1 repo_pathname = Pathname.new repo_path relative_projects = xcodeproj_paths.map { |e| Pathname.new(e).relative_path_from(repo_pathname).to_s }.join("\n") UI.user_error!("Found multiple .xcodeproj projects in the current repository's working directory. Please specify your app's main project: \n#{relative_projects}") return nil end # one project found: great xcodeproj_paths.first end |