Sha256: eaa216ca77087332999add11b38b426a583df33220b56e5dcbed8be95dfe028c

Contents?: true

Size: 986 Bytes

Versions: 1

Compression:

Stored size: 986 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.bluejeansnet.com'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bourdain-1.3.3 lib/bourdain/helpers.rb