Class: Compass::Commands::StampPattern
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
#app, #configure!, #installer, #installer_args
Methods inherited from ProjectBase
#execute
Methods inherited from Base
#execute, #failed!, register, #successful?
Methods included from Actions
#basename, #copy, #directory, #log_action, #process_erb, #relativize, #remove, #separate, #strip_trailing_separator, #write_file
Constructor Details
#initialize(working_path, options) ⇒ StampPattern
Returns a new instance of StampPattern.
68
69
70
|
# File 'lib/compass/commands/stamp_pattern.rb', line 68
def initialize(working_path, options)
super(working_path, options)
end
|
Class Method Details
.description(command) ⇒ Object
41
42
43
|
# File 'lib/compass/commands/stamp_pattern.rb', line 41
def description(command)
"Install an extension's pattern into your compass project"
end
|
.option_parser(arguments) ⇒ Object
.parse!(arguments) ⇒ Object
44
45
46
47
48
49
|
# File 'lib/compass/commands/stamp_pattern.rb', line 44
def parse!(arguments)
parser = option_parser(arguments)
parser.parse!
parse_arguments!(parser, arguments)
parser.options
end
|
.parse_arguments!(parser, arguments) ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/compass/commands/stamp_pattern.rb', line 50
def parse_arguments!(parser, arguments)
if arguments.size == 0
raise OptionParser::ParseError, "Please specify a pattern."
end
pattern = arguments.shift.split('/', 2)
parser.options[:framework] = pattern[0]
parser.options[:pattern] = pattern[1]
if arguments.size > 0
parser.options[:project_name] = arguments.shift
end
if arguments.size > 0
raise OptionParser::ParseError, "Unexpected trailing arguments: #{arguments.join(" ")}"
end
end
|
.usage ⇒ Object
38
39
40
|
# File 'lib/compass/commands/stamp_pattern.rb', line 38
def usage
option_parser([]).to_s
end
|
Instance Method Details
#is_project_creation? ⇒ Boolean
80
81
82
|
# File 'lib/compass/commands/stamp_pattern.rb', line 80
def is_project_creation?
false
end
|
all commands must implement perform
73
74
75
76
77
78
|
# File 'lib/compass/commands/stamp_pattern.rb', line 73
def perform
installer.init
installer.run(:skip_finalization => true, :skip_preparation => !is_project_creation?)
UpdateProject.new(working_path, options).perform if installer.compilation_required?
installer.finalize(options.merge(:create => is_project_creation?))
end
|
#template_directory(pattern) ⇒ Object
84
85
86
|
# File 'lib/compass/commands/stamp_pattern.rb', line 84
def template_directory(pattern)
File.join(framework.templates_directory, pattern)
end
|