Class: Twin::Job
- Inherits:
-
Struct
- Object
- Struct
- Twin::Job
- Defined in:
- lib/twin/scanner.rb
Overview
One YAML block from a sync-file, enriched with live filesystem state.
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#cmd ⇒ Object
Returns the value of attribute cmd.
-
#conflict ⇒ Object
Returns the value of attribute conflict.
-
#description ⇒ Object
Returns the value of attribute description.
-
#excludes ⇒ Object
Returns the value of attribute excludes.
-
#label ⇒ Object
Returns the value of attribute label.
-
#path ⇒ Object
Returns the value of attribute path.
-
#program ⇒ Object
Returns the value of attribute program.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_exists ⇒ Object
Returns the value of attribute source_exists.
-
#source_mtime ⇒ Object
Returns the value of attribute source_mtime.
-
#sync_file ⇒ Object
Returns the value of attribute sync_file.
-
#target ⇒ Object
Returns the value of attribute target.
-
#target_exists ⇒ Object
Returns the value of attribute target_exists.
-
#target_mtime ⇒ Object
Returns the value of attribute target_mtime.
Instance Method Summary collapse
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def active @active end |
#cmd ⇒ Object
Returns the value of attribute cmd
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def cmd @cmd end |
#conflict ⇒ Object
Returns the value of attribute conflict
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def conflict @conflict end |
#description ⇒ Object
Returns the value of attribute description
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def description @description end |
#excludes ⇒ Object
Returns the value of attribute excludes
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def excludes @excludes end |
#label ⇒ Object
Returns the value of attribute label
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def label @label end |
#path ⇒ Object
Returns the value of attribute path
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def path @path end |
#program ⇒ Object
Returns the value of attribute program
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def program @program end |
#source ⇒ Object
Returns the value of attribute source
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def source @source end |
#source_exists ⇒ Object
Returns the value of attribute source_exists
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def source_exists @source_exists end |
#source_mtime ⇒ Object
Returns the value of attribute source_mtime
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def source_mtime @source_mtime end |
#sync_file ⇒ Object
Returns the value of attribute sync_file
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def sync_file @sync_file end |
#target ⇒ Object
Returns the value of attribute target
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def target @target end |
#target_exists ⇒ Object
Returns the value of attribute target_exists
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def target_exists @target_exists end |
#target_mtime ⇒ Object
Returns the value of attribute target_mtime
6 7 8 |
# File 'lib/twin/scanner.rb', line 6 def target_mtime @target_mtime end |
Instance Method Details
#source_path ⇒ Object
12 |
# File 'lib/twin/scanner.rb', line 12 def source_path = File.join(source, path) |
#status ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/twin/scanner.rb', line 15 def status return :disabled if active != 1 return :both_missing if !source_exists && !target_exists return :missing_source unless source_exists return :missing_target unless target_exists return :target_newer if conflict return :in_sync if source_mtime.nil? || target_mtime.nil? delta = source_mtime - target_mtime return :in_sync if delta.abs < 60 delta > 0 ? :source_newer : :target_newer end |
#target_path ⇒ Object
13 |
# File 'lib/twin/scanner.rb', line 13 def target_path = File.join(target, path) |