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.6.5 lib/jets/util.rb
jets-1.6.4 lib/jets/util.rb
jets-1.6.3 lib/jets/util.rb
jets-1.6.2 lib/jets/util.rb
jets-1.6.1 lib/jets/util.rb
jets-1.6.0 lib/jets/util.rb
jets-1.5.10 lib/jets/util.rb
jets-1.5.9 lib/jets/util.rb
jets-1.5.8 lib/jets/util.rb
jets-1.5.7 lib/jets/util.rb
jets-1.5.6 lib/jets/util.rb
jets-1.5.5 lib/jets/util.rb
jets-1.5.4 lib/jets/util.rb
jets-1.5.3 lib/jets/util.rb
jets-1.5.2 lib/jets/util.rb
jets-1.5.1 lib/jets/util.rb
jets-1.5.0 lib/jets/util.rb
jets-1.4.11 lib/jets/util.rb
jets-1.4.10 lib/jets/util.rb
jets-1.4.9 lib/jets/util.rb