Fix bugs in the dry-run mode of project creation.
This commit is contained in:
parent
f6b138062f
commit
8b02a65ab4
@ -48,7 +48,7 @@ module Compass
|
||||
logger.record :create, basename(file_name)
|
||||
end
|
||||
if skip_write
|
||||
FileUtils.touch file_name
|
||||
FileUtils.touch file_name unless options[:dry_run]
|
||||
else
|
||||
mode = "w"
|
||||
mode << "b" if binary
|
||||
|
@ -7,12 +7,12 @@ module Compass
|
||||
|
||||
def initialize(working_path, options)
|
||||
super
|
||||
assert_project_directory_exists!
|
||||
assert_project_directory_exists! unless dry_run?
|
||||
end
|
||||
|
||||
def perform
|
||||
compiler = new_compiler_instance
|
||||
if compiler.sass_files.empty?
|
||||
if compiler.sass_files.empty? && !dry_run?
|
||||
message = "Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\n"
|
||||
message << "Run \"compass -h\" to get help."
|
||||
raise Compass::Error, message
|
||||
@ -21,6 +21,10 @@ module Compass
|
||||
end
|
||||
end
|
||||
|
||||
def dry_run?
|
||||
options[:dry_run]
|
||||
end
|
||||
|
||||
def new_compiler_instance(additional_options = {})
|
||||
Compass::Compiler.new(working_path,
|
||||
projectize(Compass.configuration.sass_dir),
|
||||
@ -31,4 +35,4 @@ module Compass
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ module Compass::Exec
|
||||
if e.is_a?(::Compass::Error) || e.is_a?(OptionParser::ParseError)
|
||||
$stderr.puts e.message
|
||||
else
|
||||
::Compass::Exec::Helpers.report_error(e, @options)
|
||||
::Compass::Exec::Helpers.report_error(e, @options || {})
|
||||
end
|
||||
return 1
|
||||
end
|
||||
@ -30,12 +30,12 @@ module Compass::Exec
|
||||
def perform!
|
||||
$command = args.shift
|
||||
command_class = Compass::Commands[$command]
|
||||
options = if command_class.respond_to?("parse_#{$command}!")
|
||||
@options = if command_class.respond_to?("parse_#{$command}!")
|
||||
command_class.send("parse_#{$command}!", args)
|
||||
else
|
||||
command_class.parse!(args)
|
||||
end
|
||||
command_class.new(Dir.getwd, options).execute
|
||||
command_class.new(Dir.getwd, @options).execute
|
||||
rescue OptionParser::ParseError => e
|
||||
puts "Error: #{e.message}"
|
||||
puts command_class.usage
|
||||
|
@ -54,7 +54,7 @@ module Compass
|
||||
def run(options = {})
|
||||
prepare
|
||||
install
|
||||
finalize unless options[:skip_finalization]
|
||||
finalize(options) unless options[:skip_finalization]
|
||||
end
|
||||
|
||||
# The default prepare method -- it is a no-op.
|
||||
|
Loading…
Reference in New Issue
Block a user