Class: Wox::Packager

Inherits:
Task
  • Object
show all
Includes:
Environment
Defined in:
lib/wox/packager.rb

Instance Attribute Summary

Attributes included from Environment

#environment

Instance Method Summary collapse

Methods included from Environment

#initialize

Methods inherited from Task

#run_command

Instance Method Details

#find_matching_mobile_provision(match_text) ⇒ Object



21
22
23
# File 'lib/wox/packager.rb', line 21

def find_matching_mobile_provision match_text
  `grep -rl '#{match_text}' '#{ENV['HOME']}/Library/MobileDevice/Provisioning\ Profiles/'`.strip
end

#packageObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/wox/packager.rb', line 5

def package
  configuration, sdk, ipa_file, build_dir = environment[:configuration], environment[:sdk], environment[:ipa_file], environment[:build_dir]

  app_file = File.join build_dir, "#{configuration}-#{sdk}", environment[:app_file]
  app_file += ".app" unless app_file =~ /\.app^/
  
  fail "Couldn't find #{app_file}" unless File.exists? app_file

  provisioning_profile_file = find_matching_mobile_provision environment[:provisioning_profile]
  fail "Unable to find matching provisioning profile for '#{options[:provisioning_profile]}'" if provisioning_profile_file.empty?
      
  puts "Creating #{ipa_file}"
  log_file = File.join build_dir, "ipa.log"
  run_command "xcrun -sdk #{sdk} PackageApplication -v '#{app_file}' -o '#{File.expand_path ipa_file}' --sign '#{environment[:developer_certificate]}' --embed '#{provisioning_profile_file}'", :results => log_file
end