Class: Repositories::Meteor

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

Constant Summary collapse

HAS_VERSIONS =
true
HAS_DEPENDENCIES =
false
LIBRARIAN_SUPPORT =
true
URL =
'https://atmospherejs.com'
COLOR =
'#f1e05a'

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/meteor.rb', line 31

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

.project(name) ⇒ Object


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

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

.project_namesObject


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

def self.project_names
  projects.keys
end

.projectsObject


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

def self.projects
  @projects ||= begin
    projects = {}
    packages = get_json("https://atmospherejs.com/a/packages")

    packages.each do |hash|
      next if hash['latestVersion'].nil?
      projects[hash['name'].downcase] = hash['latestVersion'].merge({'name' => hash['name']})
    end

    projects
  end
end

.versions(project) ⇒ Object


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

def self.versions(project)
  [{
    :number => project['version'],
    :published_at => Time.at(project['published']['$date']/1000.0)
  }]
end