Sha256: 8d801d958740d7c49f67f1e8b5519aa1e467bb6563e6abda483faa2c69cb4992

Contents?: true

Size: 1.68 KB

Versions: 27

Compression:

Stored size: 1.68 KB

Contents

#!/usr/bin/env ruby

$:.unshift File.dirname(__FILE__) + "/../lib"

require 'optparse'
require 'rubygems'
require 'less'

begin
  require 'growl'
rescue LoadError
  Less::GROWL = false
else
  Less::GROWL = true
end

# Argument defaults
options = {
  :watch => false,
  :compress => false,
  :debug => false,
  :growl => false
}

# Get arguments
opts = OptionParser.new do |o|
  o.banner = "usage: lessc source [destination] [--watch]"
  o.separator ""
  
  # Watch mode
  o.on("-w", "--watch", "watch for changes") do
    options[:watch] = true
  end
  
  # Growl
  o.on("-g", "--growl", "growl notifications") do
    if Less::GROWL && (Growl.installed? rescue false)
      options[:growl] = true
    elsif Less::GROWL
      abort "Growl or 'growlnotify' wasn't found on your system."
    else
      abort "Growl gem not found, please install with: " +
            "`sudo gem install visionmedia-growl -s http://gems.github.com`"
    end
  end
  
  # Compression needs a proper algorithm
  #
  #  o.on("-x", "--compress", "compress css file") do
  #    options[:compress] = true
  #  end
  
  o.separator ""

  # Help
  o.on_tail("-h", "--help", "show this message") do
    puts opts
    exit
  end
  
  o.on_tail("-d", "--debug", "show full error messages") do
    options[:debug] = true
  end

  # Version
  o.on_tail("-v", "--version", "show version") do
    puts "lessc " + Less.version
    exit
  end
end

opts.parse! # Parse arguments into `options` hash

# Get source and destintation from command line
case ARGV.size
  when 1
    options[:source] = ARGV[ 0 ]
  when 2
    options[:source] = ARGV[ 0 ]
    options[:destination] = ARGV[ 1 ]
  else
    puts opts
    exit
end

Less::Command.new( options ).run!

Version data entries

27 entries across 27 versions & 3 rubygems

Version Path
cloudhead-less-1.1.10 bin/lessc
cloudhead-less-1.1.11 bin/lessc
cloudhead-less-1.1.12 bin/lessc
cloudhead-less-1.1.13 bin/lessc
cloudhead-less-1.1.2 bin/lessc
cloudhead-less-1.1.3 bin/lessc
cloudhead-less-1.1.4 bin/lessc
cloudhead-less-1.1.5 bin/lessc
cloudhead-less-1.1.6 bin/lessc
cloudhead-less-1.1.7 bin/lessc
cloudhead-less-1.1.8 bin/lessc
cloudhead-less-1.1.9 bin/lessc
cloudhead-less-1.2.0 bin/lessc
cloudhead-less-1.2.1 bin/lessc
cloudhead-less-1.2.2 bin/lessc
cloudhead-less-1.2.3 bin/lessc
nirvdrum-less-1.1.4 bin/lessc
less-1.1.13 bin/lessc
less-1.1.3 bin/lessc
less-1.1.5 bin/lessc