Module: Pubba::Monitor

Extended by:
Monitor
Included in:
Monitor
Defined in:
lib/pubba/monitor.rb

Instance Method Summary collapse

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pubba/monitor.rb', line 7

def run
  script_asset_folder = File.join(Pubba.asset_folder, Pubba.script_folder)
  style_asset_folder = File.join(Pubba.asset_folder, Pubba.style_folder)

  puts ">> Pubba is now monitoring:\n>>   #{script_asset_folder}\n>>   #{style_asset_folder}"
  FSSM.monitor do
    path script_asset_folder do
      glob '**/*'
      update {|base, relative, type| Site.process}
      delete {|base, relative, type| Site.process}
      create {|base, relative, type| Site.process}
    end

    path style_asset_folder do
      glob '**/*'
      update {|base, relative, type| Site.process}
      delete {|base, relative, type| Site.process}
      create {|base, relative, type| Site.process}
    end
  end
end