lib/origen/generator/compiler.rb
# Compile the supplied file if it is an erb template writing the compiled
# version to the destination directory.
# If the file is not an erb template it is simply copied un-altered to the
# destination directory.
# File must be an absolute path to the file.
Compile the supplied file if it is an erb template writing the compiled
version to the destination directory.
If the file is not an erb template it is simply copied un-altered to the
destination directory.
File must be an absolute path to the file.
Compile the supplied file if it is an erb template writing the compiled version to the destination directory . If the file is not an erb template it is simply copied un - altered to the destination directory . File must be an absolute path to the file .
def compile_file(file, options = {})
        @current_file = Pathname.new(file)
        Origen.file_handler.default_extension = nil
        begin
          Origen.log.info "Compiling... #{relative_path_to(file)}" unless options[:quiet]
        rescue
          Origen.log.info "Compiling... #{file}" unless options[:quiet]
        end
        Origen.log.info "  Created... #{relative_path_to(output_file(file, options))}" unless options[:quiet]
        stats.completed_files += 1 if options[:collect_stats]
        if is_erb?(file)
          output = run_erb(file, options)
          f = output_file(file, options).to_s
          if output.is_a?(Pathname)
            FileUtils.mv output.to_s, f
          else
            File.open(f, 'w') { |out| out.puts output }
          end
        else  
          out = output_file(file, options)
          FileUtils.rm_f(out.to_s) if File.exist?(out.to_s)
          FileUtils.cp(file.to_s, out.dirname.to_s)
        end
        if options[:zip]
          `gzip -f -9 #{output_file(file, options)}`
        else
          if @check_for_changes
            check_for_changes(output_file(file, options), reference_file(file, options),
                              comment_char: Origen.app.tester ? Origen.app.tester.program_comment_char : nil,
                              compile_job:  true)
          end
        end
      end
def compile_file ( file , options = { } ) @current_file = Pathname . new ( file ) Origen . file_handler . default_extension = nil begin Origen . log . info "Compiling... #{relative_path_to(file)}" unless options [ :quiet ] rescue Origen . log . info "Compiling... #{file}" unless options [ :quiet ] end Origen . log . info "  Created... #{relative_path_to(output_file(file, options))}" unless options [ :quiet ] stats . completed_files += 1 if options [ :collect_stats ] if is_erb? ( file ) output = run_erb ( file , options ) f = output_file ( file , options ) . to_s if output . is_a? ( Pathname ) FileUtils . mv output . to_s , f else File . open ( f , 'w' ) { | out | out . puts output } end else out = output_file ( file , options ) FileUtils . rm_f ( out . to_s ) if File . exist? ( out . to_s ) FileUtils . cp ( file . to_s , out . dirname . to_s ) end if options [ :zip ] ` gzip -f -9  #{ output_file ( file , options ) } ` else if @check_for_changes check_for_changes ( output_file ( file , options ) , reference_file ( file , options ) , comment_char : Origen . app . tester ? Origen . app . tester . program_comment_char : nil , compile_job : true ) end end end
Compile the supplied file if it is an erb template writing the compiled
version to the destination directory.
Compile the supplied file if it is an erb template writing the compiled version to the destination directory .
# This is used when templates are compiled through a test program, but can # be problematic when used to compile files standalone. In practice this may # not be an issue except when testing Origen and generating and compiling within # the same thread, but clearing this here doesn't seem to do any harm. # Just copy it across # Delete the target if it already exists, this prevents permission denied errors when copying
file
<not_specific>
options
<not_specific>