Class: Build::Files::IOState
- Inherits:
-
Object
- Object
- Build::Files::IOState
- Defined in:
- lib/build/files/state.rb
Instance Attribute Summary collapse
-
#input_state ⇒ Object
readonly
Returns the value of attribute input_state.
-
#output_state ⇒ Object
readonly
Returns the value of attribute output_state.
Instance Method Summary collapse
- #added ⇒ Object
- #changed ⇒ Object
-
#dirty? ⇒ Boolean
Output is dirty if files are missing or if latest input is older than any output.
- #files ⇒ Object
- #fresh? ⇒ Boolean
-
#initialize(inputs, outputs) ⇒ IOState
constructor
A new instance of IOState.
- #inspect ⇒ Object
- #intersects?(outputs) ⇒ Boolean
- #removed ⇒ Object
- #update! ⇒ Object
Constructor Details
Instance Attribute Details
#input_state ⇒ Object (readonly)
Returns the value of attribute input_state.
142 143 144 |
# File 'lib/build/files/state.rb', line 142 def input_state @input_state end |
#output_state ⇒ Object (readonly)
Returns the value of attribute output_state.
143 144 145 |
# File 'lib/build/files/state.rb', line 143 def output_state @output_state end |
Instance Method Details
#added ⇒ Object
184 185 186 |
# File 'lib/build/files/state.rb', line 184 def added @input_state.added + @output_state.added end |
#changed ⇒ Object
192 193 194 |
# File 'lib/build/files/state.rb', line 192 def changed @input_state.changed + @output_state.changed end |
#dirty? ⇒ Boolean
Output is dirty if files are missing or if latest input is older than any output.
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/build/files/state.rb', line 146 def dirty? @dirty = [] if @output_state.missing? # puts "Output file missing: #{output_state.missing.inspect}" return true end # If there are no inputs, we are always clean as long as outputs exist: # if @input_state.empty? # return false # end oldest_output_time = @output_state.oldest_time newest_input_time = @input_state.newest_time if newest_input_time and oldest_output_time # if newest_input_time > oldest_output_time # puts "Out of date file: #{newest_input_time.inspect} > #{oldest_output_time.inspect}" # end return newest_input_time > oldest_output_time end # puts "Missing file dates: #{newest_input_time.inspect} < #{oldest_output_time.inspect}" return true end |
#files ⇒ Object
180 181 182 |
# File 'lib/build/files/state.rb', line 180 def files @input_state.files + @output_state.files end |
#fresh? ⇒ Boolean
176 177 178 |
# File 'lib/build/files/state.rb', line 176 def fresh? not dirty? end |
#inspect ⇒ Object
207 208 209 |
# File 'lib/build/files/state.rb', line 207 def inspect "<IOState Input:#{@input_state.inspect} Output:#{@output_state.inspect}>" end |
#intersects?(outputs) ⇒ Boolean
203 204 205 |
# File 'lib/build/files/state.rb', line 203 def intersects?(outputs) @input_state.intersects?(outputs) or @output_state.intersects?(outputs) end |
#removed ⇒ Object
188 189 190 |
# File 'lib/build/files/state.rb', line 188 def removed @input_state.removed + @output_state.removed end |
#update! ⇒ Object
196 197 198 199 200 201 |
# File 'lib/build/files/state.rb', line 196 def update! input_changed = @input_state.update! output_changed = @output_state.update! input_changed or output_changed end |