Преглед на файлове

update ignored images, and fix matchup image fetching and generation

Kylie Jo Swistak преди 4 години
родител
ревизия
b2ee1e55dc
променени са 3 файла, в които са добавени 12 реда и са изтрити 16 реда
  1. 2 5
      .gitignore
  2. 7 5
      app/commands/matchup.rb
  3. 3 6
      app/models/image_merger.rb

+ 2 - 5
.gitignore

@@ -2,9 +2,6 @@
 Gemfile.lock
 .DS_Store
 .vs/*
-images/Image_Builder/LevelUp.png
-images/Image_Builder/LevelUp0.png
-images/Image_Builder/LevelUp1.png
-images/Image_Builder/LevelUp2.png
+images/Image_Builder/LevelUp*.png
 images/Image_Builder/user_url_img.png
-images/Type Double.png
+images/Type Double*.png

+ 7 - 5
app/commands/matchup.rb

@@ -14,13 +14,15 @@ class MatchupCommand < BaseCommand
     desc = "Displays a chart of effectiveness for the given type"
 
     @cmd ||= Command.new(:matchup, desc, opts) do |event, primary, secondary|
-      # Find the appropriate type images
+      # Find the primary type image, or raise exception if none is found
+      raise "No type given" unless primary
       file = "images/Type #{primary.capitalize}.png"
-      secondary_file = "images/Type #{secondary.capitalize}.png"
 
-      # Combine if there are two
-      if File.exists?(file) && File.exists?(secondary_file)
-        append_image(file, secondary_file, 'images/Type Double.png')
+      # If a secondary type is given, append images for each
+      if secondary
+        file_2 = "images/Type #{secondary.capitalize}.png"
+
+        append_image(file, file_2, 'images/Type Double.png')
         file = 'images/Type Double.png'
       end
 

+ 3 - 6
app/models/image_merger.rb

@@ -1,12 +1,9 @@
 require 'rmagick'
 include Magick
 
-def append_image(image1_in, images_in, image_out)
-  i = Magick::ImageList.new(image1_in,images_in)
-
-  if i.append(true)
-    u.write(image_out)
-  end
+def append_image(image1_in, image2_in, image_out)
+  i = Magick::ImageList.new(image1_in,image2_in)
+  i.append(true).write(image_out)
 end
 
 def merge_image(image_array, image_out, output_width, output_height, xaxis, yaxis, image_width, image_height)