Sha256: 465b5bfbc630121ee278cd426f88b1a1771ce95653f233d2f4a9eb94a479a903

Contents?: true

Size: 976 Bytes

Versions: 8

Compression:

Stored size: 976 Bytes

Contents

require 'pathname'

CWD  = Dir.pwd
PATH = File.expand_path(__FILE__)
DIR  = File.dirname(PATH)
ROOT = File.expand_path(File.join(DIR, '..', '..'))
BASE = Pathname.new(ROOT).relative_path_from(Pathname.new(CWD)).to_s

def gem_path *dir
  Pathname.new(File.join(BASE, *dir)).cleanpath.to_s
end

def apply_template file, opts
  template_name, locals = opts[:template], opts[:locals]
  locals = Bourdain::Helpers::Locals.new(locals).bind unless locals.nil?
  template_path = gem_path('templates', *template_name)
  template = ERB.new File.read(template_path), nil, '-'
  contents = template.result(locals).strip
  File.open(file, 'w') { |f| f.write contents }
end

require_relative 'helpers/config'
require_relative 'helpers/locals'
require_relative 'helpers/logger'
require_relative 'helpers/parser'
require_relative 'helpers/registry'

module Bourdain
  Config = Bourdain::Helpers::Config.new(CONFIG)
  Registry = Bourdain::Helpers::Registry.new
  GITLAB_HOST = 'git.bjn.io'
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bourdain-1.6.3 lib/bourdain/helpers.rb
bourdain-1.6.2 lib/bourdain/helpers.rb
bourdain-1.6.1 lib/bourdain/helpers.rb
bourdain-1.6.0 lib/bourdain/helpers.rb
bourdain-1.5.1 lib/bourdain/helpers.rb
bourdain-1.5.0 lib/bourdain/helpers.rb
bourdain-1.4.1 lib/bourdain/helpers.rb
bourdain-1.4.0 lib/bourdain/helpers.rb