Class: Hubba::Folio

Inherits:
Object
  • Object
show all
Defined in:
lib/hubba/folio.rb

Overview

todo/check: use a different name e.g (Port)Folio, Cache, Summary, (Data)Base, Census, Catalog, Collection, Index, Register or such???

Defined Under Namespace

Classes: Repo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(h) ⇒ Folio

Returns a new instance of Folio.



33
34
35
36
37
38
39
# File 'lib/hubba/folio.rb', line 33

def initialize( h )
  @orgs     = []    # orgs and users -todo/check: use better name - logins or owners? why? why not?

  @repos    = []
  add( h )

  puts "#{@repos.size} repos @ #{@orgs.size} orgs"
end

Instance Attribute Details

#orgsObject (readonly)

Returns the value of attribute orgs.



31
32
33
# File 'lib/hubba/folio.rb', line 31

def orgs
  @orgs
end

#reposObject (readonly)

Returns the value of attribute repos.



31
32
33
# File 'lib/hubba/folio.rb', line 31

def repos
  @repos
end

Instance Method Details

#add(h) ⇒ Object

private helpes



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/hubba/folio.rb', line 43

def add( h )   ## add repos.yml set

  h.each do |org_with_counter, names|
    ## remove optional number from key e.g.

    ##   mrhydescripts (3)    =>  mrhydescripts

    ##   footballjs (4)       =>  footballjs

    ##   etc.

    org = org_with_counter.sub( /\([0-9]+\)/, '' ).strip
    repos = []
    names.each do |name|
      repo = Repo.new( org, name )
      repos << repo
    end
    @orgs << [org, repos]
    @repos += repos
  end
end