Sha256: 184684a7632843b60aa8bd073b3b3a849245a0e4954d7e07c850afcc032d2527
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'compass/exec/global_options_parser' require 'compass/exec/project_options_parser' module Compass::Exec class SubCommandUI attr_accessor :args def initialize(args) self.args = args end def run! begin return perform! rescue Exception => e raise e if e.is_a? SystemExit if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError) $stderr.puts e.message else ::Compass::Exec::Helpers.report_error(e, @options || {}) end return 1 end end protected def perform! $command = args.shift command_class = Compass::Commands[$command] unless command_class args.unshift($command) $command = "help" command_class = Compass::Commands::Default end @options = if command_class.respond_to?("parse_#{$command}!") command_class.send("parse_#{$command}!", args) else command_class.parse!(args) end cmd = command_class.new(Dir.getwd, @options) cmd.execute cmd.successful? ? 0 : 1 rescue OptionParser::ParseError => e puts "Error: #{e.message}" puts command_class.usage if command_class.respond_to?(:usage) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
compass-sourcemaps-0.12.3.sourcemaps.a4836f1 | lib/compass/exec/sub_command_ui.rb |
compass-sourcemaps-0.12.2.sourcemaps.57a186c | lib/compass/exec/sub_command_ui.rb |