Class: BranchIOCLI::Commands::SetupCommand
- Defined in:
- lib/branch_io_cli/commands/setup_command.rb
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#initialize(options) ⇒ SetupCommand
constructor
A new instance of SetupCommand.
-
#run! ⇒ Object
rubocop: disable Metrics/PerceivedComplexity.
Methods inherited from Command
Constructor Details
#initialize(options) ⇒ SetupCommand
Returns a new instance of SetupCommand.
4 5 6 7 8 9 |
# File 'lib/branch_io_cli/commands/setup_command.rb', line 4 def initialize() super config_helper. @keys = config_helper.keys @domains = config_helper.all_domains end |
Instance Method Details
#run! ⇒ Object
rubocop: disable Metrics/PerceivedComplexity
12 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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/branch_io_cli/commands/setup_command.rb', line 12 def run! xcodeproj = config_helper.xcodeproj case config_helper.sdk_integration_mode when :cocoapods if File.exist? config_helper.podfile_path helper.update_podfile else helper.add_cocoapods end when :carthage if File.exist? config_helper.cartfile_path helper.update_cartfile , xcodeproj else helper.add_carthage end when :direct helper.add_direct end target_name = .target # may be nil is_app_target = config_helper.target.extension_target_type? if is_app_target && .validate && !helper.validate_team_and_bundle_ids_from_aasa_files(xcodeproj, target_name, @domains) say "Universal Link configuration failed validation." helper.errors.each { |error| say " #{error}" } return unless .force elsif is_app_target && .validate say "Universal Link configuration passed validation. ✅" end # the following calls can all raise IOError helper.add_keys_to_info_plist xcodeproj, target_name, @keys helper.add_branch_universal_link_domains_to_info_plist xcodeproj, target_name, @domains if is_app_target helper.ensure_uri_scheme_in_info_plist if is_app_target # does nothing if already present new_path = helper.add_universal_links_to_project xcodeproj, target_name, @domains, false if is_app_target `git add #{new_path}` if .commit && new_path helper.add_system_frameworks xcodeproj, target_name, .frameworks unless .frameworks.nil? || .frameworks.empty? xcodeproj.save helper.patch_source xcodeproj if .patch_source return unless .commit changes = helper.changes.to_a.map { |c| Pathname.new(File.(c)).relative_path_from(Pathname.pwd).to_s } `git commit #{changes.join(" ")} -m '[branch_io_cli] Branch SDK integration'` end |