Removed deprecated command line options.
This commit is contained in:
parent
e22acfde1e
commit
38e13e55e6
@ -22,8 +22,7 @@ fallback_load_path(File.join(File.dirname(__FILE__), '..', 'lib')) do
|
||||
end
|
||||
|
||||
runner = Proc.new do
|
||||
command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(ARGV)
|
||||
command_line_class.new(ARGV).run!
|
||||
Compass::Exec::SubCommandUI.new(ARGV).run!
|
||||
end
|
||||
|
||||
if ARGV.delete("--profile")
|
||||
|
@ -20,6 +20,7 @@ The Documentation for the [latest preview release](http://beta.compass-style.org
|
||||
* Add a `--time` option to the compile and watch commands. This will print out
|
||||
the time spent compiling each sass file and a total at the end.
|
||||
* Upgrade FSSM, the internal library that monitors the filesystem events for compass.
|
||||
* Removed the command line options that were deprecated in v0.10.
|
||||
|
||||
0.11.alpha.3 (12/05/2010)
|
||||
-------------------------
|
||||
|
@ -3,7 +3,7 @@ end
|
||||
|
||||
require 'compass/commands/registry'
|
||||
|
||||
%w(base generate_grid_background help list_frameworks project_base
|
||||
%w(base generate_grid_background default help list_frameworks project_base
|
||||
update_project watch_project create_project imports installer_command
|
||||
print_version project_stats stamp_pattern sprite validate_project
|
||||
write_configuration interactive unpack_extension).each do |lib|
|
||||
|
50
lib/compass/commands/default.rb
Normal file
50
lib/compass/commands/default.rb
Normal file
@ -0,0 +1,50 @@
|
||||
module Compass
|
||||
module Commands
|
||||
module DefaultOptionsParser
|
||||
def set_options(opts)
|
||||
opts.on("--trace") do
|
||||
self.options[:trace] = true
|
||||
end
|
||||
opts.on("-?", "-h", "--help") do
|
||||
self.options[:command] = Proc.new do
|
||||
Help.new(working_path, options.merge(:help_command => "help"))
|
||||
end
|
||||
end
|
||||
opts.on("-q", "--quiet") do
|
||||
self.options[:quiet] = true
|
||||
end
|
||||
opts.on("-v", "--version") do
|
||||
self.options[:command] = Proc.new do
|
||||
PrintVersion.new(working_path, options)
|
||||
end
|
||||
end
|
||||
super
|
||||
end
|
||||
end
|
||||
class Default < Base
|
||||
|
||||
class << self
|
||||
def option_parser(arguments)
|
||||
parser = Compass::Exec::CommandOptionParser.new(arguments)
|
||||
parser.extend(DefaultOptionsParser)
|
||||
end
|
||||
# def usage
|
||||
# $stderr.puts caller.join("\n")
|
||||
# "XXX"
|
||||
# end
|
||||
def parse!(arguments)
|
||||
parser = option_parser(arguments)
|
||||
parser.parse!
|
||||
parser.options[:command] ||= Proc.new do
|
||||
Help.new(working_path, options.merge(:help_command => "help"))
|
||||
end
|
||||
parser.options
|
||||
end
|
||||
end
|
||||
|
||||
def execute
|
||||
instance_eval(&options[:command]).execute
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -5,6 +5,7 @@ module Compass::Commands
|
||||
@commands[name.to_sym] = command_class
|
||||
end
|
||||
def get(name)
|
||||
return unless name
|
||||
@commands ||= Hash.new
|
||||
@commands[name.to_sym] || @commands[abbreviation_of(name)]
|
||||
end
|
||||
@ -13,6 +14,8 @@ module Compass::Commands
|
||||
matching = @commands.keys.select{|k| k.to_s =~ re}
|
||||
if matching.size == 1
|
||||
matching.first
|
||||
elsif name =~ /^-/
|
||||
nil
|
||||
else
|
||||
raise Compass::Error, "Ambiguous abbreviation '#{name}'. Did you mean one of: #{matching.join(", ")}"
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ end
|
||||
module Compass::Exec
|
||||
end
|
||||
|
||||
%w(helpers switch_ui sub_command_ui
|
||||
%w(helpers sub_command_ui
|
||||
global_options_parser project_options_parser
|
||||
command_option_parser).each do |lib|
|
||||
require "compass/exec/#{lib}"
|
||||
|
@ -1,18 +1,6 @@
|
||||
module Compass::Exec
|
||||
module Helpers
|
||||
extend self
|
||||
def select_appropriate_command_line_ui(arguments)
|
||||
if Compass::Commands.command_exists? arguments.first
|
||||
SubCommandUI
|
||||
else
|
||||
unless arguments.include?("-h") || arguments.include?("--help")
|
||||
Compass::Logger.new.red do
|
||||
Compass::Util.compass_warn "WARNING: This interface is deprecated. Please use the new subcommand interface.\nSee `compass help` for more information.\n"
|
||||
end
|
||||
end
|
||||
SwitchUI
|
||||
end
|
||||
end
|
||||
def report_error(e, options)
|
||||
$stderr.puts "#{e.class} on line #{get_line e} of #{get_file e}: #{e.message}"
|
||||
if options[:trace]
|
||||
|
@ -30,6 +30,11 @@ module Compass::Exec
|
||||
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
|
||||
@ -38,7 +43,7 @@ module Compass::Exec
|
||||
command_class.new(Dir.getwd, @options).execute
|
||||
rescue OptionParser::ParseError => e
|
||||
puts "Error: #{e.message}"
|
||||
puts command_class.usage
|
||||
puts command_class.usage if command_class.respond_to?(:usage)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -107,8 +107,7 @@ module Compass::CommandLineHelper
|
||||
end
|
||||
|
||||
def execute(*arguments)
|
||||
command_line_class = Compass::Exec::Helpers.select_appropriate_command_line_ui(arguments)
|
||||
exit_code = command_line_class.new(arguments).run!
|
||||
exit_code = Compass::Exec::SubCommandUI.new(arguments).run!
|
||||
# fail "Command Failed with exit code: #{exit_code}" unless exit_code == 0
|
||||
exit_code
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ class CommandLineTest < Test::Unit::TestCase
|
||||
|
||||
def test_basic_install
|
||||
within_tmp_directory do
|
||||
compass "--boring", "basic"
|
||||
compass "create", "--boring", "basic"
|
||||
assert File.exists?("basic/sass/screen.scss")
|
||||
assert File.exists?("basic/stylesheets/screen.css")
|
||||
assert_action_performed :directory, "basic/"
|
||||
@ -33,7 +33,7 @@ class CommandLineTest < Test::Unit::TestCase
|
||||
next if framework.name =~ /^_/
|
||||
define_method "test_#{framework.name}_installation" do
|
||||
within_tmp_directory do
|
||||
compass *%W(--boring --framework #{framework.name} #{framework.name}_project)
|
||||
compass *%W(create --boring --using #{framework.name} #{framework.name}_project)
|
||||
assert File.exists?("#{framework.name}_project/sass/screen.scss"), "sass/screen.scss is missing. Found: #{Dir.glob("#{framework.name}_project/**/*").join(", ")}"
|
||||
assert File.exists?("#{framework.name}_project/stylesheets/screen.css")
|
||||
assert_action_performed :directory, "#{framework.name}_project/"
|
||||
@ -45,13 +45,13 @@ class CommandLineTest < Test::Unit::TestCase
|
||||
|
||||
def test_basic_update
|
||||
within_tmp_directory do
|
||||
compass "--boring", "basic"
|
||||
compass "create", "--boring", "basic"
|
||||
Dir.chdir "basic" do
|
||||
# basic update with timestamp caching
|
||||
compass "--boring"
|
||||
compass "compile", "--boring"
|
||||
assert_action_performed :unchanged, "sass/screen.scss"
|
||||
# basic update with force option set
|
||||
compass "--force", "--boring"
|
||||
compass "compile", "--force", "--boring"
|
||||
assert_action_performed :identical, "stylesheets/screen.css"
|
||||
end
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ class RailsIntegrationTest < Test::Unit::TestCase
|
||||
within_tmp_directory do
|
||||
generate_rails_app_directories("compass_rails")
|
||||
Dir.chdir "compass_rails" do
|
||||
compass(*%w(--rails --trace --boring --sass-dir app/stylesheets --css-dir public/stylesheets/compiled .))
|
||||
compass(*%w(init rails --trace --boring --sass-dir app/stylesheets --css-dir public/stylesheets/compiled .))
|
||||
assert_action_performed :create, "./app/stylesheets/screen.scss"
|
||||
assert_action_performed :create, "./config/initializers/compass.rb"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user