Class: Writefully::Tools::Synchronizer

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/writefully/tools/synchronizer.rb

Constant Summary collapse

SYNC_SCRIPT =
File.dirname(__FILE__) + "/../../../scripts/sync.sh"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Synchronizer

Returns a new instance of Synchronizer.



10
11
12
# File 'lib/writefully/tools/synchronizer.rb', line 10

def initialize message
  @message = message
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



8
9
10
# File 'lib/writefully/tools/synchronizer.rb', line 8

def message
  @message
end

Instance Method Details

#syncObject



14
15
16
17
# File 'lib/writefully/tools/synchronizer.rb', line 14

def sync
  Writefully.logger.info "Synchronizing #{message[:site_slug]}"
  system(sync_command)
end

#sync_commandObject



19
20
21
# File 'lib/writefully/tools/synchronizer.rb', line 19

def sync_command
  ['bash', SYNC_SCRIPT, Writefully.options[:content], message[:site_slug]].join(' ')
end