Class: Mona::Package::Repo

Inherits:
Object
  • Object
show all
Includes:
Deps[ "package.list", ], Mixins
Defined in:
lib/mona/package/repo.rb

Constant Summary collapse

Inject =
Mona::Deps[
  "package.list",
]

Instance Method Summary collapse

Methods included from Mixins

included

Instance Method Details

#allObject



13
14
15
# File 'lib/mona/package/repo.rb', line 13

def all
  list.call
end

#filter(name: nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/mona/package/repo.rb', line 31

def filter(name: nil)
  packages = all

  unless name.nil?
    names = name.is_a?(Array) ? name : [name]
    names = names.map(&:to_sym)

    packages = packages.select { names.include?(_1.name) }
  end

  packages
end

#find(package_name) ⇒ Object



50
51
52
# File 'lib/mona/package/repo.rb', line 50

def find(package_name)
  all.detect { _1.name == package_name.to_sym }
end

#find!(package_name) ⇒ Object



60
61
62
# File 'lib/mona/package/repo.rb', line 60

def find!(package_name)
  find(package_name) || (raise StandardError.new("package '#{package_name}' was not found for Mona project '#{Mona.current_project.root_path}'"))
end