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:
parent
f903da3434
commit
becda48b83
@ -4,7 +4,8 @@ module Compass
|
|||||||
module Commands
|
module Commands
|
||||||
class InstallRails < Base
|
class InstallRails < Base
|
||||||
def initialize(working_directory, options)
|
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
|
end
|
||||||
def perform
|
def perform
|
||||||
set_install_location
|
set_install_location
|
||||||
|
@ -69,13 +69,17 @@ module Compass
|
|||||||
self.opts = OptionParser.new(&method(:set_opts))
|
self.opts = OptionParser.new(&method(:set_opts))
|
||||||
self.opts.parse!(self.args)
|
self.opts.parse!(self.args)
|
||||||
if ARGV.size > 0
|
if ARGV.size > 0
|
||||||
self.options[:project_name] = ARGV.shift
|
self.options[:project_name] = trim_trailing_separator(ARGV.shift)
|
||||||
end
|
end
|
||||||
self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project
|
self.options[:command] ||= self.options[:project_name] ? :create_project : :update_project
|
||||||
self.options[:environment] ||= :production
|
self.options[:environment] ||= :production
|
||||||
self.options[:framework] ||= :compass
|
self.options[:framework] ||= :compass
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def trim_trailing_separator(path)
|
||||||
|
path[-1..-1] == File::SEPARATOR ? path[0..-2] : path
|
||||||
|
end
|
||||||
|
|
||||||
def set_opts(opts)
|
def set_opts(opts)
|
||||||
opts.banner = <<END
|
opts.banner = <<END
|
||||||
Usage: compass [options] [project]
|
Usage: compass [options] [project]
|
||||||
|
Loading…
Reference in New Issue
Block a user