Class: HighFive::Thor::Tasks::Ios

Inherits:
HighFive::Thor::Task show all
Includes:
ImageHelper, IosHelper, Thor::Actions
Defined in:
lib/high_five/thor/tasks/ios.rb

Instance Method Summary collapse

Methods included from ImageHelper

#replace_image

Methods included from IosHelper

#info_plist_path, #ios_icon_sizes, #ios_path, uuid_from_mobileprovision, #xcodeproj_path

Methods inherited from HighFive::Thor::Task

inherited

Instance Method Details

#set_icon(path) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/high_five/thor/tasks/ios.rb', line 47

def set_icon(path)
  icon_files = plist['CFBundleIcons']["CFBundlePrimaryIcon"]["CFBundleIconFiles"]
  icon_files += [ plist['CFBundleIconFile'] ]
  icon_files += plist['CFBundleIcons~ipad']["CFBundlePrimaryIcon"]["CFBundleIconFiles"]
  icon_files.each do |icon_entry|
    icon_file_name = icon_entry
    unless icon_entry.end_with? ".png"
      icon_file_name += ".png"
    end

    # look in a directory named after the target first, if it's present
    # This helps with multi-target apps
    old_icon_path = Dir[File.join(ios_path, "#{target}/**/#{icon_file_name}")].first
    old_icon_path = Dir[File.join(ios_path, "**/#{icon_file_name}")].first if old_icon_path.nil?

    if old_icon_path.nil?
      puts "Skipping #{icon_entry} because the file is missing.  This will cause problems with app store submission"
      next
    end
    print "Replacing #{old_icon_path}..."
    old_image = ChunkyPNG::Image.from_file(old_icon_path)
    puts "#{old_image.width}x#{old_image.height}"
    replace_image(old_icon_path, path)
  end
end

#set_propertyObject



36
37
38
39
40
41
42
# File 'lib/high_five/thor/tasks/ios.rb', line 36

def set_property
  unless options[:key] && options[:value]
    raise "Need to set key and value options"
  end
  set_plist_property options[:key], options[:value]
  write_plist
end

#set_versionObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/high_five/thor/tasks/ios.rb', line 18

def set_version
  if options[:version]
    set_plist_property "CFBundleShortVersionString", options[:version]
  end

  if options[:build_number]
    set_plist_property "CFBundleVersion", options[:build_number]
  end

  write_plist
end