<commit_before>$:.push File.expand_path('../', __FILE__)
require 'mini_magick'
require 'colors'
require 'xcodeproj'
require 'open-uri'

module Longbow

  # Resize Icon
  def self.resize_icons(directory, t, obj)
    # Bad Params
    if !directory || !t
      return false
    end

    # Set Up
    target = t['name']

    # Get Device Information
    iPhone = false
    iPad = false
    if obj['devices']
      obj['devices'].each do |d|
        iPhone = true if d == 'iPhone'
        iPad = true if d == 'iPad'
      end
    end

    # Get Image Information
    img_path = ''
    if t['icon_url']
      img_path = self.path_for_downloaded_image_from_url directory, target, t['icon_url']
    elsif t['icon_path']
      img_path = directory + '/' + t['icon_path']
    end

    # Make directory
    img_dir = make_asset_directory directory, target

    # Make image
    image = MiniMagick::Image.open(img_path)
    return false unless image

    # Size for iPhone
    if iPhone
      image.resize '120x120'
      image.write  img_dir + '/icon120x120.png'
      image.resize '114x114'
      image.write  img_dir + '/icon114x114.png'
      image.resize '80x80'
      image.write  img_dir + '/icon80x80.png'
      image.resize '58x58'
      image.write  img_dir + '/icon58x58.png'
      image.resize '57x57'
      image.write  img_dir + '/icon57x57.png'
      image.resize '29x29'
      image.write  img_dir + '/icon29x29.png'
      Longbow::green ('  - Created iPhone icon images for ' + target) if $verbose
    end

    if iPad
      image.resize '152x152'
      image.write  img_dir + '/icon152x152.png'
      image.resize '144x144'
      image.write  img_dir + '/icon144x144.png'
      image.resize '100x100'<commit_msg>Fixed images to not keep using the resized version.<commit_after>$:.push File.expand_path('../', __FILE__)
require 'mini_magick'
require 'colors'
require 'xcodeproj'
require 'open-uri'

module Longbow

  # Resize Icon
  def self.resize_icons(directory, t, obj)
    # Bad Params
    if !directory || !t
      return false
    end

    # Set Up
    target = t['name']

    # Get Device Information
    iPhone = false
    iPad = false
    if obj['devices']
      obj['devices'].each do |d|
        iPhone = true if d == 'iPhone'
        iPad = true if d == 'iPad'
      end
    end

    # Get Image Information
    img_path = ''
    if t['icon_url']
      img_path = self.path_for_downloaded_image_from_url directory, target, t['icon_url']
    elsif t['icon_path']
      img_path = directory + '/' + t['icon_path']
    end

    # Make directory
    img_dir = make_asset_directory directory, target

    # Size for iPhone
    if iPhone
      image = MiniMagick::Image.open(img_path)
      return false unless image
      image.resize '120x120'
      image.write  img_dir + '/icon120x120.png'
      image.resize '114x114'
      image.write  img_dir + '/icon114x114.png'
      image.resize '80x80'
      image.write  img_dir + '/icon80x80.png'
      image.resize '58x58'
      image.write  img_dir + '/icon58x58.png'
      image.resize '57x57'
      image.write  img_dir + '/icon57x57.png'
      image.resize '29x29'
      image.write  img_dir + '/icon29x29.png'
      Longbow::green ('  - Created iPhone icon images for ' + target) if $verbose
    end

    if iPad
      image = MiniMagick::Image.open(img_path)
      return false unless image
      image.resize '152x152'
      image.write  img_dir + '/icon152x152.png'
      image.resize '144x144'
      image.write  img_dir + '/icon144x144.png'
      image.resize '100x100'
{'fraction_non_alphanumeric': 0.10907035885843458, 'fraction_numerical': 0.04860129980220401, 'mean_word_length': 2.4637964774951078, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5177928', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1178, 'n_words': 301}