Sha256: a940849a1ab193089416270d88d24d3be46f417412680eacacf02d798005537c

Contents?: true

Size: 741 Bytes

Versions: 23

Compression:

Stored size: 741 Bytes

Contents

class Jets::Util
  class << self
    # Make sure that the result is a text.
    def normalize_result(result)
      JSON.dump(result)
    end

    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

    def sh(command, quiet: false)
      puts "=> #{command}" unless quiet
      system(command)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
jets-1.4.8 lib/jets/util.rb
jets-1.4.7 lib/jets/util.rb
jets-1.4.6 lib/jets/util.rb