class Embork::Borkfile
Public Class Methods
new(path_to_borkfile, environment = :development)
click to toggle source
# File lib/embork/borkfile.rb, line 145 def initialize(path_to_borkfile, environment = :development) @logger = Embork::Logger.new(STDOUT, :simple) @path_to_borkfile = path_to_borkfile @environment = environment.to_sym check_borkfile file = DSL.new(environment, @logger) file.get_binding.eval File.read(@path_to_borkfile) set_options file end
Protected Instance Methods
check_borkfile()
click to toggle source
# File lib/embork/borkfile.rb, line 157 def check_borkfile unless File.exists? @path_to_borkfile @logger.error 'No Borkfile found at %s.' % @path_to_borkfile exit 1 end end
set_options(file)
click to toggle source
# File lib/embork/borkfile.rb, line 164 def set_options(file) # Setup paths default_paths = [ 'config/%s' % [ @environment.to_s ], 'app', 'app/styles', 'components' ] @asset_paths = default_paths.concat file.asset_paths # Setup root if file.project_root if file.project_root[0] == '/' @project_root = file.project_root else @project_root = File.expand_path "../#{file.project_root}", @path_to_borkfile end else @project_root = File.expand_path '..', @path_to_borkfile end # Copy everything else (Attributes.instance_methods - [ :asset_paths, :project_root ]).each do |attr| self.instance_variable_set("@#{attr}".to_sym, file.send(attr)) end end