class RBT::Linux::Slackware::GenerateSlackDescFile
Constants
- CHARACTERS_PER_LINE_MAXIMUM
#¶ ↑
CHARACTERS_PER_LINE_MAXIMUM
¶ ↑#¶ ↑
- HANDY_RULER
#¶ ↑
HANDY_RULER
¶ ↑#¶ ↑
- USE_THIS_FILE_SUFFIX
#¶ ↑
USE_THIS_FILE_SUFFIX
¶ ↑A proper slack-desc file ends with a .slack-desc suffix.
#¶ ↑
Public Class Methods
[](i = ARGV, &block)
click to toggle source
new( this_program = ARGV, run_already = true ) { || ... }
click to toggle source
#¶ ↑
initialize¶ ↑
The first argument should be the name of the file in question.
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 59 def initialize( this_program = ARGV, run_already = true, &block ) reset # ======================================================================= # # === Handle blocks next # ======================================================================= # if block_given? yielded = yield case yielded # ===================================================================== # # === :use_short_name # ===================================================================== # when :use_short_name @use_long_name_or_short_name = :short_name # ===================================================================== # # === :also_show_the_content_of_the_generated_file # ===================================================================== # when :also_show_the_content_of_the_generated_file @show_the_content_of_the_generated_file = true # ===================================================================== # # === :also_show_the_content_of_the_generated_file_if_on_roebe # ===================================================================== # when :also_show_the_content_of_the_generated_file_if_on_roebe if is_on_roebe? @show_the_content_of_the_generated_file = true end end end set_this_program(this_program) run if run_already end
Public Instance Methods
append_the_homepage_if_it_exists()
click to toggle source
chunk( string, size = CHARACTERS_PER_LINE_MAXIMUM )
click to toggle source
consider_showing_the_content_of_the_generated_file()
click to toggle source
#¶ ↑
consider_showing_the_content_of_the_generated_file
¶ ↑
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 298 def consider_showing_the_content_of_the_generated_file if @show_the_content_of_the_generated_file _ = path? if File.exist?(_) e e "Showing the content of the file #{sfile(_)}:" e e File.read(_) e end end end
create_slack_desk_file( into = path? )
click to toggle source
#¶ ↑
create_slack_desk_file
¶ ↑
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 281 def create_slack_desk_file( into = path? ) opnn { :no_trailing } e e e "#{rev}Now creating a #{springgreen('slack-desc file')}#{rev} for "+ "#{File.basename(into).delete_suffix('.slack-desc')}" e "#{rev}(#{sfile(into)}#{rev})." e what = @_.join(N)+N # Grab the content and adjust it a little. write_what_into(what, into) end
description?()
click to toggle source
file?()
click to toggle source
generate_main_string()
click to toggle source
#¶ ↑
generate_main_string
¶ ↑
This will generate the main String, into the variable @_.
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 184 def generate_main_string result = ''.dup _ = name_of_program? _ = _.dup if short_description? _ << " (#{short_description?})" unless short_description?.empty? else e swarn('No short_description entry could be found for:') e steelblue(" #{_}") if description? and !description?.empty? opne 'Substituting via the :description entry for this instead.' _ << " (#{description?})" end end _ << N result << _ result << N result << chunk(description?) if result.is_a? String result = result.split(N) end @_ << result @_.flatten! # ======================================================================= # # Next, fill in the missing slots: # ======================================================================= # (11 - @_.size).times { @_ << '' } # ======================================================================= # # And then, prepend the program name to it. # ======================================================================= # @_.map! {|line| line = line.dup if line.frozen? if line.empty? line.prepend("#{program_name?}:") else line.prepend("#{program_name?}: ") end line } # ======================================================================= # # Next, we could add a handy ruler - but I personally find this # useless, so the following line is commented away. # ======================================================================= # # @_[0,0] = return_handy_ruler+N append_the_homepage_if_it_exists end
homepage?()
click to toggle source
length_of_program_name?()
click to toggle source
obtain_main_dataset(i = program?)
click to toggle source
path?()
click to toggle source
#¶ ↑
path?¶ ↑
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 260 def path? path = return_pwd.dup case @use_long_name_or_short_name # case tag # ======================================================================= # # === :long_name # ======================================================================= # when :long_name, :default # This is the default. path << return_name_of_slack_desc_file # ======================================================================= # # === :short_name # ======================================================================= # when :short_name path << return_short_name_of_slack_desc_file end path end
reset()
click to toggle source
#¶ ↑
reset¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 97 def reset super() infer_the_namespace # ======================================================================= # # === @use_long_name_or_short_name # ======================================================================= # @use_long_name_or_short_name = :long_name # ======================================================================= # # === @_ # # Should be an Array. # ======================================================================= # @_ = [] # ======================================================================= # # === @show_the_content_of_the_generated_file # # If the following instance variable is set to true then the class # will also show the content of the generated file (if the file # exists, too). # ======================================================================= # @show_the_content_of_the_generated_file = false end
return_handy_ruler()
click to toggle source
return_name_of_slack_desc_file()
click to toggle source
return_short_name()
click to toggle source
#¶ ↑
return_short_name
¶ ↑
#¶ ↑
# File lib/rbt/linux/slackware/generate_slack_desc_file.rb, line 253 def return_short_name USE_THIS_FILE_SUFFIX.delete('.') end
Also aliased as: return_short_name_of_slack_desc_file
run()
click to toggle source
set_this_program(i)
click to toggle source
short_description?()
click to toggle source