Sha256: 100dfc11cec307f5f9096a97c4e1bd48f4462834389d2f1d0faf59063f2f8fb1

Contents?: true

Size: 749 Bytes

Versions: 15

Compression:

Stored size: 749 Bytes

Contents

require 'singleton'

require 'singleton'
require 'json'

class SolaraVersionManager
    include Singleton

    def sversion
        json['solaraVersion']
    end

    def version=(value)
        new_json = json
        new_json['solaraVersion'] = value
        save(new_json)
    end

    def value(key)
        json[key]
    end

    def add(key, value)
        new_json = json
        new_json[key] = value
        save(new_json)
    end

    private

    def json
        path = FilePath.solara_version
        FileManager.create_file_if_not_exist(path)
        JSON.parse(File.read(path))
    rescue JSON::ParserError => e
        {}
    end

    def save(json)
        File.write(FilePath.solara_version, JSON.pretty_generate(json))
    end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solara-0.7.4 solara/lib/core/scripts/solara_version_manager.rb
solara-0.7.3 solara/lib/core/scripts/solara_version_manager.rb
solara-0.7.2 solara/lib/core/scripts/solara_version_manager.rb
solara-0.7.1 solara/lib/core/scripts/solara_version_manager.rb
solara-0.7.0 solara/lib/core/scripts/solara_version_manager.rb
solara-0.6.0 solara/lib/core/scripts/solara_version_manager.rb
solara-0.5.0 solara/lib/core/scripts/solara_version_manager.rb
solara-0.4.0 solara/lib/core/scripts/solara_version_manager.rb
solara-0.3.0 solara/lib/core/scripts/solara_version_manager.rb
solara-0.2.4 solara/lib/core/scripts/solara_version_manager.rb
solara-0.2.3 solara/lib/core/scripts/solara_version_manager.rb
solara-0.2.2 solara/lib/core/scripts/solara_version_manager.rb
solara-0.2.1 solara/lib/core/scripts/solara_version_manager.rb
solara-0.2.0 solara/lib/core/scripts/solara_version_manager.rb
solara-0.1.0 solara/lib/core/scripts/solara_version_manager.rb