module JekyllFoundationBuildingBlocks::Blocks

Public Class Methods

_install_js(key) click to toggle source
# File lib/jekyll-foundation-building-blocks/blocks.rb, line 42
def self._install_js(key)
  file = Util.fetch_url("#{BLOCKS_FILE_ROOT}#{key}/#{key}.js")
  return unless file.size > 0
  dir = File.join("js", "building-blocks")
  FileUtils.mkdir_p(dir)
  File.open(File.join(dir, "#{key}.js"), 'w').write(file)
end
_install_partial(key) click to toggle source
# File lib/jekyll-foundation-building-blocks/blocks.rb, line 26
def self._install_partial(key)
  file = Util.fetch_url("#{BLOCKS_FILE_ROOT}#{key}/#{key}.html")
  dir = File.join("_includes", "building-blocks")
  FileUtils.mkdir_p(dir)
  filename = "#{key}.html"
  File.open(File.join(dir, filename), 'w').write(file)
end
_install_scss(key) click to toggle source
# File lib/jekyll-foundation-building-blocks/blocks.rb, line 34
def self._install_scss(key)
  file = Util.fetch_url("#{BLOCKS_FILE_ROOT}#{key}/#{key}.scss")
  return unless file.size > 0
  dir = File.join("_sass", "components", "building-blocks")
  FileUtils.mkdir_p(dir)
  File.open(File.join(dir, "_#{key}.scss"), 'w').write(file)
end
install(key) click to toggle source
# File lib/jekyll-foundation-building-blocks/blocks.rb, line 18
def self.install(key)
  self._install_partial(key)
  self._install_scss(key)
  self._install_js(key)
  Jekyll.logger.info("installed #{key}")
  # TODO: Any sort of auto-inclusion we want to set up
end
list() click to toggle source
# File lib/jekyll-foundation-building-blocks/blocks.rb, line 10
def self.list
  Util.fetch_json(BLOCKS_JSON_URL).each_with_index do |pair, i|
    key = pair[0]
    value = pair[1]
    Jekyll.logger.info "#{i})".green + " #{key}".cyan + ":#{value['name']}"
  end
end