Class: Gym::PackageCommandGeneratorXcode7

Inherits:
Object
  • Object
show all
Defined in:
lib/gym/generators/package_command_generator_xcode7.rb

Overview

Responsible for building the fully working xcodebuild command

Class Method Summary collapse

Class Method Details

.config_pathObject

The path the config file we use to sign our app



58
59
60
61
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 58

def config_path
  Gym.cache[:config_path] ||= "/tmp/gym_config_#{Time.now.to_i}.plist"
  return Gym.cache[:config_path]
end

.dsym_pathObject

The path the the dsym file for this app. Might be nil



53
54
55
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 53

def dsym_path
  Dir[BuildCommandGenerator.archive_path + "/**/*.app.dSYM"].last
end

.generateObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 10

def generate
  print_legacy_information unless Helper.fastlane_enabled?

  parts = ["/usr/bin/xcrun xcodebuild -exportArchive"]
  parts += options
  parts += pipe

  File.write(config_path, config_content) # overwrite everytime. Could be optimized

  parts
end

.ipa_pathObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 41

def ipa_path
  unless Gym.cache[:ipa_path]
    path = Dir[File.join(temporary_output_path, "*.ipa")].last
    ErrorHandler.handle_empty_archive unless path

    Gym.cache[:ipa_path] = File.join(temporary_output_path, "#{Gym.config[:output_name]}.ipa")
    FileUtils.mv(path, Gym.cache[:ipa_path]) if File.expand_path(path).downcase != File.expand_path(Gym.cache[:ipa_path]).downcase
  end
  Gym.cache[:ipa_path]
end

.optionsObject



22
23
24
25
26
27
28
29
30
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 22

def options
  options = []

  options << "-exportOptionsPlist '#{config_path}'"
  options << "-archivePath '#{BuildCommandGenerator.archive_path}'"
  options << "-exportPath '#{temporary_output_path}'"

  options
end

.pipeObject



32
33
34
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 32

def pipe
  [""]
end

.temporary_output_pathObject

We export the ipa into this directory, as we can’t specify the ipa file directly



37
38
39
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 37

def temporary_output_path
  Gym.cache[:temporary_output_path] ||= File.join("/tmp", Time.now.to_i.to_s)
end