Class: AssLauncher::Enterprise::BinaryWrapper::ThickClient

Inherits:
AssLauncher::Enterprise::BinaryWrapper show all
Defined in:
lib/ass_launcher/enterprise/binary_wrapper.rb

Overview

Wrapper for 1C thick client binary

Examples:


cl = AssLauncher::Enterprise.thick_clients('~> 8.3.6').last
script = cl.script(:createinfobase, 'File="path\\new.ib"')
ph = script.run # this waiting until process executing
ph.result.expected_assout = /\("File="path\\new.ib";.*"\)/i
ph.result.verify!

# Get 1C:Enterprise last release for 8.3.6 version:

cl = AssLauncher::Enterprise.thick_clients('~> 8.3.6').last
raise 'Can\'t find 1C binary' if cl.nil?

# Run 1C:Enterprise designer
# Directly pass parameters:

args = ['/F', 'path/to/file/infobase', '/L', 'en']
ph = cl.command(:designer, args).run

ph.wait.result.assout # => "Infobase not found!"
ph.result.exitstatus # => 0

# Fucking 1C: "Infobase not found!" but exit with 0 ????

# Dump infobase
# Directly pass parameters:

args = ['/F', 'path/infobase', '/DumpIB', 'dump/path/file.dt', '/L',
       'en']
cm = cl.command(:designer, args)

cm.run.wait.result.verify!
#=> RunAssResult::RunAssError: Infobase not found!

# Dump infobase
# Uses Cli::ArgumentsBuilder:

conn_str = AssLauncher::Support::ConnectionString.\
  new('File="//host/infobase"')

command = cl.command(:designer) do
  connection_string conn_str
  DumpIB './infobase.dt'
end
ph = command.run.wait

ph.result.verify!
# Open thick client and attache into debuger

conn_str = AssLauncher::Support::ConnectionString.\
  new('srvr="localhost"; ref="infobase"')

command = cl.command(:enterprise) do
  connection_string conn_str
  debug
  debuggerUrl 'localhost'
end
ph = command.run.wait # Fucking 1C: If infobase not exists
#will be opened GUI window with info similar 'Inforamation base
#not found. Create new?" and exit whith status 0

#Fucking 1C:
#USES GUI DIALOG FOR ERROR REPORTING WHEN RUN IN NO GUI MODE

Direct Known Subclasses

ThinClient

Constant Summary

Constants inherited from AssLauncher::Enterprise::BinaryWrapper

I386, V64_FILES, X86_64

Instance Attribute Summary

Attributes inherited from AssLauncher::Enterprise::BinaryWrapper

#path

Instance Method Summary collapse

Methods inherited from AssLauncher::Enterprise::BinaryWrapper

#<=>, #arch, #cli_spec, #exists?, #initialize, #major_v, #run_modes, run_modes, #version, #x86_64?

Methods included from Support::Platforms

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

Constructor Details

This class inherits a constructor from AssLauncher::Enterprise::BinaryWrapper

Instance Method Details

#accepted_connstrArray<Symbol>

Define type of connection_string suitable for 1C binary

Returns:

  • (Array<Symbol>)


201
202
203
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 201

def accepted_connstr
  [:file, :server]
end

#command(run_mode, args = [], **options, &block) ⇒ AssLauncher::Support::Shell::Command

Note:

For correct pass cli parameters to 1C:Enterprise binary, you can passes block. Block will be eval in instance of Cli::ArgumentsBuilder. ArgumentsBuilder use Cli::CliSpec and verify parameters and prameters values. Also you can pass arguments directly, without verify, uses args array.

Note:

Command not wait while 1C:Enterprise execution. You can manipulate with many 1C clients runned at once.

Run 1C:Enterprise client as command.

Examples:


# Get 1C:Enterprise last release for 8.3.6 version:

cl = AssLauncher::Enterprise.thick_clients('~> 8.3.6').last
raise 'Can\'t find 1C binary' if cl.nil?

