bin/minglr in schubert-minglr-1.1.0 vs bin/minglr in schubert-minglr-1.2.0

- old
+ new

@@ -1,29 +1,29 @@ #!/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 +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 MinglrAction::ACTIONS.include?(ARGV[0]) +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 -if project +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] - 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]) + 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 \ No newline at end of file