Class: Maglove::Theme

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/maglove/theme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_dirObject (readonly)

Returns the value of attribute base_dir.



5
6
7
# File 'lib/maglove/theme.rb', line 5

def base_dir
  @base_dir
end

#base_versionObject (readonly)

Returns the value of attribute base_version.



4
5
6
# File 'lib/maglove/theme.rb', line 4

def base_version
  @base_version
end

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/maglove/theme.rb', line 4

def description
  @description
end

#dist_dirObject (readonly)

Returns the value of attribute dist_dir.



5
6
7
# File 'lib/maglove/theme.rb', line 5

def dist_dir
  @dist_dir
end

#fontsObject (readonly)

Returns the value of attribute fonts.



4
5
6
# File 'lib/maglove/theme.rb', line 4

def fonts
  @fonts
end

#identifierObject (readonly)

Returns the value of attribute identifier.



4
5
6
# File 'lib/maglove/theme.rb', line 4

def identifier
  @identifier
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/maglove/theme.rb', line 4

def name
  @name
end

#src_dirObject (readonly)

Returns the value of attribute src_dir.



5
6
7
# File 'lib/maglove/theme.rb', line 5

def src_dir
  @src_dir
end

#templatesObject (readonly)

Returns the value of attribute templates.



4
5
6
# File 'lib/maglove/theme.rb', line 4

def templates
  @templates
end

#widgetsObject (readonly)

Returns the value of attribute widgets.



4
5
6
# File 'lib/maglove/theme.rb', line 4

def widgets
  @widgets
end

Instance Method Details

#load(identifier) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/maglove/theme.rb', line 11

def load(identifier)
  yaml = Workspace::Dir.new(Dir.pwd, "src/themes/#{identifier}").file("theme.yml").read_yaml
  # theme properties
  @identifier = yaml["identifier"]
  @name = yaml["name"]
  @base_version = yaml["base_version"]
  @description = yaml["description"]
  @templates = yaml["templates"]
  @fonts = yaml["fonts"]
  @widgets = yaml["widgets"]
  # directories
  @src_dir = Workspace.dir(File.join(Dir.pwd, "src/themes/#{@identifier}"))
  @dist_dir = Workspace.dir(File.join(Dir.pwd, "dist/themes/#{@identifier}"))
  @base_dir = Workspace.dir(File.join(Dir.pwd, "src/base/#{@base_version}"))
end

#loaded?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/maglove/theme.rb', line 7

def loaded?
  !identifier.nil?
end