Class: Jets::Util
- Inherits:
-
Object
- Object
- Jets::Util
- Defined in:
- lib/jets/util.rb
Class Method Summary collapse
- .cp_r(src, dest) ⇒ Object
-
.normalize_result(result) ⇒ Object
Make sure that the result is a text.
- .sh(command, quiet: false) ⇒ Object
Class Method Details
.cp_r(src, dest) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/jets/util.rb', line 8 def cp_r(src, dest) # Fix for https://github.com/tongueroo/jets/issues/122 # # Using FileUtils.cp_r doesnt work if there are special files like socket files in the src dir. # Instead of using this hack https://bugs.ruby-lang.org/issues/10104 # Using rsync to perform the copy. src.chop! if src.ends_with?('/') dest.chop! if dest.ends_with?('/') sh "rsync -a --links --no-specials --no-devices #{src}/ #{dest}/", quiet: true end |
.normalize_result(result) ⇒ Object
Make sure that the result is a text.
4 5 6 |
# File 'lib/jets/util.rb', line 4 def normalize_result(result) JSON.dump(result) end |
.sh(command, quiet: false) ⇒ Object
19 20 21 22 |
# File 'lib/jets/util.rb', line 19 def sh(command, quiet: false) puts "=> #{command}" unless quiet system(command) end |