Class: Space::Models::Repo::Bundle

Inherits:
Object
  • Object
show all
Includes:
Events, Shell
Defined in:
lib/space/models/repo/bundle.rb

Instance Attribute Summary collapse

Attributes included from Events

#buffer

Attributes included from Shell

#path

Instance Method Summary collapse

Methods included from Events

#buffering, #buffering?, #notify, #observers, #subscribe

Methods included from Shell

all, #commands, included, refresh, #refresh, #result

Methods included from Shell::Watcher

suspend, suspended?

Constructor Details

#initialize(repo, repos) ⇒ Bundle

Returns a new instance of Bundle.



17
18
19
20
21
# File 'lib/space/models/repo/bundle.rb', line 17

def initialize(repo, repos)
  @repo = repo
  @repos = repos
  super(repo.path)
end

Instance Attribute Details

#repoObject (readonly)

Returns the value of attribute repo.



15
16
17
# File 'lib/space/models/repo/bundle.rb', line 15

def repo
  @repo
end

#reposObject (readonly)

Returns the value of attribute repos.



15
16
17
# File 'lib/space/models/repo/bundle.rb', line 15

def repos
  @repos
end

Instance Method Details

#clean?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/space/models/repo/bundle.rb', line 23

def clean?
  info =~ /dependencies are satisfied/
end

#depsObject



31
32
33
34
35
# File 'lib/space/models/repo/bundle.rb', line 31

def deps
  result(:list).scan(/\* ([\w-]+) \(.* ([\d|\w]+)\)/).map do |name, ref|
    Dependency.new(repos.find_by_name(name), ref) if repos.names.include?(name)
  end.compact
end

#infoObject



27
28
29
# File 'lib/space/models/repo/bundle.rb', line 27

def info
  result(:check).split("\n").first
end