#!/usr/bin/env ruby require 'rubygems' require 'jsus' require 'choice' Choice.options do option 'input_directory', :required => true do short "-i" long "--input-directory=DIRECTORY" desc "Path to directory containing your package to compile." end option 'output_directory', :required => true do short "-o" long "--output-directory=DIRECTORY" desc "Path to directory to output the compiled package." end option "dependencies", :required => false do short "-d" long "--with-dependencies=DIRECTORY" desc "Path to directory containing packages this package relies on. " << "If set, all the packages will be compiled into a single file." end option "without_scripts_info", :required => false do long "--without-scripts-info" desc "When this flag is set, jsus doesn't generate scripts.json" << "file with general info about your package." end option "without_tree", :required => false do long "--without-tree" desc "When this flag is set, jsus doesn't generate tree.json file" << "with tree structure of your package." end end pool = if Choice.choices[:dependencies] Jsus::Pool.new(Choice.choices[:dependencies]) end package = Jsus::Package.new(Choice.choices[:input_directory], :pool => pool) package.include_dependencies! if Choice.choices[:dependencies] package.include_extensions! if Choice.choices[:dependencies] output_directory = Choice.choices[:output_directory] package.compile(output_directory) package.generate_scripts_info(output_directory) unless Choice.choices[:without_scripts_info] package.generate_tree(output_directory) unless Choice.choices[:without_tree]