class RBT::Cookbooks::FeedbackLicenses
Constants
- DEFAULT_FILTER_TO_USE
#¶ ↑
DEFAULT_FILTER_TO_USE
¶ ↑#¶ ↑
- PADDING_TO_USE
#¶ ↑
PADDING_TO_USE
¶ ↑#¶ ↑
- TOKEN_LEFT_THEN_PADDING
#¶ ↑
TOKEN_LEFT_THEN_PADDING
¶ ↑#¶ ↑
Public Class Methods
[](i = ARGV)
click to toggle source
new( filter_for_licenses = DEFAULT_FILTER_TO_USE, run_already = true )
click to toggle source
#¶ ↑
initialize¶ ↑
Usage example:
FeedbackLicenses.new(filter_for_licenses = DEFAULT_FILTER_TO_USE, run_already = true)
If the filter is * then we will filter for ALL licenses.
#¶ ↑
# File lib/rbt/cookbooks/feedback_licenses.rb, line 46 def initialize( filter_for_licenses = DEFAULT_FILTER_TO_USE, run_already = true ) reset set_filter_for_licenses( filter_for_licenses ) run if run_already end
Public Instance Methods
feedback_licenses()
click to toggle source
#¶ ↑
feedback_licenses
¶ ↑
#¶ ↑
# File lib/rbt/cookbooks/feedback_licenses.rb, line 113 def feedback_licenses cliner { _ = 'known licenses' # Placeholder for now. _ = filter? unless filter? == DEFAULT_FILTER_TO_USE opne 'Feedback licenses matching search-criteria for' opne '`'+sfancy(_.to_s)+rev+'` in alphabetical order next:' } output_header cliner { programs = available_programs? programs.each { |program| @cookbook = action(:SanitizeCookbook, program) { :do_not_run_yet } @cookbook.metafind(program) license = return_license if license.is_a? Array license = license.flatten.compact.join(', ') # We want to see it on the same line here. end next if license == 'unknown' program = File.basename(program).delete_suffix('.yml') padding_left = '%-25s' % program padding_left = steelblue(padding_left).dup padding_left.prepend(TOKEN_LEFT_THEN_PADDING) padding_right = '%-10s' % license full_license_text = "#{padding_left}"\ "#{rev} | #{royalblue(padding_right)}#{rev}" if @filter == DEFAULT_FILTER_TO_USE e full_license_text else # else we assume user wants filtering done unless license.to_s.downcase.scan(/#{filter?}/).empty? e full_license_text end end } } end
filter?()
click to toggle source
output_header()
click to toggle source
#¶ ↑
output_header
¶ ↑
#¶ ↑
# File lib/rbt/cookbooks/feedback_licenses.rb, line 95 def output_header # ===================================================================== # # This is the header content. # ===================================================================== # e TOKEN_LEFT_THEN_PADDING+('%-25s' % 'Name ')+ ' | License |' end
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/cookbooks/feedback_licenses.rb, line 60 def reset super() infer_the_namespace # ===================================================================== # # === @cookbook # ===================================================================== # @cookbook = action(:SanitizeCookbook) { :do_not_run_yet } # ===================================================================== # # === @filter # ===================================================================== # @filter = ''.dup # Set the filter to use. end
return_license()
click to toggle source
run()
click to toggle source
set_filter_for_licenses(i = DEFAULT_FILTER_TO_USE)
click to toggle source
#¶ ↑
set_filter_for_licenses
¶ ↑
#¶ ↑
# File lib/rbt/cookbooks/feedback_licenses.rb, line 76 def set_filter_for_licenses(i = DEFAULT_FILTER_TO_USE) i = i.first if i.is_a? Array i = DEFAULT_FILTER_TO_USE if i.nil? i = DEFAULT_FILTER_TO_USE if i.empty? i = i.to_s.dup i = i.downcase @filter = i end
Also aliased as: filter_for