Class: Incept::PackageCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/incept/package_collection.rb

Class Method Summary collapse

Class Method Details

.command_optionsObject



35
36
37
# File 'lib/incept/package_collection.rb', line 35

def self.command_options
  selected.map {|p| p.command_options }.join(' ')
end

.configurationObject



4
5
6
# File 'lib/incept/package_collection.rb', line 4

def self.configuration
  @configuration ||= Configuration.load
end

.each(&block) ⇒ Object



12
13
14
# File 'lib/incept/package_collection.rb', line 12

def self.each(&block)
  packages.each(&block)
end

.packagesObject



8
9
10
# File 'lib/incept/package_collection.rb', line 8

def self.packages
  @packages ||= configuration.map {|type, options| new(type, options) }
end

.renderObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/incept/package_collection.rb', line 20

def self.render
  output = ''
  selected do |package|
    output << package.render(:install)
  end

  output << %{run "bundle install"\n}

  selected do |package|
    output << package.render(:post_install)
  end

  output
end

.selected(&block) ⇒ Object



16
17
18
# File 'lib/incept/package_collection.rb', line 16

def self.selected(&block)
  packages.select {|p| p.selected? }.each(&block)
end