Class: RBT::Cookbooks::DisplayCookbookDataset::Feedback

Inherits:
RBT::Cookbooks::DisplayCookbookDataset show all
Extended by:
Colours::E
Defined in:
lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb

Overview

RBT::Cookbooks::DisplayCookbookDataset::Feedback

Constant Summary collapse

SHOW_EXTRA_INFORMATION =
#

SHOW_EXTRA_INFORMATION

#
true

Constants inherited from RBT::Cookbooks::DisplayCookbookDataset

LEFT_PADDING, REPLACE_PLUS_WITH_LONG_NAME

Constants inherited from LeanPrototype

LeanPrototype::ALL_COLOUR_METHODS, LeanPrototype::ARRAY_KDE_KONSOLE_COLOURS_IN_USE, LeanPrototype::DAY_NAMES, LeanPrototype::NAMESPACE, LeanPrototype::SILENT_REDIRECTION

Class Method Summary collapse

Methods inherited from RBT::Cookbooks::DisplayCookbookDataset

#dataset?, #determine_dataset, #display_this_option, e, feedback_extra_description, feedback_local_base, feedback_program_description, feedback_url, #initialize, #main_program_entries?, #program?, #reset, #reset_yaml_dataset, #run, #set_program, #set_show_md5sum, #show_md5sum?, #use_only_symbols_for_the_main_hash?

Methods inherited from Base

#cat, #cd_back_to_the_current_working_directory, #consider_reporting_how_many_programs_are_registered, #cookbook_files?, #copy_recursively, #delete_code_of_conduct?, #determine_appdir_prefix_from_this_input, #directory_validation?, #do_not_show_names, #fast_return_file_size_of_this_program, #file_last_symlinked_program?, #file_programs_version_url, #gem_version, #is_a_64bit_system?, #is_ccache_available?, #is_porg_available?, #is_this_binary_registered?, #is_this_program_included?, #make_command?, #make_install_command?, #new_cookbook_instance_for, #program_exists?, #publish_list_of_all_programs_version, #rcp, registered_binaries?, #remove_symlink, #rename_kde_konsole_tab, #repackage, #report_n_programs, #report_working_directory, #return_compile_time_statistics, #return_n_random_characters, #return_version_of_this_program, #run_make_then_make_install, #sanitize_url1_entry, #set_source_directory, #show_overview_over_available_utility_scripts, #symlink_all_files_from_this_directory_to_that_directory, #system_tags?, #upload_list_of_all_programs_version, #use_yaml_database_for_tags?, #warn_and_exit, #wget

Methods inherited from LeanPrototype