# Run 1C:Enterprise designer
# Directly pass parameters:

args = ['/F', 'path/to/file/infobase', '/L', 'en']
ph = cl.command(:designer, args).run

ph.wait.result.assout # => "Infobase not found!"
ph.result.exitstatus # => 0

# Fucking 1C: "Infobase not found!" but exit with 0 ????

# Dump infobase
# Directly pass parameters:

args = ['/F', 'path/infobase', '/DumpIB', 'dump/path/file.dt', '/L',
       'en']
cm = cl.command(:designer, args)

cm.run.wait.result.verify!
#=> RunAssResult::RunAssError: Infobase not found!

# Dump infobase
# Uses Cli::ArgumentsBuilder:

conn_str = AssLauncher::Support::ConnectionString.\
  new('File="//host/infobase"')

command = cl.command(:designer) do
  connection_string conn_str
  DumpIB './infobase.dt'
end
ph = command.run.wait

ph.result.verify!
# Open thick client and attache into debuger

conn_str = AssLauncher::Support::ConnectionString.\
  new('srvr="localhost"; ref="infobase"')

command = cl.command(:enterprise) do
  connection_string conn_str
  debug
  debuggerUrl 'localhost'
end
ph = command.run.wait # Fucking 1C: If infobase not exists
#will be opened GUI window with info similar 'Inforamation base
#not found. Create new?" and exit whith status 0

#Fucking 1C:
#USES GUI DIALOG FOR ERROR REPORTING WHEN RUN IN NO GUI MODE

Parameters:

  • run_mode (Symbol)

    run mode 1C binary. It will be puts fierst parameter in args

  • options (Hash)

    a customizable set of options

  • args (Array) (defaults to: [])

    arguments for 1C binary

Options Hash (**options):

  • :assout_encoding (String)

    encoding for assoutput file. Default ‘cp1251’

  • :capture_assout (Boolean)

    capture assoutput. Default true

  • :silent_mode (Boolean)

    run 1C with /DisableStartupDialogs and /DisableStartupMessages parameters. Default true

Returns:



285
286
287
288
289
290
291
292
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 285

def command(run_mode, args = [], **options, &block)
  args_ = args.dup
  args_.unshift mode(run_mode)
  args_ += build_args(run_mode, &block) if block_given?
  verify_createinfobase_param_order! args_ if\
    run_mode == :createinfobase
  to_command(args_, options)
end

#script(run_mode, args = '', **options) ⇒ AssLauncher::Support::Shell::Script

Note:

It waiting for script execution.

Note:

It not use arguments builder and not expects of block. Arguments string make as you want

Run 1C:Enterprise client as cmd or shell script.

Examples:


cl = AssLauncher::Enterprise.thick_clients('~> 8.3.6').last
script = cl.script(:createinfobase, 'File="path\\new.ib"')
ph = script.run # this waiting until process executing
ph.result.expected_assout = /\("File="path\\new.ib";.*"\)/i
ph.result.verify!

Parameters:

  • options (Hash)

    a customizable set of options

  • run_mode (Symbol)

    run mode 1C binary. It will be puts fierst parameter in args

  • args (String) (defaults to: '')

    string arguments for run 1C binary wrapped in cmd.exe or sh script like as: ‘/Arg1 “Value” /Arg2 “value”’

Options Hash (**options):

  • :assout_encoding (String)

    encoding for assoutput file. Default ‘cp1251’

  • :capture_assout (Boolean)

    capture assoutput. Default true

  • :silent_mode (Boolean)

    run 1C with /DisableStartupDialogs and /DisableStartupMessages parameters. Default true

Returns:



338
339
340
341
# File 'lib/ass_launcher/enterprise/binary_wrapper.rb', line 338

def script(run_mode, args = '', **options)
  args_ = "#{mode(run_mode)} #{args}"
  to_script(args_, options)
end