Sha256: 89eba7b3d5abcbfa887a85f6b35d55e76e8af4547c43ea1c579c085cbf35025c

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

module Granify
  module Controller
    class Minify < Controller::Base
      # Purpose: minify all JS files in the current directory, move them to a
      # min directory and rename them file.min.js
      @@folder = :min

      # We don't need to clean logs here
      def post_exec
        false
      end

      def all
        # future method
        Notify.warning("Method not implemented")
      end

      def js
        min_folder = Utils.mklocaldir(@@folder)
        files = Utils.get_files(:js)
        command = Command::Exec.new

        if files.size > 0
          files.each do |file|
            command.minify(file, min_folder)
          end

          Notify.bubble("Minified #{files.size} files.", "Success")
        else
          Notify.warning("No JS files detected in this directory")
        end
      end

      def cs
        # future method
        Notify.warning("Method not implemented")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rbtils-0.0.2 lib/controllers/minify.rb
rbtils-0.0.1 lib/controllers/minify.rb