Class: CompassThemes::GeneratorHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/compass-themes/railties/generators/generator_helper.rb

Constant Summary collapse

LOCAL_ROOT =
File.expand_path('../', __FILE__)

Class Method Summary collapse

Class Method Details

.available_themesObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/compass-themes/railties/generators/generator_helper.rb', line 5

def available_themes
  themes = {}
  Dir["#{LOCAL_ROOT}/../../templates/**/*.html.haml"].each do |template|
    short_name = File.basename(template).gsub(/(.+)\.html\.haml/)  { $1 }
    themes[short_name.to_sym] = []
    Dir["#{LOCAL_ROOT}/../../stylesheets/#{short_name}/*.scss"].each do |stylesheet|
      next unless stylesheet.include?('.theme')
      themes[short_name.to_sym] << File.basename(stylesheet).gsub(/^\_(.+)\.theme\.scss/) { $1 }
    end
  end
  themes
end