Class: ITGwikiMirror::Deployer

Inherits:
Object
  • Object
show all
Defined in:
lib/itgwiki_mirror/deployer.rb

Constant Summary collapse

READ_ONLY_MSG =
'This is a mirror of the wiki. Visit the live site to make changes.'

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Deployer

Returns a new instance of Deployer.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/itgwiki_mirror/deployer.rb', line 11

def initialize opts

  # verbose mode
  #
  @verbose    = opts[:verbose]

  # mysql options
  #
  @db_user = opts[:db_user]
  @db_pass = opts[:db_pass]
  @db_name = opts[:db_name]

  # MediaWiki root
  #
  @wiki  = opts[:wiki]

  # mirror directory (target of rsync from ITGwiki)
  #
  @mirror = opts[:mirror]
end

Instance Method Details

#runObject



32
33
34
35
36
37
38
39
# File 'lib/itgwiki_mirror/deployer.rb', line 32

def run

  # Watch the "complete" file. When it's touched, deploy again.
  #
  notifier = INotify::Notifier.new
  notifier.watch("#{@mirror}/complete", :attrib, :modify) { deploy }
  notifier.run
end