Sha256: c8f6110b5d88b97a3cdfaa97f852cbc8125aa66e7c5988ebbb3020bee915b126

Contents?: true

Size: 634 Bytes

Versions: 1

Compression:

Stored size: 634 Bytes

Contents

require 'action_view'

module Thebes

  class ConfigWriter

    def initialize template_path=nil, template_file=nil
      @template_path = template_path || File.join(File.dirname(__FILE__), '..', '..', 'templates')
      @template_file = template_file || 'sphinx.conf'
    end
    
    def default_config_file
      "./#{@@config_template}"
    end

    def build(outfile=nil, locals={})
      outfile ||= default_config_file
      view = ActionView::Base.new(
        @template_path,
        locals
      )
      File.open(outfile, 'w') do |file|
        file.write view.render(:file => @template_file)
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thebes-0.0.3 lib/thebes/config_writer.rb