class Confinicky::Controllers::Exports

A subclass of the command group controller specifically for managing export statements.

Public Class Methods

new() click to toggle source
Calls superclass method Confinicky::Controllers::Commands::new
# File lib/confinicky/controllers/exports.rb, line 9
def initialize
  super(file_type_key: :env)
  @commands = @shell_file.exports
  @table_title = "Environment Variables"
end

Public Instance Methods

clean!() click to toggle source

Finds duplicate export statements and replaces them with the actual value from the environment.

# File lib/confinicky/controllers/exports.rb, line 25
def clean!
  for duplicate in duplicates.map{|duplicate| duplicate[0]}
    @commands.delete_if{ |i| i[0] == duplicate}
    @commands << [duplicate, ENV[duplicate]]
  end
end
save!() click to toggle source

Updates the actual shell file on disk.

# File lib/confinicky/controllers/exports.rb, line 17
def save!
  @shell_file.exports = @commands
  @shell_file.write!
end