Sha256: b2434e7506a5027501470c8b38f7a5ca83e7b4b67166f3e2cd4bc184f60c22cc
Contents?: true
Size: 1.67 KB
Versions: 3
Compression:
Stored size: 1.67 KB
Contents
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'rubygems' require 'rubygems' unless defined?(Gem) require 'thread' class Object alias sh system end lib_dir = File.expand_path(File.join(File.dirname(__FILE__),'..','lib')) unless $LOAD_PATH.include?(lib_dir) $LOAD_PATH << lib_dir end require 'puer' require 'optparse' OptionParser.new do |opts| opts.banner =<<END Usage: puer [options] [filename] Usage: puer all # convert all xib files to js under current directory END 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 case ARGV[0] when "all" Dir.glob(File.join('**','*.xib')).each do |s| puts "#{s} is converted to #{File.basename(s, '.*')}.js " system "puer #{s} -o #{File.basename(s, '.*')}.js" exit end else input_file = ARGV.first session = Session.new @config_file || File.join("#{File.dirname(__FILE__)}/../lib/puer", '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 end else puts "For help, type: puer -h" end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
puer-0.0.4 | bin/puer |
puer-0.0.3 | bin/puer |
puer-0.0.2 | bin/puer |