#!/usr/bin/env ruby require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'minglr')) rc_config = Minglr::ConfigParser.parse uri_options = rc_config[:global] || {} project = rc_config[:global][:default].to_sym if rc_config[:global][:default] original_arguments = ARGV if Minglr::Action.valid_action?(ARGV[0]) action = ARGV[0] else if ARGV[0] && (ARGV[0] =~ /^--/).nil? project = ARGV[0].to_sym action = ARGV[1] end end unless project.nil? if action.nil? puts "No action specified. Valid actions are: #{Minglr::Action.valid_actions.join(", ")}" exit 1 end uri_options.merge! rc_config[project] Resources::Base.configure uri_options Resources::Attachment.configure extra_options = Minglr::OptionsParser.parse(original_arguments) Minglr::Action.execute(action, ARGV, extra_options, rc_config[project]) end