#a_or_an?, #abbreviations?, #absolute_path, #action, #add_to_the_commandline_arguments, #all_binaries?, #all_files_from, #all_libraries?, #allowed_cookbook_entries?, #appdir_location_of?, #append_onto_the_internal_hash, #append_what_into, #archive_type_of?, #available_programs?, #be_quiet?, #be_verbose?, #begins_with_a_comment?, #capitalize_first_alphabetical_character, #cd_to_the_log_directory, #cd_to_the_temp_directory, #change_directory, #change_permission, #cheering_person?, #chmod, #chop_off_archive, #clear_commandline_arguments, #cliner, #coloured_and_padded_e, #coloured_and_padded_esystem, #coloured_esystem, #colourize_directory_for_system_results, #colourize_this_error, #colourize_this_file_path, #colourize_this_warning, #commandline_arguments?, #commandline_arguments_without_hyphens?, #comment, #convert_dd_mm_yyyy_to_its_long_variant, #convert_env_variable, #copy_directory, #copy_files, #cpr, #create_directory, #current_hour?, #dd_mmm_yyy, #debug, #debug?, #directory_expanded_cookbooks?, #disable_colours, #display_md5sum?, #do_not_debug, #does_the_cookbook_include_this_program?, #does_this_expanded_cookbook_file_exist_for_this_program?, #does_this_file_exist?, #does_this_file_exist_and_is_it_a_file?, #e, #eblue, #ecomment, #ecrimson, #edir, #editor?, #efancy, #eimp, #enable_colours, #enable_debug, #ensure_main_encoding_for, #eparse, #esystem, #esystem_gold, #etomato, #ewarn, #exit_program, #expanded_cookbooks_directory_exists?, #extract_this_archive, #extract_to?, #file_compiled_programs?, #file_dirname_retaining_trailing_slash, #file_predefined_installation_instructions?, #file_specification_of_registered_cookbook_entries, #find_cookbook_alias_for, #find_this_yaml_file, #first_argument?, #first_non_hyphen_argument?, #get_all_directories_from, #get_all_files_from, #get_all_programs, #get_date, #get_extended_date, #get_files_and_directories_from, #go_to_base_dir, #home_dir?, #host_system?, #infer_the_namespace, #initialize, #internal_hash?, #internal_hash_set_commandline_arguments, #is_an_archive?, #is_directory?, #is_file?, #is_github_url?, #is_make_available?, #is_meson_installed?, #is_on_gobolinux?, #is_on_windows?, #is_roebe?, #is_superuser?, #is_symlink?, #is_this_a_header?, #is_this_a_library?, #is_this_program_included?, #iso_encoding?, #load_dataset_from_this_expanded_cookbook, #load_yaml, #load_yaml_file_from_the_cookbook_directory_for_this_program, #log_directory?, #main_encoding?, #meson_build_file_exists?, #months?, #move_file, #n_programs_are_available?, #n_programs_available?, #namespace?, #no_directory_exists_at, #no_directory_was_found_at, #no_opn, #no_such_file_exists, #open_in_browser, #open_in_editor, #opncomment, #opne, #opnef, #opnerev, #opnerror, #opnesystem, #opnewarn, #opnfancy, #opnn, #otomato, #packages_directory?, #path_to_this_expanded_cookbooks_dataset, #pkgconfig_directory?, #populate_the_internal_hash_with_default_values, #predefined_installation_instructions?, #prepend_this_commandline_argument, #program_version_of?, #project_base_directory?, #project_yaml_directory?, #query_path?, #rarrow?, #read_file, #read_file_in_default_encoding, #read_file_with_default_encoding, #readlines, #readlines_with_proper_encoding, #register_sigint, #registered_cookbook_entries?, #remove, #remove_archive_from_the_end, #remove_comments_from_each_line, #remove_directory, #remove_double_slashes, #remove_file, #remove_newlines, #remove_parens, #remove_symlink, #remove_the_first_commandline_argument, #remove_this_commandline_argument, #remove_this_entry_from_the_commandline_arguments, #remove_trailing_ANSII_escape_code, #remove_unnecessary_data_from_url, #rename, #report_pwd, #require_the_rbt_aliases, #reset, #reset_the_internal_hash, #return_all_archives_from_this_directory, #return_appdir_prefix, #return_commandline_arguments_with_leading_hyphens, #return_current_hour_minutes_second, #return_date, #return_day_of_the_month_based_on_utc, #return_full_time, #return_hours_minutes_seconds_based_on_utc, #return_location_to_this_programs_yaml_file, #return_month_based_on_this_number, #return_month_based_on_utc, #return_opnn, #return_program_name, #return_program_name_for_gobolinux_systems, #return_program_name_via_program_information, #return_pwd, #return_unicode_warning_symbol_or_empty_string, #return_utc, #return_utc_time_in_a_format_similar_to_slackware, #return_weekday_based_on_utc, #return_year_based_on_utc, #rev, #rpn, #run, #run_simulation=, #run_simulation?, #sdir, #sdir_return_pwd, #set_be_silent, #set_be_verbose, #set_first_commandline_argument, #set_namespace, #set_use_colours, #set_use_opn, #set_xorg_buffer, #sfancy, #sfile, #silent_redirection?, #silently_create_this_directory_if_it_does_not_yet_exist, #simp, #source_base_directory?, #ssym, #stderr, #store_into_this_directory?, #string_right_arrow?, #swarn, #symlink, #sysbin_directory?, #sysetc_directory?, #sysinclude_directory?, #syslib_directory?, #sysshare_directory?, #system_directory?, #temp_directory?, #to_bool, #to_camelcase, #to_iso_encoding, #to_unicode, #today?, #touch, #try_to_require_beautiful_url, #try_to_require_the_environment_information_gem, #try_to_require_the_extracter_gem, #try_to_require_the_open_gem, #try_to_require_the_xorg_buffer, #try_to_require_wget, #try_to_return_a_special_compile_component, #unicode_cliner, #unicode_middle_cliner, #use_colours=, #use_colours?, #use_opn=, #use_opn?, #utf_encoding?, #verbose_truth, #word_wrap, #write_what_into, #write_what_into_via_unicode, #yes_or_no

Constructor Details

This class inherits a constructor from RBT::Cookbooks::DisplayCookbookDataset

Class Method Details

.dataset?Boolean

#

DisplayCookbookDataset::Feedback.dataset?

This method returns the dataset that we did store.

#

Returns:

  • (Boolean)


52
53
54
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 52

def self.dataset?
  @dataset
end

.efancy(i) ⇒ Object

#

Feedback.efancy

#


68
69
70
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 68

def self.efancy(i)
  e Colours.sfancy(i)
end

.feedback_all(program = ARGV, show_chained_programs = false) ⇒ Object

#

RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_all

Shows all available information about a program.

#


178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 178

def self.feedback_all(
    program = ARGV, show_chained_programs = false
  )
  dataset = action(:SanitizeCookbook, program)
  Feedback.register(program) unless Feedback.dataset?
  description  = dataset.description?
  make_options = 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) ⇒ Object

#

RBT::Cookbooks::DisplayCookbookDataset::Feedback.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.

#


319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 319

