class Compass::Commands::StampPattern

Public Class Methods

description(command) click to toggle source
# File lib/compass/commands/stamp_pattern.rb, line 41
def description(command)
  "Install an extension's pattern into your compass project"
end
new(working_path, options) click to toggle source
# File lib/compass/commands/stamp_pattern.rb, line 68
def initialize(working_path, options)
  super(working_path, options)
end
option_parser(arguments) click to toggle source
# File lib/compass/commands/stamp_pattern.rb, line 32
def option_parser(arguments)
  parser = Compass::Exec::CommandOptionParser.new(arguments)
  parser.extend(Compass::Exec::GlobalOptionsParser)
  parser.extend(Compass::Exec::ProjectOptionsParser)
  parser.extend(StampPatternOptionsParser)
end
parse!(arguments) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/compass/commands/stamp_pattern.rb, line 38
def usage
  option_parser([]).to_s
end

Public Instance Methods

is_project_creation?() click to toggle source
# File lib/compass/commands/stamp_pattern.rb, line 80
def is_project_creation?
  false
end
perform() click to toggle source

all commands must implement perform

# 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) click to toggle source
# File lib/compass/commands/stamp_pattern.rb, line 84
def template_directory(pattern)
  File.join(framework.templates_directory, pattern)
end