Module: DeployGate::Builds::Ios

Defined in:
lib/deploygate/builds/ios.rb,
lib/deploygate/builds/ios/export.rb,
lib/deploygate/builds/ios/analyze.rb,
lib/deploygate/builds/ios/set_profile.rb

Defined Under Namespace

Classes: Analyze, Export, NotSupportExportMethodError, SetProfile

Constant Summary collapse

WORK_DIR_EXTNAME =
'.xcworkspace'
PROJECT_DIR_EXTNAME =
'.xcodeproj'

Class Method Summary collapse

Class Method Details

.build(ios_analyze, target_scheme, codesigning_identity, export_method = Export::AD_HOC) ⇒ String

Parameters:

  • ios_analyze (Analyze)
  • target_scheme (String)
  • codesigning_identity (String)
  • export_method (String) (defaults to: Export::AD_HOC)

Returns:

  • (String)

Raises:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/deploygate/builds/ios.rb', line 16

def build(ios_analyze, target_scheme, codesigning_identity, export_method = Export::AD_HOC)
  raise NotSupportExportMethodError, 'Not support export' unless Export::SUPPORT_EXPORT_METHOD.include?(export_method)

  values = {
      :export_method => export_method,
      :workspace => ios_analyze.build_workspace,
      :configuration => Analyze::BUILD_CONFIGRATION,
      :scheme => target_scheme,
      :codesigning_identity => codesigning_identity
  }
  v = FastlaneCore::Configuration.create(Gym::Options.available_options, values)
  absolute_ipa_path = File.expand_path(Gym::Manager.new.work(v))
  absolute_dsym_path = absolute_ipa_path.gsub(".ipa", ".app.dSYM.zip") # TODO: upload to deploygate

  absolute_ipa_path
end

.find_workspaces(base_path) ⇒ Array

Parameters:

  • base_path (String)
  • current_only (Boolean)

Returns:

  • (Array)


57
58
59
60
61
62
63
64
65
66
67
# File 'lib/deploygate/builds/ios.rb', line 57

def find_workspaces(base_path)
  projects = []
  Find.find(base_path) do |path|
    next if path == base_path
    if File.extname(path) == WORK_DIR_EXTNAME
      projects.push(path)
    end
  end

  projects
end

.ios_root?(base_path) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
49
50
51
52
# File 'lib/deploygate/builds/ios.rb', line 45

def ios_root?(base_path)
  Find.find(base_path) do |path|
    next if path == base_path
    return true if workspace?(path) || project?(path)
    Find.prune if FileTest.directory?(path)
  end
  false
end

.project?(path) ⇒ Boolean

Parameters:

  • path (String)

Returns:

  • (Boolean)


41
42
43
# File 'lib/deploygate/builds/ios.rb', line 41

def project?(path)
  PROJECT_DIR_EXTNAME == File.extname(path)
end

.project_root_path(path) ⇒ String

Parameters:

  • path (String)

Returns:

  • (String)


71
72
73
74
75
76
77
# File 'lib/deploygate/builds/ios.rb', line 71

def project_root_path(path)
  result = path
  if workspace?(path) || project?(path)
    result = project_root_path(File.dirname(path))
  end
  result
end

.workspace?(path) ⇒ Boolean

Parameters:

  • path (String)

Returns:

  • (Boolean)


35
36
37
# File 'lib/deploygate/builds/ios.rb', line 35

def workspace?(path)
  WORK_DIR_EXTNAME == File.extname(path)
end