Sha256: 2bb59ee04c2c0e04ca78e664637833b985d5cf2fe240ca7eeb62d0c68074a93d

Contents?: true

Size: 801 Bytes

Versions: 42

Compression:

Stored size: 801 Bytes

Contents

module DeployGate
  module Config
    class Base
      class << self
        def file_path
          # Please override this method
          raise NotImplementedError.new("You must implement #{self.class}##{__method__}")
        end

        # @param [Hash] config
        # @return [void]
        def write(config)
          FileUtils.mkdir_p(File.dirname(file_path))

          data = JSON.generate(config)
          file = File.open(file_path, "w+")
          file.print data
          file.close
        end

        # @return [Hash]
        def read
          file = File.open(file_path)
          data = file.read
          file.close
          JSON.parse(data)
        end

        # @return [Boolean]
        def exist?
          File.exist?(file_path)
        end
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
deploygate-0.9.1 lib/deploygate/config/base.rb
deploygate-0.9.0 lib/deploygate/config/base.rb
deploygate-0.8.6 lib/deploygate/config/base.rb
deploygate-0.8.5 lib/deploygate/config/base.rb
deploygate-0.8.4 lib/deploygate/config/base.rb
deploygate-0.8.3 lib/deploygate/config/base.rb
deploygate-0.8.2 lib/deploygate/config/base.rb
deploygate-0.8.1 lib/deploygate/config/base.rb
deploygate-0.8.0 lib/deploygate/config/base.rb
deploygate-0.7.0 lib/deploygate/config/base.rb
deploygate-0.6.8 lib/deploygate/config/base.rb
deploygate-0.6.7 lib/deploygate/config/base.rb
deploygate-0.6.6 lib/deploygate/config/base.rb
deploygate-0.6.5 lib/deploygate/config/base.rb
deploygate-0.6.4 lib/deploygate/config/base.rb
deploygate-0.6.3 lib/deploygate/config/base.rb
deploygate-0.6.2 lib/deploygate/config/base.rb
deploygate-0.6.1 lib/deploygate/config/base.rb
deploygate-0.6.0 lib/deploygate/config/base.rb
deploygate-0.5.6 lib/deploygate/config/base.rb