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



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

def config_path
  @config_path ||= "/tmp/gym_config_#{Time.now.to_i}.plist"
  return @config_path
end

.dsym_pathObject

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



47
48
49
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 47

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

.generateObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 5

def generate
  print_legacy_information

  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



36
37
38
39
40
41
42
43
44
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 36

def ipa_path
  unless @ipa_path
    path = Dir[File.join(temporary_output_path, "*.ipa")].last

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

.optionsObject



17
18
19
20
21
22
23
24
25
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 17

def options
  options = []

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

  options
end

.pipeObject



27
28
29
# File 'lib/gym/generators/package_command_generator_xcode7.rb', line 27

def pipe
  [""]
end

.temporary_output_pathObject

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



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

def temporary_output_path
  @temporary_output_path ||= File.join("/tmp", Time.now.to_i.to_s)
end