Sha256: f9e3b7c2caa31bfd106fd46af2110f242e692684be0fa7b47840f73f7506dde8

Contents?: true

Size: 424 Bytes

Versions: 19

Compression:

Stored size: 424 Bytes

Contents

require 'fileutils'
require 'etc'

module Vpsb
  module Helpers
    class FileReplace
      def self.replace_json(path, hash)
        replace_text(path, hash.to_json)
      end

      def self.replace_text(path, text)
        file_path = File.join(Dir.pwd, path)
        FileUtils.rm(file_path) if File.exist?(file_path)
        File.open(file_path,"w") do |f|
          f.write(text)
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
vpsb-1.1.8 lib/vpsb/helpers/file_replace.rb
vpsb-1.1.7 lib/vpsb/helpers/file_replace.rb
vpsb-1.1.6 lib/vpsb/helpers/file_replace.rb
vpsb-1.1.5 lib/vpsb/helpers/file_replace.rb
vpsb-1.1.4 lib/vpsb/helpers/file_replace.rb
vpsb-1.1.3 lib/vpsb/helpers/file_replace.rb
vpsb-1.1.2 lib/vpsb/helpers/file_replace.rb
vpsb-1.1.1 lib/vpsb/helpers/file_replace.rb
vpsb-1.1.0 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.9 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.8 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.7 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.6 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.5 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.4 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.3 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.2 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.1 lib/vpsb/helpers/file_replace.rb
vpsb-1.0.0 lib/vpsb/helpers/file_replace.rb