class RBT::Linux::Gobolinux::CreateDependenciesFile

Constants

MAY_WE_CREATE_RESOURCES
#

CreateDependenciesFile::MAY_WE_CREATE_RESOURCES

This should only be set to true on Gobolinux.

The method allow_creation_of_resources() allows us to overrule this setting.

#

Public Class Methods

new( create_where = return_pwd, dependencies = nil, run_already = true ) click to toggle source
#

initialize

The first argument should hold where we will create the Dependencies file.

#
# File lib/rbt/linux/gobolinux/create_dependencies_file.rb, line 54
def initialize(
    create_where = return_pwd,
    dependencies = nil,
    run_already  = true
  )
  reset
  set_create_where(
    create_where
  ) # Where we create it.
  set_dependencies(
    dependencies
  )
  case run_already
  when :dont_run_yet
    run_already = false
  end
  run if run_already
end

Public Instance Methods

add_program_version_to_the_dependencies() click to toggle source
#

add_program_version_to_the_dependencies

This method will append the proper program version.

#
# File lib/rbt/linux/gobolinux/create_dependencies_file.rb, line 111
def add_program_version_to_the_dependencies
  dataset?.map! {|program|
    dataset = action(:SanitizeCookbook, program) { :fast }
    program_version = dataset.program_version?
    program << " >= #{program_version}" unless program_version.empty?
    program
  }
end
allow_creation_of_resources() click to toggle source
#

allow_creation_of_resources

#
# File lib/rbt/linux/gobolinux/create_dependencies_file.rb, line 91
def allow_creation_of_resources
  @may_we_create_resources = true
end
dataset?()
Alias for: dependencies?
dependencies?() click to toggle source
#

dependencies?

#
# File lib/rbt/linux/gobolinux/create_dependencies_file.rb, line 137
def dependencies?
  @dependencies
end
Also aliased as: dataset?
reset() click to toggle source
#

reset

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/linux/gobolinux/create_dependencies_file.rb, line 76
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @may_we_create_resources
  # ======================================================================= #
  @may_we_create_resources = MAY_WE_CREATE_RESOURCES
  if is_on_roebe?
    @may_we_create_resources = true
  end
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/linux/gobolinux/create_dependencies_file.rb, line 144
def run
  if @may_we_create_resources
    file_location = rds(
      "#{@create_where}/Resources/Dependencies"
    )
    opne 'Will create a file at `'+sfile(file_location)+'`.'
    remove_file(file_location) if File.exist? file_location # Remove it if it already exists
    target_dir = rds(@create_where+'/Resources')
    unless File.directory? target_dir
      opnn; mkdir(target_dir, :be_verbose)
    end
    if @dependencies
      unless @dependencies.empty?
        opne "Appending now into `#{sfile(file_location)}`."
        add_program_version_to_the_dependencies
        @dependencies.each { |dep|
          append_what_into(dep.capitalize+N,
            file_location) # ProgramInformation.return_version(_['program_name'])
        }
      end
    end
  end
end
set_create_where(i) click to toggle source
#

set_create_where

#
# File lib/rbt/linux/gobolinux/create_dependencies_file.rb, line 98
def set_create_where(i)
  if i.is_a? Array
    i = i.first
  end
  i.delete!('-') if i.include? programs_directory?
  @create_where = rds(i)
end
set_dependencies(i) click to toggle source
#

set_dependencies

#
# File lib/rbt/linux/gobolinux/create_dependencies_file.rb, line 123
def set_dependencies(i)
  if i
    if i.is_a? Array
      i.map! {|entry| rds(entry) }
    else
      i = rds(i)
    end
  end
  @dependencies = i
end