lib/nanoc/base/compilation/outdatedness_checker.rb
def basic_outdatedness_reason_for(obj)
      case obj.type
        when :item_rep
          # Outdated if rules outdated
          return Nanoc::OutdatednessReasons::RulesModified if
            rule_memory_differs_for(obj)

          # Outdated if checksums are missing or different
          return Nanoc::OutdatednessReasons::NotEnoughData if !checksums_available?(obj.item)
          return Nanoc::OutdatednessReasons::SourceModified if !checksums_identical?(obj.item)

          # Outdated if compiled file doesn't exist (yet)
          return Nanoc::OutdatednessReasons::NotWritten if obj.raw_path && !File.file?(obj.raw_path)

          # Outdated if code snippets outdated
          return Nanoc::OutdatednessReasons::CodeSnippetsModified if site.code_snippets.any? do |cs|
            object_modified?(cs)
          end

          # Outdated if configuration outdated
          return Nanoc::OutdatednessReasons::ConfigurationModified if object_modified?(site.config)

          # Not outdated
          return nil
        when :item
          obj.reps.find { |rep| basic_outdatedness_reason_for(rep) }
        when :layout
          # Outdated if rules outdated
          return Nanoc::OutdatednessReasons::RulesModified if
            rule_memory_differs_for(obj)

          # Outdated if checksums are missing or different
          return Nanoc::OutdatednessReasons::NotEnoughData if !checksums_available?(obj)
          return Nanoc::OutdatednessReasons::SourceModified if !checksums_identical?(obj)

          # Not outdated
          return nil
        else
          raise RuntimeError, "do not know how to check outdatedness of #{obj.inspect}"
      end
    end
# Calculates the reason why the given object is outdated. This method does
# not take dependencies into account; use {#outdatedness_reason_for?} if
# you want to include dependencies in the outdatedness check.
#
# @param [Nanoc::Item, Nanoc::ItemRep, Nanoc::Layout] obj The object
#   whose outdatedness reason should be calculated.
#
# @return [Nanoc::OutdatednessReasons::Generic, nil] The reason why the
#   given object is outdated, or nil if the object is not outdated.
Calculates the reason why the given object is outdated. This method does
not take dependencies into account; use {#outdatedness_reason_for?} if
you want to include dependencies in the outdatedness check.
Calculates the reason why the given object is outdated . This method does not take dependencies into account ; use { #outdatedness_reason_for? } if you want to include dependencies in the outdatedness check .
def basic_outdatedness_reason_for(obj)
      case obj.type
        when :item_rep
          return Nanoc::OutdatednessReasons::RulesModified if
            rule_memory_differs_for(obj)
          return Nanoc::OutdatednessReasons::NotEnoughData if !checksums_available?(obj.item)
          return Nanoc::OutdatednessReasons::SourceModified if !checksums_identical?(obj.item)
          return Nanoc::OutdatednessReasons::NotWritten if obj.raw_path && !File.file?(obj.raw_path)
          return Nanoc::OutdatednessReasons::CodeSnippetsModified if site.code_snippets.any? do |cs|
            object_modified?(cs)
          end
          return Nanoc::OutdatednessReasons::ConfigurationModified if object_modified?(site.config)
          return nil
        when :item
          obj.reps.find { |rep| basic_outdatedness_reason_for(rep) }
        when :layout
          return Nanoc::OutdatednessReasons::RulesModified if
            rule_memory_differs_for(obj)
          return Nanoc::OutdatednessReasons::NotEnoughData if !checksums_available?(obj)
          return Nanoc::OutdatednessReasons::SourceModified if !checksums_identical?(obj)
          return nil
        else
          raise RuntimeError, "do not know how to check outdatedness of #{obj.inspect}"
      end
    end
def basic_outdatedness_reason_for ( obj ) case obj . type when :item_rep return Nanoc :: OutdatednessReasons :: RulesModified if rule_memory_differs_for ( obj ) return Nanoc :: OutdatednessReasons :: NotEnoughData if ! checksums_available? ( obj . item ) return Nanoc :: OutdatednessReasons :: SourceModified if ! checksums_identical? ( obj . item ) return Nanoc :: OutdatednessReasons :: NotWritten if obj . raw_path && ! File . file? ( obj . raw_path ) return Nanoc :: OutdatednessReasons :: CodeSnippetsModified if site . code_snippets . any? do | cs | object_modified? ( cs ) end return Nanoc :: OutdatednessReasons :: ConfigurationModified if object_modified? ( site . config ) return nil when :item obj . reps . find { | rep | basic_outdatedness_reason_for ( rep ) } when :layout return Nanoc :: OutdatednessReasons :: RulesModified if rule_memory_differs_for ( obj ) return Nanoc :: OutdatednessReasons :: NotEnoughData if ! checksums_available? ( obj ) return Nanoc :: OutdatednessReasons :: SourceModified if ! checksums_identical? ( obj ) return nil else raise RuntimeError , "do not know how to check outdatedness of #{obj.inspect}" end end
Calculates the reason why the given object is outdated.
Calculates the reason why the given object is outdated .
# Outdated if rules outdated # Outdated if checksums are missing or different # Outdated if compiled file doesn't exist (yet) # Outdated if code snippets outdated # Outdated if configuration outdated # Not outdated # Outdated if rules outdated # Outdated if checksums are missing or different # Not outdated
The reason why the given object is outdated, or nil if the object is not outdated.
The reason why the given object is outdated or nil if the object is not outdated .
Nanoc::OutdatednessReasons::Generic, nil
obj
obj The object whose outdatedness reason should be calculated.
obj The object whose outdatedness reason should be calculated .