Class: Jared::PluginList

Inherits:
Object
  • Object
show all
Defined in:
lib/jared/plugin_list.rb

Instance Method Summary collapse

Constructor Details

#initializePluginList

Returns a new instance of PluginList.



3
4
5
# File 'lib/jared/plugin_list.rb', line 3

def initialize
  @file = "#{Dir.home}/.jared/data/jared-plugins.json"
end

Instance Method Details

#fetchObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jared/plugin_list.rb', line 7

def fetch
  begin
    list = open('https://raw.githubusercontent.com/cyberarm/jared-plugins/master/jared-plugins.json').read
  rescue
    if File.exist?(@file)
      # We'll live.
    else
      puts "Connection error.\nCould not fetch jared-plugins.json from github.com.\n:("
      exit
    end

    File.open(@file, 'w') {|file| file.write list}
  end
end

#parseObject



22
23
24
# File 'lib/jared/plugin_list.rb', line 22

def parse
  MultiJson.load(File.open(@file).read)
end