Sha256: 5d0bed8ef0383e8befc243d409abb9bc4e62ded0c99d36a14ecdf49321b018bd

Contents?: true

Size: 639 Bytes

Versions: 21

Compression:

Stored size: 639 Bytes

Contents

# frozen_string_literal: true

require "json"

module Icarus
  module Mod
    # Reads the configuration file
    class Config
      class << self
        def config
          return @config if @config

          read
        end

        def read(config_file = self.config_file)
          @config = JSON.parse(File.read(config_file), object_class: OpenStruct)
        end

        def firebase
          @config.firebase
        end

        def github
          @config.github
        end

        private

        def config_file
          @config_file ||= File.join(Dir.home, "/.imtconfig.json")
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
Icarus-Mod-Tools-2.1.4 lib/icarus/mod/config.rb
Icarus-Mod-Tools-2.1.3 lib/icarus/mod/config.rb
Icarus-Mod-Tools-2.1.2 lib/icarus/mod/config.rb
Icarus-Mod-Tools-2.1.1 lib/icarus/mod/config.rb
Icarus-Mod-Tools-2.1.0 lib/icarus/mod/config.rb
Icarus-Mod-Tools-2.0.4 lib/icarus/mod/config.rb
Icarus-Mod-Tools-2.0.3 lib/icarus/mod/config.rb
Icarus-Mod-Tools-2.0.1 lib/icarus/mod/config.rb
Icarus-Mod-Tools-2.0 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.9.0 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.8.2.1 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.8.2 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.8.1 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.8.0 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.7.1 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.7.0 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.6.0 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.5.1 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.5.0 lib/icarus/mod/config.rb
Icarus-Mod-Tools-1.4.1 lib/icarus/mod/config.rb