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”



50
51
52
# File 'lib/multisync/definition/dsl.rb', line 50

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”



56
57
58
# File 'lib/multisync/definition/dsl.rb', line 56

def check_to flag = true
  @to_check = flag
end

#defaultObject



39
40
41
# File 'lib/multisync/definition/dsl.rb', line 39

def default
  @default = true
end

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



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

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



3
4
5
# File 'lib/multisync/definition/dsl.rb', line 3

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

#include(name) ⇒ Object



15
16
17
18
# File 'lib/multisync/definition/dsl.rb', line 15

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



44
45
46
# File 'lib/multisync/definition/dsl.rb', line 44

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

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



34
35
36
37
# File 'lib/multisync/definition/dsl.rb', line 34

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

#sync(name, &block) ⇒ Object



7
8
9
# File 'lib/multisync/definition/dsl.rb', line 7

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

#template(name, &block) ⇒ Object



11
12
13
# File 'lib/multisync/definition/dsl.rb', line 11

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

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



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

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