#!/usr/bin/env ruby require 'rubygems' require 'optparse' module DashcodeConverter LIB_DIR= File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")) VENDOR_DIR= File.expand_path(File.join(File.dirname(__FILE__), "..", "vendor")) APP_NAME= File.basename($0) $:.unshift(LIB_DIR) options= { :namespace=>nil, :output_folder=>File.expand_path('out') } optparser= OptionParser.new do |opts| opts.banner= "Usage: #{APP_NAME} [options] PROJECT" opts.on('--namespace NAMESPACE', "Define the namespace to contain classes and functions.") do |namespace| options[:namespace]= namespace end opts.on('--dest FOLDER', "Specifies where should the output JSIB folder be located.") do |output_folder| options[:output_folder]= output_folder end end optparser.parse! require 'dashcode-converter' project_files= [] ARGV.each { |arg| arg= File.expand_path(arg) project_files += Dir.glob(File.join(arg, "*.dcproj")) if File.directory?(arg) project_files << arg if File.fnmatch("*.dcproj", arg) } if project_files.empty? puts optparser exit 1 end project_files.each { |project_path| project= Project.new(project_path, options[:output_folder]) project.namespace= options[:namespace] project.convert } end