Module: ATK

Defined in:
lib/atk/atk_info.rb

Class Method Summary collapse

Class Method Details

.infoObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/atk/atk_info.rb', line 44

def self.info
    settings_path = ATK.paths[:info]
    atk_settings_key = "atk_settings"
    # if it doesn't exist then create it
    if not FS.exist?(settings_path)
        FS.write("#{atk_settings_key}: {}", to: settings_path)
        return {}
    else
        data = YAML.load_file(settings_path)
        if data.is_a?(Hash)
            if data[atk_settings_key].is_a?(Hash)
                return data[atk_settings_key]
            end
        else
            return {}
        end
    end
end

.pathsObject



32
33
34
# File 'lib/atk/atk_info.rb', line 32

def self.paths
    return AtkPaths
end

.temp_path(filepath) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/atk/atk_info.rb', line 36

def self.temp_path(filepath)
    new_path = ATK.paths[:temp]/filepath
    # make sure the path is empty
    FS.write("", to: new_path)
    FS.delete(new_path)
    return new_path
end