class Cookbooks::DisplayCookbookDataset::Feedback

Constants

NAMESPACE
#

NAMESPACE

#
SHOW_EXTRA_INFORMATION
#

SHOW_EXTRA_INFORMATION

#

Public Class Methods

dataset?() click to toggle source
#

::dataset?

This method returns the dataset that we did store.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 54
def self.dataset?
  @dataset
end
efancy(i) click to toggle source
#

::efancy

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 70
def self.efancy(i)
  e Colours.sfancy(i)
end
feedback_all(program = ARGV, show_chained_programs = false) click to toggle source
#

::feedback_all

Shows all available information about a program.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 178
def self.feedback_all(program = ARGV, show_chained_programs = false)
  Feedback.register(program) unless Feedback.dataset?
  description  = Feedback.dataset?.description?
  make_options = Feedback.dataset?.make_options?
  unless description.empty?
    Feedback.feedback_description(program)
    e
  end
  Feedback.feedback_configure_options(program)
  e
  unless make_options.empty?
    Feedback.feedback_make_options(program)
    e
  end
  Feedback.feedback_dependencies(program)
  Feedback.feedback_chained_programs(program) unless show_chained_programs == false
  Feedback.feedback_program_version(program)
  Feedback.feedback_url(program)
  Feedback.feedback_base(program)
  Feedback.feedback_local_location(program)
end
feedback_all_binaries(i = ARGV) click to toggle source
#

::feedback_all_binaries

A separate class will feedback all binaries of a given program since as of August 2015.

For now we will retain the code below, but it should be replaced eventually.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 341
def self.feedback_all_binaries(i = ARGV)
  i = i.first.to_s if i.is_a? Array
  Feedback.register(i) unless Feedback.dataset?
  binaries = ::Cookbooks::Cookbook.new(i) { :bypass_menu }.binaries?
  if binaries.empty?
    opnn; e '`'+Colours.sfancy(i)+'` will not install any binaries.'
  else
    opnn; e '`'+Colours.sfancy(i)+'` will install these binaries:'
    binaries = binaries.join(',')
    data = binaries.gsub(/,/,', ') # .wrap_at(75)
    if data.include? ','
      e
      data.strip.chomp.split(',').each_with_index { |binary, index|
        counter = '%2d' % (index+1)
        e '  ('+Colours.simp(counter.to_s)+') '+binary.chomp.strip
      }; e
    else
      e '  - '+data.chomp
    end
  end
end
feedback_all_libraries(i = ARGV) click to toggle source
#

::feedback_all_libraries

This method will feedback all libraries that are to be installed by a specific program.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 269
def self.feedback_all_libraries(i = ARGV)
  i = i.first.to_s if i.is_a? Array
  Feedback.register(i) unless Feedback.dataset?
  libraries = Feedback.dataset?.libraries?
  if libraries.empty?
    opnn; e '`'+::Colours.sfancy(i)+'` will not install any libraries.'
  else
    opnn; e '`'+::Colours.sfancy(i)+'` will install these libraries:'
    libraries = libraries.join(',')
    data = libraries.gsub(/,/,', ') # .wrap_at(75)
    if data.include? ','
      e; data.strip.chomp.split(',').each_with_index { |binary, index|
        counter = '%2d' % (index+1)
        e '  ('+::Colours.simp(counter.to_s)+') '+binary.chomp.strip
      }; e
    else
      e '  - '+data.chomp
    end
  end
end
feedback_base(i) click to toggle source
#

::feedback_base

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 203
def self.feedback_base(i)
  Feedback.register(i) unless Feedback.dataset?
  opnn; e 'Base Program for '+Colours.sfancy(Feedback.search_term?)+' is here at: '
  opnn; e '  '+Colours.sdir(Feedback.dataset?.base_dir?)
end
feedback_configure_options(i = ARGV) click to toggle source
#

::feedback_configure_options

Feedbacks the configure options that we will use for a given program.

This way we can check how ./configure will effectively be invoked.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 312
def self.feedback_configure_options(i = ARGV)
  Feedback.register(i) unless Feedback.dataset?
  configure_options = Feedback.dataset?.configure_options?
  unless configure_options.empty?
    opnn(:no_trailing_colon)
    e
    e
    e "The Configure Options for #{Colours.simp(Feedback.search_term?)} are:"
    e # Add a spacer here.
    configure_options.chomp.split(N).each { |line|
      efancy '  '+line
    }
    e # And another spacer there.
  else
    opnn(:no_trailing_colon); e
    e "We could not find any Configure Options "\
      "for `#{Colours.simp(Feedback.search_term?)}`."
  end
end
feedback_dependencies(i = ARGV) click to toggle source
#

::feedback_dependencies

This method will feedback information about the dependencies of a given program.