def self.feedback_all_binaries(i = ARGV)
  i = i.first.to_s if i.is_a? Array
  Feedback.register(i) unless Feedback.dataset?
  binaries = action(:SanitizeCookbook, i) { :bypass_menu }.binaries?
  if binaries.empty?
    opne '`'+Colours.sfancy(i)+'` will not install any binaries.'
  else
    opne '`'+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) ⇒ Object

#

RBT::Cookbooks::DisplayCookbookDataset.feedback_all_libraries

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

#


347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 347

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?
    opne '`'+::Colours.sfancy(i)+'` will not install any libraries.'
  else
    opne '`'+::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) ⇒ Object

#

DisplayCookbookDataset::Feedback.feedback_base

#


206
207
208
209
210
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 206

def self.feedback_base(i)
  Feedback.register(i) unless Feedback.dataset?
  opne 'Base Program for '+Colours.sfancy(Feedback.search_term?)+' is here at: '
  opne "  #{Colours.sdir(Feedback.dataset?.base_dir?)}"
end

.feedback_configure_options(i = ARGV) ⇒ Object

#

RBT::Cookbooks::DisplayCookbookDataset.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.

#


290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 290

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) ⇒ Object

#

RBT::Cookbooks::DisplayCookbookDataset::Feedback.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.

#


82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 82

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 {
    opne 'The required Programs (its '+sfancy('dependencies')+')'+
         ' for `'+simp(Feedback.search_term?)+'` are: '
    if _.nil? || _.empty?
      opne '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!(/,/,', ')
        opne '  '+sfancy(splitted.chomp) # Nicer with padding.
      }
    end
  }
  unless recommended_deps.to_s.empty?
    opne 'Recommended Programs ('+sfancy('optional Dependencies')+') '\
         'are: '
    opne '  '+sfancy(recommended_deps.to_s)
    cliner
  end
end

.feedback_description(i) ⇒ Object

#

DisplayCookbookDataset::Feedback.feedback_description

Shows description of a program.

To test this, do:

ry php feedback_description
#


222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 222

def self.feedback_description(i)
  Feedback.register(i) unless Feedback.dataset?
  description = Feedback.dataset?.description?
  unless description.empty?
    _ = description
    _ = _.chomp
    #_ = _.gsub(/#{N}/,' ')
    opne 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
      opne '     '+_
    else
      opne 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
    opne ' =>   No program description is available for `'+
          Colours.sfancy(Feedback.search_term?)+'`.'
  end
end

.feedback_extra_information(i = ARGV) ⇒ Object

#

RBT::DisplayCookbookDataset::Feedback.feedback_extra_information

Use this to feedback extra description.

#


160
161
162
163
164
165
166
167
168
169
# File 'lib/rbt/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?
    opne 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) ⇒ Object

#

RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_local_location

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

#


148
149
150
151
152
153
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 148

def self.feedback_local_location(i)
  Feedback.register(i) unless Feedback.dataset?
  opne '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) ⇒ Object

#

RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_make_options

Feedbacks the make options.

Invocation example:

ry xmlparser feedback_make_options
#


130
131
132
133
134
135
136
137
138
139
140
# File 'lib/rbt/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?
    opne "No make options were found for #{simp(Feedback.search_term?)}."
  else
    opne "The Make Options for #{simp(Feedback.search_term?)} are:"
    _ = '['+_.join(', ')+']' if _.is_a? Array
    opnfancy '  '+_.to_s
  end
end

.feedback_program_version(i = ARGV?) ) ⇒ Object

#

DisplayCookbookDataset::Feedback.feedback_program_version

Feedbacks information about the program version.

#


259
260
261
262
263
264
265
266
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 259

def self.feedback_program_version(i = ARGV?)
  Feedback.register(i) unless Feedback.dataset?
  version = Feedback.dataset?.version?
  unless version.empty?
    opne 'The Program version for `'+sfancy(Feedback.search_term?)+'` is: '
    opnefancy "  #{version}"
  end
end

.feedback_use_autogen_information(i = ARGV) ⇒ Object

#

RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_use_autogen_information

Feedbacks if we use autogen.

#


113
114
115
116
117
118
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 113

def self.feedback_use_autogen_information(i = ARGV)
  Feedback.register(i) unless Feedback.dataset?
  yes_or_no = ::RBT.verbose_truth(Feedback.dataset?.use_autogen?)
  opne '=> Will we use autogen.sh? '
  opne '=> '+simp(yes_or_no)
end

.opnn(hash = {}) ⇒ Object

#

DisplayCookbookDataset::Feedback.opnn

#


271
272
273
274
275
276
277
278
279
280
281
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 271

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) ⇒ Object

#

DisplayCookbookDataset::Feedback.register

Register the dataset here.

#


43
44
45
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 43

def self.register(i)
  @dataset = Feedback.new(i) # class Feedback here will handle this.
end

.search_term?Boolean

#

DisplayCookbookDataset::Feedback.search_term?

Tell us what we are searching for.

#

Returns:

  • (Boolean)


61
62
63
# File 'lib/rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb', line 61

def self.search_term?
  Feedback.dataset?.short_name?
end