Allow passing a path to the rails project instead of requiring the user to change into the rails project directory first.

This commit is contained in:
Chris Eppstein 2009-01-18 17:04:20 -08:00
parent f903da3434
commit becda48b83
2 changed files with 8 additions and 3 deletions

View File

@ -4,7 +4,8 @@ module Compass
module Commands
class InstallRails < Base
def initialize(working_directory, options)
super(working_directory, options)
wd = options[:project_name] ? File.join(working_directory, options.delete(:project_name)) : working_directory
super(wd, options)
end
def perform
set_install_location

View File

@ -69,13 +69,17 @@ module Compass
self.opts = OptionParser.new(&method(:set_opts))
self.opts.parse!(self.args)
if ARGV.size > 0
self.options[:project_name] = ARGV.shift
self.options[:project_name] = trim_trailing_separator(ARGV.shift)
end
self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project
self.options[:environment] ||= :production
self.options[:framework] ||= :compass
end
def trim_trailing_separator(path)
path[-1..-1] == File::SEPARATOR ? path[0..-2] : path
end
def set_opts(opts)
opts.banner = <<END
Usage: compass [options] [project]