class Epuber::Compiler::CompilationContext
Attributes
@return [Epuber::Book]
@return [Epuber::Compiler::FileResolver]
@return [Bool]
@return [Bool]
@return [Bool]
This will track source files regardless of current target
@return [Epuber::Compiler::FileDatabase]
@return [Epuber::Book::Target]
This will track source files depend on current target
@return [Epuber::Compiler::FileDatabase]
@return [Bool]
@return [Bool]
Public Class Methods
Source
# File lib/epuber/compiler/compilation_context.rb, line 109 def initialize(book, target) @book = book @target = target @source_file_database = FileDatabase.new(Config.instance.file_stat_database_path) @target_file_database = FileDatabase.new(Config.instance.target_file_stat_database_path(target)) end
Public Instance Methods
Source
# File lib/epuber/compiler/compilation_context.rb, line 97 def debug? !release_build end
Source
# File lib/epuber/compiler/compilation_context.rb, line 101 def incremental_build? use_cache end
Source
# File lib/epuber/compiler/compilation_context.rb, line 53 def perform_plugin_things(klass, source_type) plugins.each do |plugin| plugin.instances(klass).each do |instance| # @type [Epuber::CheckerTransformerBase] instance next if instance.source_type != source_type next if instance.options.include?(:run_only_before_release) && !release_build location = instance.block.source_location.map(&:to_s).join(':') message = "performing #{source_type.inspect} from plugin #{location}" UI.print_step_processing_time(message) do yield instance end end end end
@param [Class] klass class of thing you want to perform (Checker
or Transformer
) @param [Symbol] source_type source type of that thing (Checker
or Transformer
) @param [String] processing_time_step_name name of step for processing time
@yield @yieldparam [Epuber::CheckerTransformerBase] instance of checker or transformer
@return nil
Source
# File lib/epuber/compiler/compilation_context.rb, line 32 def plugins @plugins ||= @target.plugins.map do |path| plugin = Plugin.new(path) plugin.files.each do |file| file_resolver.add_file(file) end plugin rescue LoadError => e UI.error "Can't find plugin at path #{path}, #{e}" end.compact end
@return [Array<Epuber::Plugin>]
Source
# File lib/epuber/compiler/compilation_context.rb, line 105 def release_build? release_build end
Source
# File lib/epuber/compiler/compilation_context.rb, line 93 def verbose? verbose end