Class: SourceTreeSyncer
- Inherits:
-
Object
- Object
- SourceTreeSyncer
- Defined in:
- lib/gorgon/source_tree_syncer.rb
Constant Summary collapse
- SYS_COMMAND =
'rsync'
- OPTS =
"-azr --timeout=5 --delete"
- EXCLUDE_OPT =
"--exclude"
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#exclude ⇒ Object
Returns the value of attribute exclude.
-
#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(source_tree_path) ⇒ SourceTreeSyncer
constructor
A new instance of SourceTreeSyncer.
- #push ⇒ Object
- #remove_temp_dir ⇒ Object
- #success? ⇒ Boolean
- #sync ⇒ Object
Constructor Details
#initialize(source_tree_path) ⇒ SourceTreeSyncer
Returns a new instance of SourceTreeSyncer.
11 12 13 14 |
# File 'lib/gorgon/source_tree_syncer.rb', line 11 def initialize source_tree_path @source_tree_path = source_tree_path @exclude = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/gorgon/source_tree_syncer.rb', line 5 def errors @errors end |
#exclude ⇒ Object
Returns the value of attribute exclude.
4 5 6 |
# File 'lib/gorgon/source_tree_syncer.rb', line 4 def exclude @exclude end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
5 6 7 |
# File 'lib/gorgon/source_tree_syncer.rb', line 5 def output @output end |
#sys_command ⇒ Object (readonly)
Returns the value of attribute sys_command.
5 6 7 |
# File 'lib/gorgon/source_tree_syncer.rb', line 5 def sys_command @sys_command end |
Instance Method Details
#push ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/gorgon/source_tree_syncer.rb', line 27 def push return if blank_source_tree_path? @sys_command = "#{SYS_COMMAND} #{OPTS} #{build_exclude_opt} . #{@source_tree_path}" execute_command end |
#remove_temp_dir ⇒ Object
39 40 41 |
# File 'lib/gorgon/source_tree_syncer.rb', line 39 def remove_temp_dir FileUtils::remove_entry_secure(@tempdir) if @tempdir end |
#success? ⇒ Boolean
35 36 37 |
# File 'lib/gorgon/source_tree_syncer.rb', line 35 def success? @exitstatus == 0 end |
#sync ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gorgon/source_tree_syncer.rb', line 16 def sync return if blank_source_tree_path? @tempdir = Dir.mktmpdir("gorgon") Dir.chdir(@tempdir) @sys_command = "#{SYS_COMMAND} #{OPTS} #{build_exclude_opt} #{@source_tree_path}/ ." execute_command end |