File: extension_command.rb

package info (click to toggle)
ruby-compass 0.12.2~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,308 kB
  • sloc: ruby: 10,474; makefile: 42; xml: 14
file content (60 lines) | stat: -rw-r--r-- 1,374 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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