Class: Muwu::Sync
- Inherits:
-
Object
show all
- Includes:
- Muwu
- Defined in:
- lib/muwu/sync/sync.rb
Constant Summary
Constants included
from Muwu
GEM_HOME_LIB, GEM_HOME_LIB_MUWU, VERSION
Instance Method Summary
collapse
Methods included from Muwu
debug, read
Constructor Details
#initialize(project, args: []) ⇒ Sync
Returns a new instance of Sync.
8
9
10
11
12
13
|
# File 'lib/muwu/sync/sync.rb', line 8
def initialize(project, args: [])
@path_local = project.working_directory + File::SEPARATOR
@path_remote = project.options.remote_sync
@project = project
@switches = args.push(project.options.rsync_options).flatten.sort.join(' ')
end
|
Instance Method Details
#pull ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/muwu/sync/sync.rb', line 19
def pull
if @project.exceptions_include?(ProjectException::OptionRemoteSyncValueNil)
raise ProjectExceptionHandler::Fatal.new(ProjectException::OptionRemoteSyncValueNil.new)
else
sync(source: @path_remote, target: @path_local)
end
end
|
#push ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/muwu/sync/sync.rb', line 28
def push
if @project.exceptions_include?(ProjectException::OptionRemoteSyncValueNil)
raise ProjectExceptionHandler::Fatal.new(ProjectException::OptionRemoteSyncValueNil.new)
else
sync(source: @path_local, target: @path_remote)
end
end
|
#sync(source: nil, target: nil) ⇒ Object
37
38
39
40
41
|
# File 'lib/muwu/sync/sync.rb', line 37
def sync(source: nil, target: nil)
if source && target
exec_rsync(source: source, target: target)
end
end
|