Class InterfaceLift::Catalog
In: lib/catalog.rb
Parent: Object

Methods

git_repo?   new   theme_exists?   themes  

Attributes

catalog_path  [R] 

Public Class methods

[Source]

# File lib/catalog.rb, line 8
    def initialize(catalog_path = nil)
      @catalog_path = catalog_path.nil? ? DEFAULT_CATELOG_PATH : catalog_path
    end

Public Instance methods

[Source]

# File lib/catalog.rb, line 26
    def git_repo?(theme)
      begin
        g = Git.open("#{catalog_path}/#{theme}")
      # If the path does not exist it will return an ArgumentError
      rescue ArgumentError => e
        return false
      end
      g.index.readable?
    end

Does the given theme exist in the working path

[Source]

# File lib/catalog.rb, line 22
    def theme_exists?(theme)
      themes.include?(theme)
    end

Retrieve themes from specified catalog path

[Source]

# File lib/catalog.rb, line 13
    def themes
      themes = []
      Dir.glob("#{@catalog_path}/*").each do |item|
        themes << item if File.directory? item
      end
      themes.map { |path| path.split("/").last }
    end

[Validate]