Sha256: 13de4918069b2888f1f4976e39be0ec486a4ee55edbfbc56dc8e9e025c683788

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dashcode-converter-0.0.1 bin/dashcode-converter