Class: BranchIOCLI::Helper::BranchHelper

Inherits:
Object
  • Object
show all
Extended by:
AndroidHelper, IOSHelper
Defined in:
lib/branch_io_cli/helper/branch_helper.rb

Constant Summary

Constants included from IOSHelper

IOSHelper::APPLINKS, IOSHelper::ASSOCIATED_DOMAINS, IOSHelper::CODE_SIGN_ENTITLEMENTS, IOSHelper::DEVELOPMENT_TEAM, IOSHelper::PRODUCT_BUNDLE_IDENTIFIER, IOSHelper::RELEASE_CONFIGURATION

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from IOSHelper

add_branch_universal_link_domains_to_info_plist, add_keys_to_info_plist, add_system_frameworks, add_universal_links_to_project, app_ids_from_aasa_file, contents_of_aasa_file, domains_from_project, expanded_build_setting, patch_app_delegate_objc, patch_app_delegate_swift, patch_cartfile, patch_podfile, target_from_project, team_and_bundle_from_app_id, update_info_plist_setting, update_team_and_bundle_ids, update_team_and_bundle_ids_from_aasa_file, validate_project_domains, validate_team_and_bundle_ids, validate_team_and_bundle_ids_from_aasa_files

Methods included from AndroidHelper

add_intent_filter_to_activity, add_intent_filters_to_android_manifest, add_keys_to_android_manifest, add_metadata_to_manifest, app_link_data_elements, find_activity, remove_existing_domains, uri_scheme_data_element

Class Attribute Details

.changesObject

An array of file paths (Strings) that were modified



10
11
12
# File 'lib/branch_io_cli/helper/branch_helper.rb', line 10

def changes
  @changes
end

.errorsObject

An array of error messages (Strings) from validation



11
12
13
# File 'lib/branch_io_cli/helper/branch_helper.rb', line 11

def errors
  @errors
end

Class Method Details

.add_change(change) ⇒ Object



16
17
18
19
# File 'lib/branch_io_cli/helper/branch_helper.rb', line 16

def add_change(change)
  @changes ||= Set.new
  @changes << change.to_s
end

.apply_patch(options) ⇒ Object

Shim around PatternPatch for now



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/branch_io_cli/helper/branch_helper.rb', line 22

def apply_patch(options)
  modified = File.open(options[:files]) do |file|
    PatternPatch::Utilities.apply_patch file.read,
                                        options[:regexp],
                                        options[:text],
                                        options[:global],
                                        options[:mode],
                                        options[:offset] || 0
  end

  File.open(options[:files], "w") do |file|
    file.write modified
  end
end