Module: HighFive::IosHelper

Included in:
Thor::Tasks::Dist, Thor::Tasks::Ios
Defined in:
lib/high_five/ios_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.uuid_from_mobileprovision(path) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/high_five/ios_helper.rb', line 3

def IosHelper.uuid_from_mobileprovision(path)
  uuid_found = false
  File.open(path, 'r', :encoding => 'iso-8859-1').each do |line|
    if uuid_found
      line =~ /<string>(.*)<\/string>/
      return $1
    end
    uuid_found = true if line =~ /UUID/
  end
  nil
end

Instance Method Details

#info_plist_path(target = nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/high_five/ios_helper.rb', line 30

def info_plist_path(target=nil)
  root_dir = ios_path
  target = "*" if target.nil?
  Dir["#{root_dir}/**/#{target}-Info.plist", "#{root_dir}/**/Info.plist"].each do |path|
    next if path =~ /\/build\//
    next if path =~ /\.xcarchive/
    return path
  end
  raise "Couldn't find infoplist in #{root_dir}"
end

#ios_icon_sizesObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/high_five/ios_helper.rb', line 56

def ios_icon_sizes
  {
    old_iphone: 57,
    old_iphone_retina: 114,
    iphone_retina: 120,
    old_ipad: 72,
    old_ipad_retina: 177,
    ipad: 76,
    ipad_retina: 152,
    old_spotlight: 29,
    old_spotlight_retina: 58,
    spotlight: 40,
    spotlight_retina: 80,
    spotlight_ipad: 50,
    spotlight_ipad_retina: 100
  }
end

#ios_pathObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/high_five/ios_helper.rb', line 16

def ios_path
  if options[:platform_path]
    ios_path = File.expand_path options[:platform_path]
  else
    ios_path = File.dirname xcodeproj_path
  end

  if !ios_path
    raise "Couldn't find the path of the xcodeproj."
  end

  ios_path
end

#xcodeproj_pathObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/high_five/ios_helper.rb', line 41

def xcodeproj_path
  platform_config = base_config.build_platform_config(:ios)
  destination_dir = platform_config.destination
  if platform_config.cordova_path
    destination_dir ||= "#{platform_config.cordova_path}/platforms/ios"
  end
  root_dir = destination_dir
  while true
    glob = Dir[File.join(root_dir, "*.xcodeproj")]
    return glob.first if (glob.length > 0)
    root_dir = File.expand_path("..", root_dir)
    raise "Couldn't find xcodeproj near #{destination_dir}" if root_dir == '/'
  end
end