As of January 2011, we will not feedback any dependencies at all when no dependencies are known - which is quite logical if you think about it.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 84
def self.feedback_dependencies(i = ARGV)
  Feedback.register(i) unless Feedback.dataset?
  _ = Feedback.dataset?.required_deps_on?
  recommended_deps = Feedback.dataset?.recommended_deps_on?
  cliner {
    opnn; e 'The required Programs (its '+sfancy('dependencies')+')'+
            ' for `'+simp(Feedback.search_term?)+'` are: '
    if _.nil? || _.empty?
      opnn; e 'None are known.'
    else # Must check for the length.
      my_limit = 65
      y = _.join(',').gsub(/(.{1,#{my_limit}})( +|$)\n?|(.{#{my_limit}})/, "\\1\\3\n")
      y.split(N).each { |splitted|
        splitted.gsub!(/,/,', ')
        opnn; e '  '+sfancy(splitted.chomp) # Nicer with padding.
      }
    end
  }
  unless recommended_deps.to_s.empty?
    opnn; e 'Recommended Programs ('+sfancy('optional Dependencies')+') '\
            'are: '
    opnn; e '  '+sfancy(recommended_deps.to_s)
    cliner
  end
end
feedback_description(i) click to toggle source
#

::feedback_description

Shows description of a program.

To test this, do:

ry php feedback_description
#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 217
def self.feedback_description(i)
  Feedback.register(i) unless Feedback.dataset?
  description = Feedback.dataset?.description?
  unless description.empty?
    _ = description
    _ = _.chomp
    #_ = _.gsub(/#{N}/,' ')
    opnn; e Colours.simp(dataset?.name?.downcase)+' has this description:'
    # This check is to properly format multilined-newlines
    # from yaml - we dont want a 2x" description like:
    # ""This is cool!""
    if description.start_with? '"'
      check_for_proper_layout_of_description
      opnn; e '     '+_
    else
      opnn; e Colours.sfancy("     \"#{_}\"")
    end
    # ===================================================================== #
    # Do we want to view extra information? If so then we
    # will also output a newline.
    # ===================================================================== #
    if SHOW_EXTRA_INFORMATION
      e 
      Feedback.feedback_extra_information(i)
      e
    end
  else
    opnn; e ' =>   No program description is available for `'+
             Colours.sfancy(Feedback.search_term?)+'`.'
  end
end
feedback_extra_information(i = ARGV) click to toggle source
#

::feedback_extra_information

Use this to feedback extra description.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 160
def self.feedback_extra_information(i = ARGV)
  Feedback.register(i) unless Feedback.dataset?
  extra_information = Feedback.dataset?.extra_information?
  unless extra_information.empty?
    opnn; e Colours.simp(Feedback.search_term?)+' has this extra information:'
    e
    e Colours.sfancy(extra_information.chomp)
    e
  end if extra_information
end
feedback_local_location(i) click to toggle source
#

::feedback_local_location

This will feedback the local location, i.e. the place where the program is kept locally.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 148
def self.feedback_local_location(i)
  Feedback.register(i) unless Feedback.dataset?
  opnn; e 'The local file for '+sfancy(Feedback.search_term?)+
         ' can be found at:'
  e; e '  '+sfile(Feedback.dataset?.program_path?); e
end
feedback_make_options(i = ARGV) click to toggle source
#

::feedback_make_options

Feedbacks the make options.

Invocation example:

ry xmlparser feedback_make_options
#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 130
def self.feedback_make_options(i = ARGV)
  Feedback.register(i) unless Feedback.dataset?
  _ = Feedback.dataset?.make_options?
  if _.empty?
    opnn; e "No make options were found for #{simp(Feedback.search_term?)}."
  else
    opnn; e "The Make Options for #{simp(Feedback.search_term?)} are:"
    _ = '['+_.join(', ')+']' if _.is_a? Array
    opnn; efancy '  '+_.to_s
  end
end
feedback_program_version(i = ARGV?) click to toggle source
#

::feedback_program_version

Feedbacks information about the program version.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 254
def self.feedback_program_version(i = ARGV?)
  Feedback.register(i) unless Feedback.dataset?
  version = Feedback.dataset?.version?
  unless version.empty?
    opnn; e 'The Program version for `'+sfancy(Feedback.search_term?)+'` is: '
    opnn; efancy '  '+version
  end
end
feedback_use_autogen_information(i = ARGV) click to toggle source
#

::feedback_use_autogen_information

Feedbacks if we use autogen.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 115
def self.feedback_use_autogen_information(i = ARGV)
  Feedback.register(i) unless Feedback.dataset?
  yes_or_no = ::Cookbooks.verbose_truth(Feedback.dataset?.use_autogen?)
  opnn; e '=> Will we use autogen.sh? '
  opnn; e '=> '+simp(yes_or_no)
end
opnn(hash = {}) click to toggle source
#

::opnn

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 293
def self.opnn(hash = {})
  if hash.is_a? Symbol
    case hash
    when :no_trailing_colon
      hash = {}
      hash[trailing_colon: false]
    end
  end
  hash.merge!({namespace: NAMESPACE})
  Opn.opn(hash)
end
register(i) click to toggle source
#

::register

Register the dataset here.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 45
def self.register(i)
  @dataset = Feedback.new(i) # class Feedback here will handle this.
end
search_term?() click to toggle source
#

::search_term?

Tell us what we are searching for.

#
# File lib/cookbooks/display_cookbook_dataset/feedback/feedback.rb, line 63
def self.search_term?
  Feedback.dataset?.short_name?
end