Class: Space::Model::Project

Inherits:
Object
  • Object
show all
Includes:
Events
Defined in:
lib/space/model/project.rb,
lib/space/model/project/tmux.rb,
lib/space/model/project/bundler.rb,
lib/space/model/project/bundler/config.rb

Defined Under Namespace

Modules: Tmux Classes: Bundler

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from Events

events, notify, #notify, sources, subscribe, subscriptions

Constructor Details

- (Project) initialize(name)

Returns a new instance of Project



11
12
13
14
15
16
# File 'lib/space/model/project.rb', line 11

def initialize(name)
  @name    = name
  @config  = Config.load(name)
  @repos   = Repos.new(self, config.paths)
  @bundler = Bundler.new(self)
end

Instance Attribute Details

- (Object) bundler (readonly)

Returns the value of attribute bundler



9
10
11
# File 'lib/space/model/project.rb', line 9

def bundler
  @bundler
end

- (Object) config (readonly)

Returns the value of attribute config



9
10
11
# File 'lib/space/model/project.rb', line 9

def config
  @config
end

- (Object) name (readonly)

Returns the value of attribute name



9
10
11
# File 'lib/space/model/project.rb', line 9

def name
  @name
end

- (Object) repos (readonly)

Returns the value of attribute repos



9
10
11
# File 'lib/space/model/project.rb', line 9

def repos
  @repos
end

Instance Method Details

- (Object) local_repos



18
19
20
21
22
23
# File 'lib/space/model/project.rb', line 18

def local_repos
  bundler.config.keys.map do |key|
    key =~ /^local\.(.+)$/
    $1 if repos.names.include?($1)
  end.compact
end

- (Object) names



25
26
27
# File 'lib/space/model/project.rb', line 25

def names
  @names ||= Tmux.windows || repos.names
end

- (Object) number(name)



29
30
31
32
33
34
35
36
# File 'lib/space/model/project.rb', line 29

def number(name)
  if number = names.index(name)
    number + 1
  else
    names << name
    number(name)
  end
end

- (Object) refresh



38
39
40
# File 'lib/space/model/project.rb', line 38

def refresh
  [bundler, repos].each(&:refresh)
end