Class: DevSnap::Engine

Inherits:
Object
  • Object
show all
Includes:
TR::CondUtils
Defined in:
lib/dev_snap/engine.rb

Instance Method Summary collapse

Instance Method Details

#ignore(path) ⇒ Object



26
27
28
# File 'lib/dev_snap/engine.rb', line 26

def ignore(path)
  config.remove_path(path)
end

#is_monitoring?(path) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/dev_snap/engine.rb', line 22

def is_monitoring?(path)
  config.monitor_paths.include?(path)
end

#monitor(path) ⇒ Object



18
19
20
# File 'lib/dev_snap/engine.rb', line 18

def monitor(path)
  config.add_to_monitor(path)
end

#monitoring_pathsObject



30
31
32
# File 'lib/dev_snap/engine.rb', line 30

def monitoring_paths
  config.monitor_paths
end

#runObject

Raises:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/dev_snap/engine.rb', line 34

def run

  raise Error, "Snap root not given" if is_empty?(config.snap_root)

  config.monitor_paths.each do |pa|
    begin
      STDOUT.puts "Snapping '#{pa}'"
      sr = SnapRepos.new(config.snap_root, File.basename(pa))
      backPath = sr.init
      mw = MonitorWorkspace.new(pa, backPath)
      mw.run
    rescue Exception => ex
      logger.error ex
    end
  end

end

#set_snap_root(path) ⇒ Object



10
11
12
# File 'lib/dev_snap/engine.rb', line 10

def set_snap_root(path)
  config.set_snap_root(path)
end

#snap_rootObject



14
15
16
# File 'lib/dev_snap/engine.rb', line 14

def snap_root
  config.snap_root 
end