class RBT::Linux::Debian::CreateControlFile

Public Class Methods

[](i = '') click to toggle source
#

RBT::Linux::Debian::CreateControlFile[]

#
# File lib/rbt/linux/debian/create_control_file.rb, line 124
def self.[](i = '')
  new(i)
end
new( full_name_of_the_program = return_pwd, run_already = true ) click to toggle source
#

initialize

The first argument is the name of the program.

#
# File lib/rbt/linux/debian/create_control_file.rb, line 35
def initialize(
    full_name_of_the_program = return_pwd, # By default we will obtain information from the current working directory.
    run_already         = true
  )
  reset
  set_full_name_of_the_program(
    full_name_of_the_program
  )
  run if run_already
end

Public Instance Methods

append(i) click to toggle source
#

append

#
# File lib/rbt/linux/debian/create_control_file.rb, line 109
def append(i)
  @_ << i
end
append_the_package_content_onto_the_main_string() click to toggle source
#

append_the_package_content_onto_the_main_string

#
# File lib/rbt/linux/debian/create_control_file.rb, line 87
  def append_the_package_content_onto_the_main_string
    _ = ProgramInformation[@full_name_of_the_program]
    name_of_the_program    = _.name_of_the_program?
    version_of_the_program = _.version_of_the_program?
    heredoc = <<-EOF
Package: #{name_of_the_program}
Version: #{version_of_the_program}
Section: base
Priority: optional
Architecture: i386
Depends: libsomethingorrather (>= 1.2.13), anotherDependency (>= 1.2.6)
Maintainer: Your Name <#{RBT.email?}>
Description: Hello World
 Foo
 Bar
EOF
    append(heredoc)
  end
create_the_control_file() click to toggle source
#

create_the_control_file

#
# File lib/rbt/linux/debian/create_control_file.rb, line 79
def create_the_control_file
  opne 'Now storing in the file `'+sfile(@filename)+'`.'
  write_what_into(@_, @filename)
end
reset() click to toggle source
#

reset

#
Calls superclass method RBT::Base#reset
# File lib/rbt/linux/debian/create_control_file.rb, line 49
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @_
  # ======================================================================= #
  @_ = ''.dup # <- This is the string that will be stored.
  # ======================================================================= #
  # === @filename
  # ======================================================================= #
  @filename = 'control'
end
run() click to toggle source
#

run

#
# File lib/rbt/linux/debian/create_control_file.rb, line 116
def run
  append_the_package_content_onto_the_main_string
  create_the_control_file
end
set_full_name_of_the_program(i) click to toggle source
#

set_full_name_of_the_program

#
# File lib/rbt/linux/debian/create_control_file.rb, line 65
def set_full_name_of_the_program(i)
  if i.is_a? Array
    i = i.first
  end
  case i
  when nil, :default
    i = return_pwd
  end
  @full_name_of_the_program = File.basename(i)
end