Sha256: ce9210b7b7c7a80066ccd872245986dc2bb9e2ef369efb2c65f0594692b90f34

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib")
require 'xibtoti'
  
OptionParser.new do |opts|
  opts.banner = "Usage: xibtoti [options] filename"
  
  opts.on("-w", "--[no-]warnings", "Show warnings") do |w|
    @show_warnings = w
  end

  opts.on("-o", "--output-file name", "Specify output file") do |o|
    @output_file = o
  end
  
  opts.on("-c", "--config-file name", "Specify config file") do |o|
    @config_file = o
  end
  
end.parse!

if ARGV.size == 1
  input_file = ARGV.first
  session = Session.new @config_file || File.join("#{File.dirname(__FILE__)}/../lib", 'config.rb')
  session.parse_file input_file
  if session.has_errors?
    puts "Aborted!"
    puts session.full_log [:error]
  else  
    severities = []
    severities.unshift :warning if @show_warnings
    log = session.full_log severities
    script = js_comments_for(log) + js_for(session.out)
    if @output_file
      File.open(@output_file, 'w') do |file|
        file.write script
      end
      puts log
    else
      puts script
    end
  end
else
  puts "For help, type: xibtoti -h"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xibtoti-0.0.1 bin/xibtoti