Module: XcodeFastlane

Defined in:
lib/xcode_fastlane.rb,
lib/xcode_fastlane/cli.rb,
lib/xcode_fastlane/version.rb

Overview

Main module for helper methods and CLI.

Defined Under Namespace

Classes: CLI

Constant Summary collapse

VERSION =
"1.2.1"

Class Method Summary collapse

Class Method Details

.checkout_branch(name) ⇒ Object

Creates and checks out a new branch



43
44
45
46
# File 'lib/xcode_fastlane.rb', line 43

def self.checkout_branch(name)
  git = Git.open(".")
  git.branch(name).checkout
end

.product_bundle_id(target_name = nil) ⇒ Object

Returns product bundle identifier for the given target or the first one found, if target_name is nil.

Arguments:

target_name: (String) The name of the target to fetch identifier from. Defaults to first target.


30
31
32
33
34
# File 'lib/xcode_fastlane.rb', line 30

def self.product_bundle_id(target_name = nil)
  scheme = project.native_targets.find { |target| !target_name || target.name == target_name }
  build_configuration = scheme.build_configurations.first
  build_configuration.build_settings["PRODUCT_BUNDLE_IDENTIFIER"]
end

.product_nameObject

Returns the product name, retrieved from the application path.



37
38
39
40
# File 'lib/xcode_fastlane.rb', line 37

def self.product_name
  product = project.products.select { |p| p.explicit_file_type == "wrapper.application" }.first
  product.path.split(".").first
end

.projectObject

Loads and returns the Xcode project file.



10
11
12
# File 'lib/xcode_fastlane.rb', line 10

def self.project
  @project ||= Xcodeproj::Project.open(Pathname.glob("../*.xcodeproj").first)
end

.skuObject

Generates an SKU Requires environment: PRODUCE_PLATFORM to be set.



21
22
23
24
# File 'lib/xcode_fastlane.rb', line 21

def self.sku
  platform = ENV.fetch("PRODUCE_PLATFORM")
  CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) + ".#{platform}"
end

.targetObject

Returns the first target



15
16
17
# File 'lib/xcode_fastlane.rb', line 15

def self.target
  project.targets.first
end