Пример #1
0
  def _show_help(self):

    puts(e("Usage: %s [options] <file/folder>" % sys.argv[0]))

    with indent(3):
      puts(p("--help        ") + "Show the help system")
      puts(p("--lossy       ") + "Apply a lossy optimization on the image(s)")
      puts(p("--lossless    ") + "Apply a lossless optimization on the image(s)")
      puts(p("--watch       ") + "Watch a folder and apply optimizations straight up")
      puts(p("--stats       ") + "Show stats of the optimizations")

    sys.exit(1)
Пример #2
0
  def show(self):
    puts(p("Statistics:"))

    with indent(3):
      puts("Total Files: %s (PNGs %s/JPGs %s/GIFs %s)" % (
        s(self.files),
        s(self.pngs),
        s(self.jpgs),
        s(self.gifs)
      ))
      puts("Original File/Folder Size: %s" % s(round(self.preSize, 2)))
      puts("New File/Folder Size: %s" % s(round(self.postSize, 2)))
      puts("Savings of: %s%%" % s(self._getSavings()))
Пример #3
0
  def _check_dependencies(self):

    imgmin = exists('imgmin')
    image_optim = exists('image_optim')

    if not imgmin or not image_optim:
      puts(p('Dependencies have not been installed:'))

      with indent(3):
        message = 'imgmin - https://github.com/rflynn/imgmin'
        message = s('✓ ' + message) if imgmin else e('✗ ' + message)
        puts(message)

        message = 'image_optim - http://rubygems.org/gems/image_optim'
        message = s('✓ ' + message) if image_optim else e('✗ ' + message)
        puts(message)

      sys.exit(1)