Class: Hatio::Bundle

Inherits:
Object
  • Object
show all
Defined in:
lib/hatio-core/bundle/hatio_bundle.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version) {|_self| ... } ⇒ Bundle

Returns a new instance of Bundle.

Yields:

  • (_self)

Yield Parameters:

  • _self (Hatio::Bundle)

    the object that the method was called on



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 7

def initialize(name, version)
  self.name = name
  self.version = version
  self.module = Kernel.const_get(name.gsub('-', '_').classify)
  self.entities = []
  self.dependencies = []
  self.bootstrap_controllers = []

  yield self if block_given?

  $HATIO_BUNDLES << self
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def author
  @author
end

#bootstrap_controllersObject

Returns the value of attribute bootstrap_controllers.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def bootstrap_controllers
  @bootstrap_controllers
end

#changesObject

Returns the value of attribute changes.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def changes
  @changes
end

#dependenciesObject

Returns the value of attribute dependencies.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def dependencies
  @dependencies
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def description
  @description
end

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def email
  @email
end

#entitiesObject

Returns the value of attribute entities.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def entities
  @entities
end

#moduleObject

Returns the value of attribute module.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def module
  @module
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def name
  @name
end

#summaryObject

Returns the value of attribute summary.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def summary
  @summary
end

#urlObject

Returns the value of attribute url.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def url
  @url
end

#versionObject

Returns the value of attribute version.



5
6
7
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 5

def version
  @version
end

Class Method Details

.ordered_bundle_listObject



20
21
22
23
24
25
26
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 20

def self.ordered_bundle_list
  ordered_list = []
  $HATIO_BUNDLES.each do |bundle|
    ordering_bundles bundle, ordered_list
  end
  ordered_list
end

.ordering_bundles(bundle, ordered_list) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/hatio-core/bundle/hatio_bundle.rb', line 28

def self.ordering_bundles bundle, ordered_list
  return if ordered_list.include? bundle
  bundle.dependencies.each do |dep|
    dep_bundle = $HATIO_BUNDLES.detect{|b| b.name == dep}
    ordering_bundles dep_bundle, ordered_list if dep_bundle
  end
  ordered_list << bundle unless ordered_list.include? bundle
end