Extension manager command (a trivial front-end for the gem command)
This commit is contained in:
parent
f673f71275
commit
dd629b1b23
@ -4,8 +4,9 @@ end
|
||||
require 'compass/commands/registry'
|
||||
|
||||
%w(base generate_grid_background default help list_frameworks project_base
|
||||
update_project watch_project create_project clean_project imports installer_command
|
||||
print_version project_stats stamp_pattern sprite validate_project
|
||||
write_configuration interactive unpack_extension).each do |lib|
|
||||
update_project watch_project create_project clean_project extension_command
|
||||
imports installer_command print_version project_stats stamp_pattern
|
||||
sprite validate_project write_configuration interactive unpack_extension
|
||||
).each do |lib|
|
||||
require "compass/commands/#{lib}"
|
||||
end
|
||||
|
60
lib/compass/commands/extension_command.rb
Normal file
60
lib/compass/commands/extension_command.rb
Normal file
@ -0,0 +1,60 @@
|
||||
require 'fileutils'
|
||||
require 'compass/commands/base'
|
||||
|
||||
module Compass
|
||||
module Commands
|
||||
module ExtensionsOptionParser
|
||||
def set_options(opts)
|
||||
opts.banner = %Q{
|
||||
Usage: compass extension install EXTENSION_NAME [options]
|
||||
compass extension uninstall EXTENSION_NAME [options]
|
||||
compass extension list
|
||||
|
||||
Description:
|
||||
Manage the list of extensions on your system.
|
||||
Compass to all of your compass projects.
|
||||
|
||||
Example:
|
||||
compass extension install sassy-buttons
|
||||
compass extension uninstall sassy-buttons
|
||||
|
||||
}
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
class ExtensionCommand < Base
|
||||
|
||||
register :extension
|
||||
|
||||
class << self
|
||||
def option_parser(arguments)
|
||||
parser = Compass::Exec::CommandOptionParser.new(arguments)
|
||||
parser.extend(ExtensionsOptionParser)
|
||||
end
|
||||
def usage
|
||||
option_parser([]).to_s
|
||||
end
|
||||
def description(command)
|
||||
"Manage the list of compass extensions on your system"
|
||||
end
|
||||
def parse!(arguments)
|
||||
{:arguments => arguments}
|
||||
end
|
||||
end
|
||||
include InstallerCommand
|
||||
|
||||
def initialize(working_path, options)
|
||||
super(working_path, options)
|
||||
end
|
||||
|
||||
# all commands must implement perform
|
||||
def perform
|
||||
require 'rubygems/gem_runner'
|
||||
Gem::GemRunner.new.run(options[:arguments])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user