Sha256: 865d058462550578ecb6ab92a5cd586283a0c3c216abf96f265ed6929c72bb52

Contents?: true

Size: 802 Bytes

Versions: 3

Compression:

Stored size: 802 Bytes

Contents

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

require 'coffee_without_nodejs'
require 'coderay'

if ARGV.first == '-e'
  ARGV.shift
  content = CoffeeWithoutNodejs.compile(ARGV.first).to_s
  print CodeRay.scan(content, :js).terminal unless content.empty?
else
  if ARGV.empty?
    `notify-send 'Starting coffee compiler.' -t 1000` if system 'which notify-send &>/dev/null'
    CoffeeWithoutNodejs.watch!
  elsif test 'd', ARGV.first
    Dir.chdir(ARGV.first) { CoffeeWithoutNodejs.watch! }
  else
    ARGV.each do |file|
      fail "`#{file}' is not valid filename." unless File.exist? file

      content = CoffeeWithoutNodejs.compile(file).to_s
      unless content.empty?
        token = CodeRay.scan(content, :js)
        print $stdout.tty? ? token.terminal : token.text
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
coffee_without_nodejs-0.8.0 bin/coff
coffee_without_nodejs-0.7.0 bin/coff
coffee_without_nodejs-0.6.0 bin/coff