Class: Repositories::Clojars

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

Constant Summary collapse

HAS_VERSIONS =
true
HAS_DEPENDENCIES =
false
LIBRARIAN_SUPPORT =
true
URL =
'https://clojars.org'
COLOR =
'#db5855'

Constants inherited from Base

Base::HIDDEN, Base::LIBRARIAN_PLANNED, 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



31
32
33
34
35
36
37
# File 'app/models/repositories/clojars.rb', line 31

def self.mapping(project)
  {
    :name => project[:name],
    :description => project["description"],
    :repository_url => repo_fallback(project["scm"]["url"], '')
  }
end

.project(name) ⇒ Object



27
28
29
# File 'app/models/repositories/clojars.rb', line 27

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

.project_namesObject



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

def self.project_names
  @names ||= get("http://clojars-json.herokuapp.com/packages.json").keys
end

.projectsObject



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

def self.projects
  @projects ||= begin
    projs = {}
    get("http://clojars-json.herokuapp.com/feed.json").each do |k,v|
      v.each do |proj|
        group = proj['group-id']
        key = (group == k ? k : "#{group}/#{k}")
        projs[key] = proj
      end
    end
    projs
  end
end

.versions(project) ⇒ Object



39
40
41
42
43
44
45
# File 'app/models/repositories/clojars.rb', line 39

def self.versions(project)
  project['versions'].map do |v|
    {
      :number => v
    }
  end
end