Class: Delphi::Environment

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/delphi/environment.rb

Overview

Environment is a Singleton.

It is responsible for initializing the console environment for the verison of Delphi that is requested.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEnvironment

Returns a new instance of Environment.



18
19
20
21
# File 'lib/delphi/environment.rb', line 18

def initialize
  super
  @configured_version = 0
end

Instance Attribute Details

#bin_dirObject (readonly)

bin_dir is the location of the Delphi executables



16
17
18
# File 'lib/delphi/environment.rb', line 16

def bin_dir
  @bin_dir
end

Instance Method Details

#configure(project_version) ⇒ Object

Configure needs to be called on the Environment instance before the Compiler can be used. Normally it will be done by the Project, which will read the required version of Delphi from the dproj file.



26
27
28
29
30
31
32
# File 'lib/delphi/environment.rb', line 26

def configure(project_version)
  return @configured_version if @configured_version == project_version
  @bin_dir = delphi_directory(project_version)
  rsvars = File.join(@bin_dir, 'rsvars.bat')
  load_env(rsvars)
  @configured_version = project_version
end