Module: Multisync::Definition::Dsl

Included in:
Entity, Template
Defined in:
lib/multisync/definition/dsl.rb

Instance Method Summary collapse

Instance Method Details

#check_from(flag = true) ⇒ Object

Check source’s host or path before sync can also be set as option of “from”



52
53
54
# File 'lib/multisync/definition/dsl.rb', line 52

def check_from flag=true
  @from_check = flag
end

#check_to(flag = true) ⇒ Object

Check destination’s host or path before sync can also be set as option of “to”



58
59
60
# File 'lib/multisync/definition/dsl.rb', line 58

def check_to flag=true
  @to_check = flag
end

#defaultObject



41
42
43
# File 'lib/multisync/definition/dsl.rb', line 41

def default
  @default = true
end

#from(value, options = {}) ⇒ Object



22
23
24
25
26
27
# File 'lib/multisync/definition/dsl.rb', line 22

def from value, options={}
  @from_value = value
  # Check source's host or path before sync
  @from_check = options[:check]
  @from_description = options[:description]
end

#group(name, &block) ⇒ Object

The DSL methods



5
6
7
# File 'lib/multisync/definition/dsl.rb', line 5

def group name, &block
  Multisync::Definition::Entity.new self, name, &block
end

#include(name) ⇒ Object



17
18
19
20
# File 'lib/multisync/definition/dsl.rb', line 17

def include name
  template = Multisync::Definition::Template.lookup name
  instance_eval &template.block
end

#only_if(cmd, options = {}) ⇒ Object

Defines a check, that should pass in order to invoke the sync



46
47
48
# File 'lib/multisync/definition/dsl.rb', line 46

def only_if cmd, options={}
  @check = { cmd: cmd, message: options.fetch(:message, cmd) }
end

#options(rsync_options, mode = :append) ⇒ Object



36
37
38
39
# File 'lib/multisync/definition/dsl.rb', line 36

def options rsync_options, mode=:append
  @rsync_options_mode = mode
  @rsync_options = Array(rsync_options)
end

#sync(name, &block) ⇒ Object



9
10
11
# File 'lib/multisync/definition/dsl.rb', line 9

def sync name, &block
  Multisync::Definition::Entity.new self, name, &block
end

#template(name, &block) ⇒ Object



13
14
15
# File 'lib/multisync/definition/dsl.rb', line 13

def template name, &block
  Multisync::Definition::Template.new name, &block
end

#to(value, options = {}) ⇒ Object



29
30
31
32
33
34
# File 'lib/multisync/definition/dsl.rb', line 29

def to value, options={}
  @to_value = value
  # Check destination's host or path before sync
  @to_check = options[:check]
  @to_description = options[:description]
end