Class: SourceTreeSyncer
- Inherits:
-
Object
- Object
- SourceTreeSyncer
- Defined in:
- lib/gorgon/source_tree_syncer.rb
Constant Summary collapse
- RSYNC_TRANSPORT_SSH =
'ssh'
- RSYNC_TRANSPORT_ANONYMOUS =
'anonymous'
- SYS_COMMAND =
'rsync'
- OPTS =
'-azr --timeout=5 --delete'
- RSH_OPTS =
'ssh -o NumberOfPasswordPrompts=0 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i gorgon.pem'
- EXCLUDE_OPT =
'--exclude'
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#sys_command ⇒ Object
readonly
Returns the value of attribute sys_command.
Instance Method Summary collapse
-
#initialize(sync_config) ⇒ SourceTreeSyncer
constructor
A new instance of SourceTreeSyncer.
- #push ⇒ Object
- #remove_temp_dir ⇒ Object
- #success? ⇒ Boolean
-
#sync ⇒ Object
TODO: rename sync to pull.
Constructor Details
#initialize(sync_config) ⇒ SourceTreeSyncer
Returns a new instance of SourceTreeSyncer.
14 15 16 17 18 19 20 |
# File 'lib/gorgon/source_tree_syncer.rb', line 14 def initialize(sync_config) if sync_config @source_tree_path = sync_config[:source_tree_path] @exclude = sync_config[:exclude] @rsync_transport = sync_config[:rsync_transport] end end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/gorgon/source_tree_syncer.rb', line 7 def errors @errors end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
7 8 9 |
# File 'lib/gorgon/source_tree_syncer.rb', line 7 def output @output end |
#sys_command ⇒ Object (readonly)
Returns the value of attribute sys_command.
7 8 9 |
# File 'lib/gorgon/source_tree_syncer.rb', line 7 def sys_command @sys_command end |
Instance Method Details
#push ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/gorgon/source_tree_syncer.rb', line 34 def push return if blank_source_tree_path? @sys_command = "#{SYS_COMMAND} #{} . #{@source_tree_path}" execute_command end |
#remove_temp_dir ⇒ Object
46 47 48 |
# File 'lib/gorgon/source_tree_syncer.rb', line 46 def remove_temp_dir FileUtils::remove_entry_secure(@tempdir) if @tempdir end |
#success? ⇒ Boolean
42 43 44 |
# File 'lib/gorgon/source_tree_syncer.rb', line 42 def success? @exitstatus == 0 end |
#sync ⇒ Object
TODO: rename sync to pull
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gorgon/source_tree_syncer.rb', line 23 def sync return if blank_source_tree_path? @tempdir = Dir.mktmpdir("gorgon") Dir.chdir(@tempdir) @sys_command = "#{SYS_COMMAND} #{} #{@source_tree_path}/ ." execute_command end |