Class: EnvironmentInformation::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/environment_information/base/base.rb

Instance Method Summary collapse

Instance Method Details

#cd(i) ⇒ Object

#

cd (cd tag)

A shorter variant for the change-directory action.

#


77
78
79
# File 'lib/environment_information/base/base.rb', line 77

def cd(i)
  ::EnvironmentInformation.cd(i)
end

#commandline_arguments?Boolean

#

commandline_arguments?

#

Returns:

  • (Boolean)


43
44
45
# File 'lib/environment_information/base/base.rb', line 43

def commandline_arguments?
  @commandline_arguments
end

#e(i = '') ⇒ Object

#

e

#


28
29
30
# File 'lib/environment_information/base/base.rb', line 28

def e(i = '')
  ::EnvironmentInformation.e(i)
end

#esystem(i) ⇒ Object

#

esystem

#


84
85
86
87
# File 'lib/environment_information/base/base.rb', line 84

def esystem(i)
  e i
  system i
end

#first_argument?Boolean Also known as: first?

#

first_argument?

#

Returns:

  • (Boolean)


50
51
52
# File 'lib/environment_information/base/base.rb', line 50

def first_argument?
  @commandline_arguments.first
end

#gold(i = '') ⇒ Object

#

gold

#


92
93
94
# File 'lib/environment_information/base/base.rb', line 92

def gold(i = '')
  return ::Colours.gold(i)
end

#is_on_roebe?Boolean

#

is_on_roebe?

#

Returns:

  • (Boolean)


21
22
23
# File 'lib/environment_information/base/base.rb', line 21

def is_on_roebe?
  ::EnvironmentInformation.is_on_roebe?
end

#is_rbt_available?Boolean

#

is_rbt_available? (rbt tag)

Query whether the user has the necessary code from the RBT project installed.

#

Returns:

  • (Boolean)


60
61
62
# File 'lib/environment_information/base/base.rb', line 60

def is_rbt_available?
  Object.const_defined? :RBT
end

#lightblue(i = '') ⇒ Object

#

lightblue

#


155
156
157
# File 'lib/environment_information/base/base.rb', line 155

def lightblue(i = '')
  return ::Colours.lightblue(i)
end

#log_dir?Boolean Also known as: log_directory?

#

log_dir?

#

Returns:

  • (Boolean)


67
68
69
# File 'lib/environment_information/base/base.rb', line 67

def log_dir?
  ::EnvironmentInformation.temp_directory?
end

#mediumaquamarine(i = '') ⇒ Object

#

mediumaquamarine

#


162
163
164
# File 'lib/environment_information/base/base.rb', line 162

def mediumaquamarine(i = '')
  return ::EnvironmentInformation.mediumaquamarine(i)
end

#report_left_right(left = program_name?, , right = program_version?, , colour_for_the_left_side = ::EnvironmentInformation.colour_for_the_left_side, colour_for_the_right_side = ::EnvironmentInformation.colour_for_the_right_side, colour_for_program_not_found = ::EnvironmentInformation.colour_for_program_not_found, use_padding = true) ⇒ Object

#

report_left_right

#


99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/environment_information/base/base.rb', line 99

def report_left_right(
    left  = program_name?,
    right = program_version?,
    colour_for_the_left_side     = ::EnvironmentInformation.colour_for_the_left_side,
    colour_for_the_right_side    = ::EnvironmentInformation.colour_for_the_right_side,
    colour_for_program_not_found = ::EnvironmentInformation.colour_for_program_not_found,
    use_padding = true
  )
  case colour_for_the_left_side
  # ======================================================================= #
  # === :default_colour
  # ======================================================================= #
  when :default_colour
    colour_for_the_left_side = ::EnvironmentInformation.colour_for_the_left_side
  end
  case colour_for_the_right_side
  # ======================================================================= #
  # === :default_colour
  # ======================================================================= #
  when :default_colour
    colour_for_the_right_side = ::EnvironmentInformation.colour_for_the_right_side
  end
  case colour_for_program_not_found
  # ======================================================================= #
  # === :default_colour
  # ======================================================================= #
  when :default_colour
    colour_for_program_not_found = ::EnvironmentInformation.colour_for_program_not_found
  end
  case right
  when nil
    right = NOT_INSTALLED_OR_NOT_FOUND
  end
  right = right.dup if right.frozen?
  right.strip!
  if right.include? 'not found'
    right = ::EnvironmentInformation.send(
      colour_for_program_not_found, right
    )
  end
  colourized_right_side = ::EnvironmentInformation.send(
    colour_for_the_right_side,
    right
  ) 
  modified_left = "#{left}:"
  modified_left = modified_left.ljust(32) if use_padding
  e ::EnvironmentInformation.send(
      colour_for_the_left_side,
      modified_left
    )+
    " #{colourized_right_side}"
end

#set_commandline_arguments(i = '') ⇒ Object

#

set_commandline_arguments

#


35
36
37
38
# File 'lib/environment_information/base/base.rb', line 35

def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end