Module: Liberic

Extended by:
Liberic
Included in:
Liberic
Defined in:
lib/liberic.rb,
lib/liberic/boot.rb,
lib/liberic/config.rb,
lib/liberic/process.rb,
lib/liberic/sdk/api.rb,
lib/liberic/sdk/def.rb,
lib/liberic/version.rb,
lib/liberic/sdk/types.rb,
lib/liberic/response/errors.rb,
lib/liberic/sdk/fehlercodes.rb,
lib/liberic/response/version.rb,
lib/liberic/sdk/configuration.rb,
lib/liberic/helpers/invocation.rb

Defined Under Namespace

Modules: Helpers, Response, SDK Classes: Config, InitializationError, Process

Constant Summary collapse

ERIC_HOME =
ENV['ERIC_HOME_27'] || raise(InitializationError.new('ERIC_HOME_27 environment variable not found (set it to the path to the ERiC libraries)'))
ERIC_LIB_FOLDER =
File.expand_path('lib', ERIC_HOME)
VERSION =
'1.0.2'

Instance Method Summary collapse

Instance Method Details

#check_eric_version!Object


25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/liberic/boot.rb', line 25

def check_eric_version!
  version_response = Response::Version.new(
    Helpers::Invocation.with_result_buffer do |handle|
      SDK::API::version(handle)
    end
  )

  eric_version = version_response.for_library('libericapi')
  if !SDK::Configuration::LIBERICAPI_VERSION.include?(eric_version)
    #raise InitializationError.new("ERiC #{SDK::Configuration::LIBERICAPI_VERSION.join(', ')} required, but #{eric_version} found.")
    warn "ERiC #{SDK::Configuration::LIBERICAPI_VERSION.join(', ')} required, but #{eric_version} found."
  end
end

#configObject


15
16
17
# File 'lib/liberic.rb', line 15

def config
  @config ||= Config.new
end

#eric_homeObject


7
8
9
# File 'lib/liberic/boot.rb', line 7

def eric_home
  ERIC_HOME
end

#library_pathObject


11
12
13
14
15
16
17
18
19
20
# File 'lib/liberic/boot.rb', line 11

def library_path
  suffix = if RUBY_PLATFORM =~ /linux/
    'so'
  elsif RUBY_PLATFORM =~ /darwin/
    'dylib'
  else
    'dll'
  end
  File.expand_path("libericapi.#{suffix}", ERIC_LIB_FOLDER)
end