Class: Docks::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/docks/configuration.rb

Constant Summary collapse

ROOT_DEPENDENT_PATHS =
[
  :sources,
  :destination,
  :cache_location,
  :templates
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



35
36
37
# File 'lib/docks/configuration.rb', line 35

def initialize
  restore_defaults
end

Instance Attribute Details

#asset_foldersObject

Locations



26
27
28
# File 'lib/docks/configuration.rb', line 26

def asset_folders
  @asset_folders
end

#cache_locationObject

Locations



26
27
28
# File 'lib/docks/configuration.rb', line 26

def cache_location
  @cache_location
end

#compiled_assetsObject

Random assortment of other stuff



29
30
31
# File 'lib/docks/configuration.rb', line 29

def compiled_assets
  @compiled_assets
end

#configuredObject (readonly)

Stateful stuff



33
34
35
# File 'lib/docks/configuration.rb', line 33

def configured
  @configured
end

#destinationObject

Key details — these are required



23
24
25
# File 'lib/docks/configuration.rb', line 23

def destination
  @destination
end

#github_repoObject

Random assortment of other stuff



29
30
31
# File 'lib/docks/configuration.rb', line 29

def github_repo
  @github_repo
end

#helpersObject

Random assortment of other stuff



29
30
31
# File 'lib/docks/configuration.rb', line 29

def helpers
  @helpers
end

#mount_atObject

Random assortment of other stuff



29
30
31
# File 'lib/docks/configuration.rb', line 29

def mount_at
  @mount_at
end

#naming_conventionObject

Random assortment of other stuff



29
30
31
# File 'lib/docks/configuration.rb', line 29

def naming_convention
  @naming_convention
end

#paginateObject

Random assortment of other stuff



29
30
31
# File 'lib/docks/configuration.rb', line 29

def paginate
  @paginate
end

#pattern_id(*args) ⇒ Object

Random assortment of other stuff



29
30
31
# File 'lib/docks/configuration.rb', line 29

def pattern_id
  @pattern_id
end

#rootObject

Locations



26
27
28
# File 'lib/docks/configuration.rb', line 26

def root
  @root
end

#sourcesObject

Key details — these are required



23
24
25
# File 'lib/docks/configuration.rb', line 23

def sources
  @sources
end

#templatesObject

Locations



26
27
28
# File 'lib/docks/configuration.rb', line 26

def templates
  @templates
end

#themeObject

Key details — these are required



23
24
25
# File 'lib/docks/configuration.rb', line 23

def theme
  @theme
end

Instance Method Details

#custom_languages {|Languages| ... } ⇒ Object

Yields:



86
87
88
# File 'lib/docks/configuration.rb', line 86

def custom_languages
  yield Languages
end

#custom_parsers {|Parser| ... } ⇒ Object

Yields:



106
107
108
# File 'lib/docks/configuration.rb', line 106

def custom_parsers
  yield Parser
end

#custom_symbol_sources {|SymbolSources| ... } ⇒ Object

Yields:



102
103
104
# File 'lib/docks/configuration.rb', line 102

def custom_symbol_sources
  yield SymbolSources
end

#custom_tags {|Tags| ... } ⇒ Object

Yields:



90
91
92
# File 'lib/docks/configuration.rb', line 90

def custom_tags
  yield Tags
end

#custom_templates {|Templates| ... } ⇒ Object

Yields:



94
95
96
# File 'lib/docks/configuration.rb', line 94

def custom_templates
  yield Templates
end

#custom_templates=(custom_templates) ⇒ Object



98
99
100
# File 'lib/docks/configuration.rb', line 98

def custom_templates=(custom_templates)
  Templates.register(custom_templates)
end

#finalizeObject



82
83
84
# File 'lib/docks/configuration.rb', line 82

def finalize
  @configured = true
end

#has_theme?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/docks/configuration.rb', line 70

def has_theme?
  !!@theme
end

#paginate?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/docks/configuration.rb', line 66

def paginate?
  !!@paginate
end

#restore_defaultsObject



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/docks/configuration.rb', line 133

def restore_defaults
  @configured = false
  @sources = [
    "styles/**/*.{css,scss,sass,less,styl}",
    "scripts/**/*.{js,coffee,coffeescript}"
  ]
  @compiled_assets = []
  @github_repo = ""
  @naming_convention = NamingConventions::BEM.instance
  @helpers = []

  @theme = false
  @paginate = false

  @root = Pathname.pwd
  @cache_location = ".#{Docks::Cache::DIR}"

  @templates = "#{Docks::ASSETS_DIR}/templates"
  @custom_templates = {
    fallback: "pattern",
    demo: "demo"
  }

  @destination = "public"
  @asset_folders = OpenStruct.new(scripts: "scripts", styles: "styles")

  @mount_at = "pattern-library"
end