Sha256: 865000b26300ed85e8c2c3e625f516f9da93e884163cca2b9e90a6a8288ae489
Contents?: true
Size: 1.52 KB
Versions: 4
Compression:
Stored size: 1.52 KB
Contents
Dir["#{File.dirname(__FILE__)}/compressit/*"].each {|file| require(file)} require 'optparse' module Compressit class << self def run(arguments) options = Hash.new optparser = OptionParser.new do|opts| opts.banner = "Usage: compressit [option] [FOLDER] [VERSION]" opts.on('-h', '--help', 'Display this help') do puts optparser end opts.on('-v', '--version', 'Display current gem version') do puts "Currently using version: #{VERSION}" end opts.on('-c', '--css FOLDER VERSION', 'Compress css files from [FOLDER] into [FOLDER]/compressed') do puts "Compressing css files from '#{arguments[0]}' into '#{arguments[0]}/compressed/compressed-#{arguments[1]}.css'" options[:folder], options[:version], options[:ext] = arguments[0], arguments[1], '.css' Compressit::Base.compressit(options) end opts.on('-j', '--js FOLDER VERSION', 'Compress javascript files from [FOLDER] into [FOLDER]/compressed') do puts "Compressing javascript files from '#{arguments[0]}' into '#{arguments[0]}/compressed/compressed-#{arguments[1]}.js'" options[:folder], options[:version], options[:ext] = arguments[0], arguments[1], '.js' Compressit::Base.compressit(options) end end begin optparser.parse!(arguments) rescue OptionParser::InvalidOption => error puts "Oops! #{error}, try this: " puts optparser exit 1 end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
compressit-1.0.2 | lib/compressit.rb |
compressit-1.0.1 | lib/compressit.rb |
compressit-1.0.0 | lib/compressit.rb |
compressit-0.9.0 | lib/compressit.rb |