Class: Lono::Configset::List
- Inherits:
-
Object
- Object
- Lono::Configset::List
- Defined in:
- lib/lono/configset/list.rb
Instance Method Summary collapse
- #blueprint_configsets ⇒ Object
-
#initialize(options = {}) ⇒ List
constructor
A new instance of List.
- #project_configsets ⇒ Object
- #run ⇒ Object
- #show(configsets, all, from) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ List
Returns a new instance of List.
5 6 7 8 |
# File 'lib/lono/configset/list.rb', line 5 def initialize(={}) = @stack, @blueprint, @template, @param = Lono::Conventions.new().values end |
Instance Method Details
#blueprint_configsets ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/lono/configset/list.rb', line 22 def blueprint_configsets Lono::Configset::Preparer.new().run # register and materialize gems @final ||= [] project = Lono::Configset::Register::Project.new() project.register finder = Lono::Finder::Configset.new finder.list("Configsets available to project and can used with configs:") if [:verbose] puts "Configsets project is using for the #{@blueprint} blueprint:" if [:verbose] show(project.configsets, finder.find_all, "project") blueprint = Lono::Configset::Register::Blueprint.new() blueprint.register finder = Lono::Finder::Blueprint::Configset.new finder.list("Configsets available to #{@blueprint} blueprint:") if [:verbose] puts "Configsets built into the blueprint:" if [:verbose] show(blueprint.configsets, finder.find_all, "blueprint") table = Text::Table.new table.head = ["Name", "Path", "Type", "From"] @final.each do |spec| pretty_root = spec.root.sub("#{Lono.root}/",'').sub(ENV["HOME"], "~") table.rows << [spec.name, pretty_root, spec.source_type, spec.from] end if table.rows.empty? puts "No configsets being used." else puts "Configsets used by #{@blueprint.color(:green)} blueprint:" puts table end end |
#project_configsets ⇒ Object
18 19 20 |
# File 'lib/lono/configset/list.rb', line 18 def project_configsets Lono::Finder::Configset.list(filter_materialized: true, message: "Project configsets:") end |
#run ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/lono/configset/list.rb', line 10 def run if @blueprint blueprint_configsets else project_configsets end end |
#show(configsets, all, from) ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/lono/configset/list.rb', line 56 def show(configsets, all, from) configsets.each do |c| puts " #{c.name}" if [:verbose] spec = all.find { |jadespec| jadespec.name == c.name } next unless spec spec.from = from @final << spec end puts "" if [:verbose] end |