lib/doit.rb in doit-0.3.2 vs lib/doit.rb in doit-0.3.6

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'my' require 'run' require 'import' Doit = Object.new @@ -23,14 +25,16 @@ def list hsh = Import.list hsh.sort.each { |abb, long| puts "#{abb}\t- #{long}" next unless options[:verbose] + lines = `grep -i 'usage\\|summary' #{long} | grep '^#'`.split("\n") lines.each { |line| next unless line next if line.empty? + puts "\t #{line}" } } end @@ -38,15 +42,13 @@ Import.init(name) unless Import.script puts "doit: script '#{name}' not found" return end - What.init(Import.script, Import.config) + What.init(Import.config) - What.where.each { |w| - puts "doit #{name} -r #{w}" - } if options[:each] + What.where.each { |w| puts "doit #{name} -r #{w}" } if options[:each] where_loop unless options[:each] end private @@ -54,21 +56,21 @@ What.where.each { |w| matrix_loop(w) } end - def matrix_loop(w) + def matrix_loop(where) What.matrix.each { |mm| prefix = mm.empty? ? '' : "#{What.to_env(mm)}\n" What.env.each { |en| - prefix2 = en.empty? ? '' : "#{en}\n" + prefix2 = en.empty? ? '' : "#{en}\n" - cmds = Import.script - cmds = @argv + prefix + prefix2 + cmds - Run.init cmds, w - Run.info if options[:verbose] - Run.run + cmds = Import.script + cmds = @argv + prefix + prefix2 + cmds + Run.init cmds, where + Run.info if options[:verbose] + Run.run } } end end