Class: Repositories::Nimble

Inherits:
Base
  • Object
show all
Defined in:
app/models/repositories/nimble.rb

Constant Summary collapse

HAS_VERSIONS =
false
HAS_DEPENDENCIES =
false
LIBRARIAN_PLANNED =
true
URL =
'https://github.com/nim-lang/nimble'
COLOR =
'#37775b'

Constants inherited from Base

Base::HIDDEN, Base::LIBRARIAN_SUPPORT, Base::SECURITY_PLANNED

Class Method Summary collapse

Methods inherited from Base

color, dependencies, download_dependencies, formatted_name, get, get_html, get_json, get_raw, import, import_async, import_new, import_new_async, import_recent, import_recent_async, new_names, package_link, repo_fallback, save, save_dependencies, update

Class Method Details

.mapping(project) ⇒ Object


28
29
30
31
32
33
34
35
36
37
# File 'app/models/repositories/nimble.rb', line 28

def self.mapping(project)
  {
    :name => project["name"],
    :description => project["description"],
    :repository_url => repo_fallback(project['url'],project['web']),
    :keywords_array => Array.wrap(project["tags"]),
    :licenses => project['license'],
    :homepage => project['web']
  }
end

.project(name) ⇒ Object


24
25
26
# File 'app/models/repositories/nimble.rb', line 24

def self.project(name)
  projects[name.downcase]
end

.project_namesObject


9
10
11
# File 'app/models/repositories/nimble.rb', line 9

def self.project_names
  projects.keys.sort
end

.projectsObject


13
14
15
16
17
18
19
20
21
22
# File 'app/models/repositories/nimble.rb', line 13

def self.projects
  @projects ||= begin
    prjcts = {}
    packages = get("https://raw.githubusercontent.com/nim-lang/packages/master/packages.json")
    packages.each do |hash|
      prjcts[hash['name'].downcase] = hash.slice('name', 'url', 'description', 'tags', 'license', 'web')
    end
    prjcts
  end
end