Sha256: 94a21a09d2826a0b3aec2e594e78b7803e8ebd96b7e923f92d162fbc5e2d1bf7

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

#!/usr/bin/env ruby
require 'thor'

class CompassUI < Thor
  include Thor::Actions
  
  def self.source_root
    File.join(File.dirname(__FILE__), '..', 'templates', 'images')
  end

  desc "install THEME [-d DIRECTORY]", "Installs the icons from one of the available themes."
  method_options %w(directory -d) => :string
  def install(theme)
    # smoothness and jquery-ui use the same set
    theme_name = theme
    theme = (theme == 'smoothness' ? 'jquery-ui-base' : theme)
    install_dir = options[:directory] 
    install_dir ||= 'images'
    source_dir = File.join(CompassUI.source_root, theme)
    if File.exists?(source_dir) and File.directory?(source_dir)
      directory(theme, File.join(install_dir, theme_name))
    else
      say "Unable to find theme: #{theme}!", Thor::Shell::Color::RED
    end
  end

  desc "list", "Lists the available icon themes."
  def list
    say 'Available icon themes:', Thor::Shell::Color::CYAN
    Dir.foreach(CompassUI.source_root) do |dir|
      next if ['.','..'].include?(dir)
      say dir unless !File.directory?(File.join(CompassUI.source_root, dir))
    end
  end
end

CompassUI.start

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
compass-ui-0.0.5 bin/compass-ui
compass-ui-0.0.4 bin/compass-ui