Class: Nixenvironment::Archiver

Inherits:
Object
  • Object
show all
Defined in:
lib/nixenvironment/archiver.rb

Defined Under Namespace

Classes: ProfileInfo

Constant Summary collapse

ENTITLEMENTS_KEY =
"Entitlements"
APPLICATION_IDENTIFIER_KEY =
"application-identifier"
KEYCHAIN_ACCESS_GROUPS_KEY =
"keychain-access-groups"
PROFILE_TYPE_DEVELOPER =
'developer'
PROFILE_TYPE_ADHOC =
'adhoc'
PROFILE_TYPE_APPSTORE =
'appstore'
AVAILABLE_PROFILE_TYPES =
[PROFILE_TYPE_DEVELOPER, PROFILE_TYPE_ADHOC, PROFILE_TYPE_APPSTORE]

Class Method Summary collapse

Class Method Details

.make_macos_zipObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/nixenvironment/archiver.rb', line 62

def make_macos_zip
  load_last_build_vars = BuildEnvVarsLoader.load_last_build_vars
  built_products_dir   = load_last_build_vars[BUILT_PRODUCTS_DIR_KEY].presence
  executable_name      = load_last_build_vars[EXECUTABLE_NAME_KEY].presence
  target_name          = load_last_build_vars[TARGET_NAME_KEY].presence
  configuration        = load_last_build_vars[CONFIGURATION_KEY].presence
  app_product          = load_last_build_vars[APP_PRODUCT_KEY].presence

  new_ipa_name = "#{executable_name}-#{target_name}-#{configuration}"
  new_ipa_path = File.join(built_products_dir, new_ipa_name) + ZIP_EXT
  puts
  puts "IPA_PRODUCT = #{new_ipa_path}"
  puts

  Dir.mktmpdir do |tmp_dir|
    dest_app_dir     = File.join(tmp_dir, new_ipa_name)
    dest_app_product = File.join(dest_app_dir, File.basename(app_product))

    puts "--> Create '#{dest_app_dir}' ..."
    Dir.mkdir(dest_app_dir)

    puts "--> Copy '#{app_product}' into '#{dest_app_product}' ..."
    FileUtils.cp_r(app_product, dest_app_product)

    if Dir.exist?(new_ipa_path)
      puts "--> Remove old '#{new_ipa_path}' ..."
      FileUtils.rm_rf(new_ipa_path)
    end

    puts "--> Zip '#{tmp_dir}' into '#{new_ipa_path}' ..."
    Dir.chdir(tmp_dir) { system("/usr/bin/zip --symlinks --verbose --recurse-paths '#{new_ipa_path}' .") }
  end

  ipa_bundle_id = get_bundle_id(File.join(app_product, 'Contents'))

  system("echo \"\n
#{IPA_PRODUCT_KEY}='#{new_ipa_path}'
#{IPA_BUNDLE_ID_KEY}='#{ipa_bundle_id}'
#{NAME_FOR_DEPLOYMENT_KEY}='#{configuration}'
    \" >> #{AUTOGENERATED_LAST_BUILD_VARS}")
end

.make_resigned_ipa_for_adhocObject



45
46
47
# File 'lib/nixenvironment/archiver.rb', line 45

def make_resigned_ipa_for_adhoc
  make_ipa(PROFILE_TYPE_ADHOC, '-Resigned-AdHoc', IPA_PRODUCT_RESIGNED_ADHOC_KEY, IPA_BUNDLE_ID_RESIGNED_ADHOC_KEY, NAME_FOR_DEPLOYMENT_RESIGNED_ADHOC_KEY)
end

.make_resigned_ipa_for_appstoreObject



49
50
51
# File 'lib/nixenvironment/archiver.rb', line 49

def make_resigned_ipa_for_appstore
  make_ipa(PROFILE_TYPE_APPSTORE, '-Resigned-Appstore', IPA_PRODUCT_RESIGNED_APPSTORE_KEY, IPA_BUNDLE_ID_RESIGNED_APPSTORE_KEY, NAME_FOR_DEPLOYMENT_RESIGNED_APPSTORE_KEY)
end

.make_resigned_ipa_for_deviceObject



41
42
43
# File 'lib/nixenvironment/archiver.rb', line 41

def make_resigned_ipa_for_device
  make_ipa(PROFILE_TYPE_DEVELOPER, '-Resigned', IPA_PRODUCT_RESIGNED_DEVICE_KEY, IPA_BUNDLE_ID_RESIGNED_DEVICE_KEY, NAME_FOR_DEPLOYMENT_RESIGNED_DEVICE_KEY)
end

.make_signed_ipaObject



37
38
39
# File 'lib/nixenvironment/archiver.rb', line 37

def make_signed_ipa
  make_ipa(PROFILE_TYPE_DEVELOPER, nil, IPA_PRODUCT_KEY, IPA_BUNDLE_ID_KEY, NAME_FOR_DEPLOYMENT_KEY)
end

.make_webgl_zip(build_path) ⇒ Object



53
54
55
56
57
58
59
60
# File 'lib/nixenvironment/archiver.rb', line 53

def make_webgl_zip(build_path)
  built_products_dir   = build_path
  
  new_zip_name = "WebGLBuild"
  new_zip_path = File.join(built_products_dir, new_zip_name) + ZIP_EXT
  
  Dir.chdir(built_products_dir) { system("/usr/bin/zip --symlinks --verbose --recurse-paths '#{new_zip_path}' .") }
end