#!/usr/bin/env ruby require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'minglr')) require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'minglr', "minglr_action")) rc_config = MinglrConfigParser.parse uri_options = rc_config[:global] || {} project = rc_config[:global][:default].to_sym if rc_config[:global][:default] original_arguments = ARGV if MinglrAction::ACTIONS.include?(ARGV[0]) action = ARGV[0] else if ARGV[0] && (ARGV[0] =~ /^--/).nil? project = ARGV[0].to_sym action = ARGV[1] end end if project uri_options.merge! rc_config[project] uri_options[:protocol] = uri_options[:url].slice(/^.*\:/).chop uri_options[:url].gsub!(/^(http|https)\:\/\//, "") uri_options[:host_and_port], uri_options[:project] = uri_options[:url].split("/projects/") MingleResource.configure uri_options Attachment.configure extra_options = MinglrOptionsParser.parse(original_arguments) MinglrAction.execute(action, ARGV, extra_options, rc_config[project]) end