Class: AssLauncher::Enterprise::BinaryWrapper Abstract Private

Inherits:
Object
  • Object
show all
Includes:
Support::Platforms
Defined in:
lib/ass_launcher/enterprise/binary_wrapper.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is abstract.
Note:

In Windows version parsed from path and may content incorrect value - not real 1C platform version see #extract_version. For platform > 8.2 if 1C platform instaled in standart directories it works correctly.

In linux version returns from method Support::Linux.get_pkg_version

Class for wrapping 1C:Enterprise platform binary executables such as 1cv8.exe and 1cv8c.exe. Class makes it easy to juggle with the different versions of 1C:Enterprise installations

Direct Known Subclasses

ThickClient

Defined Under Namespace

Classes: ThickClient, ThinClient

Constant Summary collapse

V64_FILES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w{version64.dat version64.txt}
X86_64 =
'x86_64'
I386 =
'i386'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Support::Platforms

cygwin?, env, glob, linux?, path, path_class, windows?

Constructor Details

#initialize(binpath) ⇒ BinaryWrapper

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of BinaryWrapper.



26
27
28
29
30
31
32
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 26

def initialize(binpath)
  @path = platform.path(binpath).realpath
  fail ArgumentError, "Is not a file `#{binpath}'" unless @path.file?
  fail ArgumentError,
       "Invalid binary #{@path.basename} for #{self.class}" unless\
       @path.basename.to_s.upcase == expects_basename.upcase
end

Instance Attribute Details

#pathObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 19

def path
  @path
end

Class Method Details

.run_modesArray<Symbol>

Returns:

  • (Array<Symbol>)


173
174
175
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 173

def self.run_modes
  Cli.defined_modes_for(self)
end

Instance Method Details

#<=>(other) ⇒ Bollean

Compare wrappers on version for sortable

Parameters:

Returns:

  • (Bollean)


112
113
114
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 112

def <=>(other)
  version <=> other.version
end

#archString

Define arch on 1C platform.

Returns:



52
53
54
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 52

def arch
  @arch ||= extract_arch
end

#cli_specCli::CliSpec

Returns:



185
186
187
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 185

def cli_spec
  @cli_spec ||= Cli::CliSpec.for(self)
end

#exists?Boolean

True if file exsists

Returns:

  • (Boolean)


123
124
125
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 123

def exists?
  path.file?
end

#major_vString

Return 2 major digits from version

Returns:



130
131
132
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 130

def major_v
  version.to_s.split('.')[0, 2].join('.')
end

#run_modesArray<Symbol>

Returns:

  • (Array<Symbol>)


179
180
181
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 179

def run_modes
  self.class.run_modes
end

#versionGem::Version

Note:

In Windows version parsed from path and may content incorrect value - not real 1C platform version see #extract_version. For platform > 8.2 if 1C platform instaled in standart directories it works correctly.

In linux version returns from method Support::Linux.get_pkg_version

Define version of 1C platform.

Returns:

  • (Gem::Version)


45
46
47
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 45

def version
  @version ||= extract_version(path.to_s)
end

#x86_64?Boolean

True if #arch == X86_64

Returns:

  • (Boolean)


58
59
60
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 58

def x86_64?
  arch == X86_64
end