Class: Compass::Commands::CreateProject
Instance Attribute Summary
Attributes inherited from ProjectBase
#options, #project_name
Attributes inherited from Base
#options, #working_path
Attributes included from Actions
#logger
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize, #perform, #template_directory
#app, #configure!, #installer, #installer_args
Methods inherited from ProjectBase
#execute, #initialize
Methods inherited from Base
#execute, #initialize, #perform, register
Methods included from Actions
#basename, #compile, #copy, #directory, #process_erb, #relativize, #remove, #separate, #strip_trailing_separator, #write_file
Class Method Details
.description(command) ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/compass/commands/create_project.rb', line 63
def description(command)
if command.to_sym == :create
"Create a new compass project"
else
"Initialize an existing project"
end
end
|
.option_parser(arguments) ⇒ Object
52
53
54
55
56
57
|
# File 'lib/compass/commands/create_project.rb', line 52
def option_parser(arguments)
parser = Compass::Exec::CommandOptionParser.new(arguments)
parser.extend(Compass::Exec::GlobalOptionsParser)
parser.extend(Compass::Exec::ProjectOptionsParser)
parser.extend(CreateProjectOptionsParser)
end
|
.parse!(arguments) ⇒ Object
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/compass/commands/create_project.rb', line 73
def parse!(arguments)
parser = option_parser(arguments)
parse_options!(parser, arguments)
parse_arguments!(parser, arguments)
if parser.options[:framework] && parser.options[:bare]
raise Compass::Error, "A bare project cannot be created when a framework is specified."
end
set_default_arguments(parser)
parser.options
end
|
.parse_arguments!(parser, arguments) ⇒ Object
100
101
102
103
104
105
106
107
108
|
# File 'lib/compass/commands/create_project.rb', line 100
def parse_arguments!(parser, arguments)
if arguments.size == 1
parser.options[:project_name] = arguments.shift
elsif arguments.size == 0
else
raise Compass::Error, "Too many arguments were specified."
end
end
|
.parse_init!(arguments) ⇒ Object
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/compass/commands/create_project.rb', line 84
def parse_init!(arguments)
parser = option_parser(arguments)
parse_options!(parser, arguments)
if arguments.size > 0
parser.options[:project_type] = arguments.shift.to_sym
end
parse_arguments!(parser, arguments)
set_default_arguments(parser)
parser.options
end
|
.parse_options!(parser, arguments) ⇒ Object
95
96
97
98
|
# File 'lib/compass/commands/create_project.rb', line 95
def parse_options!(parser, arguments)
parser.parse!
parser
end
|
.primary ⇒ Object
71
|
# File 'lib/compass/commands/create_project.rb', line 71
def primary; true; end
|
.set_default_arguments(parser) ⇒ Object
110
111
112
113
|
# File 'lib/compass/commands/create_project.rb', line 110
def set_default_arguments(parser)
parser.options[:framework] ||= :compass
parser.options[:pattern] ||= "project"
end
|
.usage ⇒ Object
59
60
61
|
# File 'lib/compass/commands/create_project.rb', line 59
def usage
option_parser([]).to_s
end
|
Instance Method Details
#is_project_creation? ⇒ Boolean
116
117
118
|
# File 'lib/compass/commands/create_project.rb', line 116
def is_project_creation?
true
end
|