class Object

Public Instance Methods

append_entitlements(path, entitlements_hash) click to toggle source
# File lib/entitlements.rb, line 11
def append_entitlements(path, entitlements_hash)
        index = 0
        Dir.glob(path) do |file|
                entitlements = `codesign -d --entitlements :- "#{file}" 2>&1`
                plist_entitlements = Plist::parse_xml(entitlements)
                if (plist_entitlements)
                        application_identifier = plist_entitlements["application-identifier"] ? plist_entitlements["application-identifier"] : index.to_s
                        entitlements_hash[application_identifier] = plist_entitlements
                        index = index + 1
                end
        end
end
contained_binary_extensions() click to toggle source
# File lib/contained_binaries_definition.rb, line 1
def contained_binary_extensions
        return ["appex",
                        "app"]
end
extract_zip(file, destination) click to toggle source
# File lib/extract_zip.rb, line 3
def extract_zip(file, destination)
  FileUtils.mkdir_p(destination)

  Zip::File.open(file) do |zip_file|
    zip_file.each do |f|
      fpath = File.join(destination, f.name)
      zip_file.extract(f, fpath) unless File.exist?(fpath)
    end
  end
end
get_entitlements(tempdir_path) click to toggle source
# File lib/entitlements.rb, line 24
def get_entitlements(tempdir_path)
        entitlements_hash = Hash.new

        contained_binary_extensions().each { |extension|
                append_entitlements("#{tempdir_path}/**/*.#{extension}", entitlements_hash)
        }

        if (entitlements_hash.length == 0)
                abort "No entitlements found on contained binaries"
        end

        return entitlements_hash.to_plist
end
get_profiles(tempdir_path, only_expiration) click to toggle source
# File lib/profiles.rb, line 7
def get_profiles(tempdir_path, only_expiration)
        path = "#{tempdir_path}/**/*.mobileprovision"
        profiles = Hash.new
        index = 0
        Dir.glob(path) do |file|
                profile = `security cms -D -i "#{file}" 2>&1`
                plist_profile = Plist::parse_xml(profile)
                if plist_profile
                        app_id = plist_profile["AppIDName"] ? plist_profile["AppIDName"] : index.to_s
                        if only_expiration
                                profiles[app_id] = plist_profile["ExpirationDate"]
                        else
                                profiles[app_id] = plist_profile
                        end
                        index = index + 1
                end
        end

        if (profiles.length == 0)
                abort "No embedded provisioning profiles found"
        end
        return profiles.to_plist
end
validate_ipa(file) click to toggle source
# File lib/validate_ipa.rb, line 1
def validate_ipa(file)
        puts "Missing or unspecified .ipa file" and abort unless file and ::File.exist?(file)
        return file
end
verify_binaries(path) click to toggle source
# File lib/verify.rb, line 8
def verify_binaries(path)
        Dir.glob(path) do |file|
                codesign = `codesign --verify "#{file}" 2>&1`
                if (!codesign.to_s.empty?)
                        puts codesign
                end
        end
end
write_plist_to_path(plist, path) click to toggle source
# File lib/compare.rb, line 9
def write_plist_to_path(plist, path)
        File.write(path, plist)
end