ass_launcher 0.1.1.alpha → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +69 -67
- data/Rakefile +19 -0
- data/ass_launcher.gemspec +8 -2
- data/bin/dev-helper +7 -0
- data/bin/lib/dev_helper/cli_def_report.rb +191 -0
- data/bin/lib/dev_helper/cli_def_snippets.rb +426 -0
- data/bin/lib/dev_helper/designer.rb +172 -0
- data/bin/lib/dev_helper.rb +59 -0
- data/examples/arguments_builder_example.rb +150 -0
- data/examples/binary_wrappers_example.rb +211 -0
- data/examples/connection_string_example.rb +59 -0
- data/examples/create_infobase_example.rb +45 -0
- data/examples/enterprise_ole_example.rb +238 -0
- data/examples/enterprise_out_example.rb +87 -0
- data/examples/enterprise_running_example.rb +103 -0
- data/examples/example_helper.rb +122 -0
- data/examples/templates/example_template.cf +0 -0
- data/examples/templates/example_template.v8i +9 -0
- data/examples/templates/hello.epf +0 -0
- data/examples/troubles/with_creteinfobase_example.rb +408 -0
- data/examples/troubles/with_running_1c_example.rb +212 -0
- data/examples/v8i_file_example.rb +72 -0
- data/examples/webclient_example.rb +67 -0
- data/lib/ass_launcher/api.rb +113 -0
- data/lib/ass_launcher/enterprise/binary_wrapper.rb +159 -144
- data/lib/ass_launcher/enterprise/cli/arguments_builder.rb +177 -16
- data/lib/ass_launcher/enterprise/cli/binary_matcher.rb +69 -0
- data/lib/ass_launcher/enterprise/cli/parameters.rb +297 -44
- data/lib/ass_launcher/enterprise/cli/spec_dsl/dsl_helpers.rb +111 -5
- data/lib/ass_launcher/enterprise/cli/spec_dsl.rb +102 -51
- data/lib/ass_launcher/enterprise/cli.rb +50 -90
- data/lib/ass_launcher/enterprise/cli_def/8.2.17.rb +317 -0
- data/lib/ass_launcher/enterprise/cli_def/8.2.18.rb +3 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.3.rb +90 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.4.rb +58 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.5.rb +21 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.6.rb +91 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.7.rb +34 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.8.rb +127 -0
- data/lib/ass_launcher/enterprise/cli_def/8.3.9.rb +131 -0
- data/lib/ass_launcher/enterprise/cli_def.rb +46 -0
- data/lib/ass_launcher/enterprise/cli_defs_loader.rb +36 -0
- data/lib/ass_launcher/enterprise/ole/ole_binaries.rb +9 -2
- data/lib/ass_launcher/enterprise/ole/win32ole.rb +1 -1
- data/lib/ass_launcher/enterprise/ole.rb +17 -1
- data/lib/ass_launcher/enterprise/web_client.rb +164 -0
- data/lib/ass_launcher/enterprise.rb +33 -6
- data/lib/ass_launcher/support/connection_string.rb +33 -8
- data/lib/ass_launcher/support/linux.rb +88 -0
- data/lib/ass_launcher/support/platforms.rb +42 -10
- data/lib/ass_launcher/support/shell.rb +33 -6
- data/lib/ass_launcher/support/v8i_file.rb +3 -1
- data/lib/ass_launcher/support/v8i_section.rb +88 -40
- data/lib/ass_launcher/support.rb +1 -0
- data/lib/ass_launcher/version.rb +8 -1
- data/lib/ass_launcher.rb +1 -0
- metadata +79 -17
- data/lib/ass_launcher/enterprise/cli/cli.spec +0 -256
- data/lib/ass_launcher/enterprise/web_clients.rb +0 -59
@@ -0,0 +1,172 @@
|
|
1
|
+
module DevHelper
|
2
|
+
module Designer
|
3
|
+
module Cmd
|
4
|
+
require 'clamp'
|
5
|
+
require 'ass_launcher'
|
6
|
+
class Main < Clamp::Command
|
7
|
+
AssLauncher.config.search_path = ENV['ASSPATH'] if ENV['ASSPATH']
|
8
|
+
def self.banner
|
9
|
+
"1C designer wrapper.\n"\
|
10
|
+
"Current seaching paths of 1C:Enterprise installations:\n"\
|
11
|
+
"#{Paths.list}\n"\
|
12
|
+
"For add custom search path set env $ASSPATH"
|
13
|
+
end
|
14
|
+
|
15
|
+
class Designer < Clamp::Command
|
16
|
+
include AssLauncher::Api
|
17
|
+
option ['-v', '--version'], 'VERSION', 'specify of platform version',
|
18
|
+
required: true
|
19
|
+
|
20
|
+
def cl
|
21
|
+
@cl ||= cl_get
|
22
|
+
end
|
23
|
+
|
24
|
+
def cl_get
|
25
|
+
r = thicks(version).last
|
26
|
+
signal_usage_error "Platform version `#{version}' not found" if r.nil?
|
27
|
+
r
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module ConnSring
|
32
|
+
def self.included(base)
|
33
|
+
base.option ['-b', '--info-base'], 'PATH',
|
34
|
+
baner(base),
|
35
|
+
required: _required(base) do |s|
|
36
|
+
@conn_str = cs_file(file: s)
|
37
|
+
end
|
38
|
+
base.send :attr_reader, :conn_str
|
39
|
+
end
|
40
|
+
|
41
|
+
def self._required(base)
|
42
|
+
base.respond_to? :conn_str_required?
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.baner(base)
|
46
|
+
r = 'specify infobase path.'
|
47
|
+
r << ' If not specify it will make tmp infobase' unless\
|
48
|
+
_required(base)
|
49
|
+
r
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class Run < Designer
|
54
|
+
include ConnSring
|
55
|
+
option ['-a', '--args'], '["ARG", "VAL" ...]',
|
56
|
+
'specify designer cmd arguments like Ruby Array' do |s|
|
57
|
+
@args = eval(s)
|
58
|
+
fail ArgumentError,
|
59
|
+
'specify designer cmd arguments like Ruby Array' unless\
|
60
|
+
@args.is_a? Array
|
61
|
+
@args
|
62
|
+
end
|
63
|
+
|
64
|
+
def execute
|
65
|
+
conn_str_ = conn_str || tmp_ib
|
66
|
+
args_ = args || []
|
67
|
+
cl.command(:designer, args_) do
|
68
|
+
connection_string conn_str_
|
69
|
+
end.run.wait.result.verify!
|
70
|
+
ensure
|
71
|
+
rm_tmp_ib
|
72
|
+
end
|
73
|
+
|
74
|
+
def rm_tmp_ib
|
75
|
+
FileUtils.rm_r tmp_ib_path if File.exists? tmp_ib_path
|
76
|
+
end
|
77
|
+
|
78
|
+
def tmp_ib
|
79
|
+
rm_tmp_ib
|
80
|
+
conn_str_ = cs_file(:file => tmp_ib_path)
|
81
|
+
process_holder = cl.command(:createinfobase) do
|
82
|
+
connection_string conn_str_
|
83
|
+
end.run.wait
|
84
|
+
process_holder.result.verify!
|
85
|
+
conn_str_
|
86
|
+
end
|
87
|
+
|
88
|
+
def tmp_ib_path
|
89
|
+
@tmp_ib_path ||= File.join(Dir.tmpdir, ib_dir_mame)
|
90
|
+
end
|
91
|
+
|
92
|
+
def ib_dir_mame
|
93
|
+
"#{self.class.name.gsub('::','-')}(#{version})"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
class CreateInfobase < Designer
|
98
|
+
|
99
|
+
def self.conn_str_required?
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
include ConnSring
|
104
|
+
|
105
|
+
option ['-t', '--template'], 'PATH[.cf|.dt]',
|
106
|
+
'Create infobase from template' do |s|
|
107
|
+
@template = s
|
108
|
+
end
|
109
|
+
|
110
|
+
def execute
|
111
|
+
$stdout.puts "Success make ib: `#{make_infobase}'"
|
112
|
+
end
|
113
|
+
|
114
|
+
def make_infobase
|
115
|
+
conn_str_ = conn_str
|
116
|
+
template_ = template
|
117
|
+
cl.command(:createinfobase) do
|
118
|
+
connection_string conn_str_
|
119
|
+
useTemplate template_ if template_
|
120
|
+
end.run.wait.result.verify!
|
121
|
+
conn_str_
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
class Platforms < Clamp::Command
|
127
|
+
include AssLauncher::Api
|
128
|
+
def execute
|
129
|
+
$stdout.puts paths
|
130
|
+
$stdout.puts thicks_list
|
131
|
+
$stdout.puts thins_list
|
132
|
+
end
|
133
|
+
|
134
|
+
def paths
|
135
|
+
"Search paths:\n"\
|
136
|
+
"#{Paths.list}"
|
137
|
+
end
|
138
|
+
|
139
|
+
def thicks_list
|
140
|
+
"thik clients:\n"\
|
141
|
+
"#{list(thicks)}"
|
142
|
+
end
|
143
|
+
|
144
|
+
def thins_list
|
145
|
+
"thin clients:\n"\
|
146
|
+
"#{list(thins)}"
|
147
|
+
end
|
148
|
+
|
149
|
+
def list(clients)
|
150
|
+
" * #{clients.map {|c| c.version}.sort.join("\n * ")}"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
class Paths < Clamp::Command
|
155
|
+
def self.list
|
156
|
+
" * #{AssLauncher::Enterprise.search_paths.join("\n * ")}"
|
157
|
+
end
|
158
|
+
|
159
|
+
def execute
|
160
|
+
$stdout.puts self.class.list
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
subcommand 'run', 'run of designer', Run
|
165
|
+
subcommand 'createinfobase', 'create file infrmation base', CreateInfobase
|
166
|
+
subcommand 'platforms', 'show list of instaled platforms', Platforms
|
167
|
+
subcommand 'search-paths', 'show search paths of 1C:Enterprise'\
|
168
|
+
' installations', Paths
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module DevHelper
|
2
|
+
module CliDefValidator
|
3
|
+
require 'ass_launcher'
|
4
|
+
def valid_clients
|
5
|
+
AssLauncher::Enterprise::Cli::BinaryMatcher::ALL_CLIENTS
|
6
|
+
end
|
7
|
+
|
8
|
+
def valid_modes
|
9
|
+
AssLauncher::Enterprise::Cli::DEFINED_MODES
|
10
|
+
end
|
11
|
+
|
12
|
+
def validate_clients
|
13
|
+
fail ArgumentError,
|
14
|
+
"Invalid clients. Expected #{valid_clients.map(&:to_s)}" if\
|
15
|
+
(clients - valid_clients).size > 0
|
16
|
+
end
|
17
|
+
|
18
|
+
def validate_modes
|
19
|
+
fail ArgumentError,
|
20
|
+
"Invalid modes. Expected #{valid_modes.map(&:to_s)}" if\
|
21
|
+
(modes - valid_modes).size > 0
|
22
|
+
end
|
23
|
+
|
24
|
+
def valid_groups
|
25
|
+
AssLauncher::Enterprise::Cli::CliSpec.cli_def.parameters_groups.keys
|
26
|
+
end
|
27
|
+
|
28
|
+
def validate_group
|
29
|
+
fail ArgumentError,
|
30
|
+
"Invalid group `#{group_name}'."\
|
31
|
+
" Expected #{valid_groups.map(&:to_s)}" unless\
|
32
|
+
valid_groups.include?(group_name)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module Cmd
|
37
|
+
require_relative './dev_helper/cli_def_report'
|
38
|
+
require_relative './dev_helper/cli_def_snippets'
|
39
|
+
require_relative './dev_helper/designer'
|
40
|
+
|
41
|
+
class Main < Clamp::Command
|
42
|
+
|
43
|
+
subcommand 'show-version', 'show ass_launcher version' do
|
44
|
+
def execute
|
45
|
+
$stdout.puts AssLauncher::VERSION
|
46
|
+
end
|
47
|
+
end
|
48
|
+
subcommand 'cli-def-report',
|
49
|
+
'generate, csv formatted, report on defined CLI parameters'\
|
50
|
+
' and puts it into STDOUT. (see DevHelper::CliDefReport)',
|
51
|
+
CliDefReport::Cmd::Report
|
52
|
+
subcommand 'cli-def-snippets',
|
53
|
+
CliDefSnippets::Cmd::Main._banner,
|
54
|
+
CliDefSnippets::Cmd::Main
|
55
|
+
subcommand 'designer', Designer::Cmd::Main.banner,
|
56
|
+
Designer::Cmd::Main
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
require 'example_helper'
|
2
|
+
|
3
|
+
module Examples
|
4
|
+
module ArgumentsBuilder
|
5
|
+
|
6
|
+
# 1C:Enterprise doesn't check CLI parameters and their arguments
|
7
|
+
# it may be cause of some problems when automation script writing
|
8
|
+
#
|
9
|
+
# AssLauncher provides feature for check CLI parameters.
|
10
|
+
# Feature consists of two parts:
|
11
|
+
# 1) CLI specifications which describe 1C:Enterprise CLI interface
|
12
|
+
# 2) Arguments builder which uses CLI specifications for checking CLI
|
13
|
+
# parameters when we building command or location for running 1C clients
|
14
|
+
|
15
|
+
describe '1C:Enterprise CLI specifications' do
|
16
|
+
it 'AssLauncher defines specifications for 1C:Enterprise CLI interface' do
|
17
|
+
AssLauncher::Enterprise::Cli::CliSpec.cli_def.must_equal\
|
18
|
+
AssLauncher::Enterprise::CliDef
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'Defined CLI specifications have CLI parameters collection' do
|
22
|
+
AssLauncher::Enterprise::Cli::CliSpec.cli_def.parameters\
|
23
|
+
.must_be_instance_of\
|
24
|
+
AssLauncher::Enterprise::Cli::Parameters::AllParameters
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'CLI parameter defined for client type, version and run mode' do
|
28
|
+
parameter = AssLauncher::Enterprise::Cli::CliSpec.cli_def\
|
29
|
+
.parameters.find('/F', nil)[0]
|
30
|
+
|
31
|
+
# Parameter define for thick client in :enterprise mode
|
32
|
+
parameter.match?(CLIENTS::THICK, :enterprise).must_equal true
|
33
|
+
|
34
|
+
# Parameter doesn't defined for webclient
|
35
|
+
parameter.match?(CLIENTS::WEB, :webclient).must_equal false
|
36
|
+
end
|
37
|
+
|
38
|
+
it "All client's wrappers know self CLI specifications" do
|
39
|
+
CLIENTS::THICK.cli_spec.must_be_instance_of\
|
40
|
+
AssLauncher::Enterprise::Cli::CliSpec
|
41
|
+
|
42
|
+
CLIENTS::THIN.cli_spec.must_be_instance_of\
|
43
|
+
AssLauncher::Enterprise::Cli::CliSpec
|
44
|
+
|
45
|
+
CLIENTS::WEB.cli_spec.must_be_instance_of\
|
46
|
+
AssLauncher::Enterprise::Cli::CliSpec
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'CliSpec have collection of CLI parameters which depended of run mode' do
|
50
|
+
CLIENTS::THICK.cli_spec.parameters(:designer).find('/CheckModules', nil)\
|
51
|
+
.must_be_instance_of\
|
52
|
+
AssLauncher::Enterprise::Cli::Parameters::Flag
|
53
|
+
|
54
|
+
CLIENTS::THICK.cli_spec.parameters(:enterprise).find('/CheckModules', nil)\
|
55
|
+
.must_be_nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe AssLauncher::Enterprise::Cli::ArgumentsBuilder do
|
60
|
+
# ArgumentsBuilder generate DSL for defined CLI cpecs
|
61
|
+
it 'When we build command or location we can use ArgumentsBuilder' do
|
62
|
+
|
63
|
+
command = CLIENTS::THICK.command(:designer) do
|
64
|
+
connection_string TMP::EMPTY_IB_CS
|
65
|
+
checkModules do
|
66
|
+
_Server
|
67
|
+
_ThinClient
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
command.args.join(', ').must_match\
|
72
|
+
%r{DESIGNER, /F, (.+), /CheckModules, , -Server, , -ThinClient}
|
73
|
+
end
|
74
|
+
|
75
|
+
# ArgumentsBuilder generates DSL which accepts case insensetive methods
|
76
|
+
# and methods with underscore prefix for separate uppercased method
|
77
|
+
# from the Ruby constant
|
78
|
+
it 'ArgumentsBuilder accepts DSL methods called as parameters name' do
|
79
|
+
|
80
|
+
proc {
|
81
|
+
CLIENTS::THIN.command do
|
82
|
+
DebuggerURL
|
83
|
+
end
|
84
|
+
}.must_raise NameError
|
85
|
+
|
86
|
+
args_1 = CLIENTS::THIN.command do
|
87
|
+
_DebuggerUrl 'http://example.org'
|
88
|
+
end.args.join(', ')
|
89
|
+
|
90
|
+
args_2 = CLIENTS::THIN.command do
|
91
|
+
debuggerUrl 'http://example.org'
|
92
|
+
end.args.join(', ')
|
93
|
+
|
94
|
+
# This example with () looks ugly
|
95
|
+
args_3 = CLIENTS::THIN.command do
|
96
|
+
DebuggerUrl('http://example.org')
|
97
|
+
end.args.join(', ')
|
98
|
+
|
99
|
+
# In all three cases arguments is equal
|
100
|
+
args_1.must_match %r{ENTERPRISE, /DebuggerURL, http://example\.org}
|
101
|
+
args_2.must_match %r{ENTERPRISE, /DebuggerURL, http://example\.org}
|
102
|
+
args_3.must_match %r{ENTERPRISE, /DebuggerURL, http://example\.org}
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'ArgumentsBuilder have static DSL method #connection_string' do
|
106
|
+
args = CLIENTS::THIN.command do
|
107
|
+
connection_string TMP::EMPTY_IB_CS
|
108
|
+
end.args.join(', ')
|
109
|
+
|
110
|
+
args.must_match %r{ENTERPRISE, /F, (.+)}
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'ArgumentsBuilder fail if parameter not defined' do
|
114
|
+
e = proc {
|
115
|
+
CLIENTS::WEB.location do
|
116
|
+
_BadParameter
|
117
|
+
end
|
118
|
+
}.must_raise AssLauncher::Enterprise::Cli::ArgumentsBuilder::BuildError
|
119
|
+
|
120
|
+
e.message.must_match %r{CLI parameter `/BadParameter' not definded .+}
|
121
|
+
|
122
|
+
e = proc {
|
123
|
+
CLIENTS::THICK.command(:designer) do
|
124
|
+
checkModules do
|
125
|
+
_BadSubParameter
|
126
|
+
end
|
127
|
+
end
|
128
|
+
}.must_raise AssLauncher::Enterprise::Cli::ArgumentsBuilder::BuildError
|
129
|
+
|
130
|
+
e.message.must_match %r{CLI parameter `-BadSubParameter' not definded .+}
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'ArgumentsBuilder check CLI parameter arguments' do
|
134
|
+
e = proc {
|
135
|
+
CLIENTS::THIN.command do
|
136
|
+
_O 'Bad value'
|
137
|
+
end
|
138
|
+
}.must_raise ArgumentError
|
139
|
+
|
140
|
+
e.message.must_equal 'Wrong value `Bad value\' for /O parameter'
|
141
|
+
|
142
|
+
args = CLIENTS::THIN.command do
|
143
|
+
_O :Low
|
144
|
+
end.args.join(', ')
|
145
|
+
|
146
|
+
args.must_match %r{ENTERPRISE, /O, Low}
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -0,0 +1,211 @@
|
|
1
|
+
require 'example_helper'
|
2
|
+
|
3
|
+
module Examples
|
4
|
+
module BinaryWrapper
|
5
|
+
require 'ass_launcher'
|
6
|
+
|
7
|
+
describe '1C:Enterprise binaries search paths' do
|
8
|
+
|
9
|
+
# AssLauncher searching 1C:Enterprise binaries
|
10
|
+
# in default installation paths which depends of
|
11
|
+
# operation system
|
12
|
+
it 'Array of default search paths' do
|
13
|
+
AssLauncher::Enterprise.search_paths.must_be_instance_of Array
|
14
|
+
AssLauncher::Enterprise.search_paths.wont_include __FILE__
|
15
|
+
end
|
16
|
+
|
17
|
+
# But we can add custom path into searching array
|
18
|
+
it 'Array of default search paths include custom path' do
|
19
|
+
# Add custom path
|
20
|
+
AssLauncher.config.search_path = __FILE__
|
21
|
+
|
22
|
+
AssLauncher::Enterprise.search_paths.must_include __FILE__
|
23
|
+
|
24
|
+
# Reset defauls
|
25
|
+
AssLauncher.config.search_path = nil
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '1C:Enterprise binary types' do
|
31
|
+
extend AssLauncher::Api
|
32
|
+
|
33
|
+
# AssLauncher search two different 1C:Enterprise binary files aka
|
34
|
+
# 'thick' and 'thin' clients and returns array of suitable
|
35
|
+
# objects sach as BinaryWrapper::Thick and BinaryWrapper::Thin.
|
36
|
+
|
37
|
+
# Get thin clients array Api.thins method
|
38
|
+
thin_clients = thins
|
39
|
+
# Get thick clients array Api.thicks method
|
40
|
+
thick_clients = thicks
|
41
|
+
|
42
|
+
it 'Both method returned Array' do
|
43
|
+
thin_clients.must_be_instance_of Array
|
44
|
+
thick_clients.must_be_instance_of Array
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '1C:Enterprise binary version' do
|
49
|
+
extend AssLauncher::Api
|
50
|
+
|
51
|
+
# AssLauncher provides posebility chose of 1C:Enterprise version.
|
52
|
+
# For define of required version uses Gem::Version::Requirement
|
53
|
+
# string.
|
54
|
+
|
55
|
+
# Get thick clients with version requiremet
|
56
|
+
thick_clients = thicks('~> 8.3.8.0')
|
57
|
+
|
58
|
+
it 'Fail if bad Gem::Version::Requirement' do
|
59
|
+
proc do
|
60
|
+
AssLauncher::Enterprise.thick_clients('bad version string')
|
61
|
+
end.must_raise ArgumentError
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'Binary wrappers run modes' do
|
66
|
+
# For BinaryWrapper::Thick objects
|
67
|
+
# defined run modes such as :enterprise, :designer and :createinfobase
|
68
|
+
it 'Run modes for thick client' do
|
69
|
+
AssLauncher::Enterprise::BinaryWrapper::ThickClient\
|
70
|
+
.run_modes.must_equal [:createinfobase, :enterprise, :designer]
|
71
|
+
end
|
72
|
+
|
73
|
+
# For BinaryWrapper::Thin objects
|
74
|
+
# defined :enterprise only run mode
|
75
|
+
it 'Run modes for thin client' do
|
76
|
+
AssLauncher::Enterprise::BinaryWrapper::ThinClient\
|
77
|
+
.run_modes.must_equal [:enterprise]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe 'Execution thick client' do
|
82
|
+
extend AssLauncher::Api
|
83
|
+
|
84
|
+
# Get binary wrapper
|
85
|
+
client = thicks(Examples::PLATFORM_VER).last
|
86
|
+
|
87
|
+
# Fail if not 1C:Enterprise instalation found
|
88
|
+
fail "1C:Enterprise v.#{Examples::PLATFORM_VER} not found" if client.nil?
|
89
|
+
|
90
|
+
# Build command for necessary run mode 1C:Enterprise
|
91
|
+
# using arguments array
|
92
|
+
command = client.command(:designer,
|
93
|
+
['/F','bad infobase path',
|
94
|
+
'/CheckModules','',
|
95
|
+
'-Server','',
|
96
|
+
'/L', 'en'])
|
97
|
+
|
98
|
+
|
99
|
+
# Run 1C:Enterprise in forked process
|
100
|
+
command.run
|
101
|
+
|
102
|
+
# Wait until 1C:Enterprise execution.
|
103
|
+
# But we can use 'command.ran.wait' for run and wait together
|
104
|
+
process_holder = command.process_holder.wait
|
105
|
+
|
106
|
+
it 'Verify execution result manually' do
|
107
|
+
process_holder.result.success?.must_equal false
|
108
|
+
process_holder.result.assout.must_match /Infobase not found!/i
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'Verify execution result automatically' do
|
112
|
+
proc do
|
113
|
+
process_holder.result.verify!
|
114
|
+
end.must_raise AssLauncher::Support::Shell::RunAssResult::RunAssError
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe 'Execution thin client' do
|
119
|
+
extend AssLauncher::Api
|
120
|
+
|
121
|
+
# Get binary wrapper
|
122
|
+
client = thins(Examples::PLATFORM_VER).last
|
123
|
+
|
124
|
+
# Fail if not 1C:Enterprise instalation found
|
125
|
+
fail "1C:Enterprise v.#{Examples::PLATFORM_VER} not found" if client.nil?
|
126
|
+
|
127
|
+
# Build command for 1C:Enterprise using arguments array.
|
128
|
+
command = client.command( ['/F','bad infobase path',
|
129
|
+
'/L', 'en'])
|
130
|
+
|
131
|
+
|
132
|
+
# Run 1C:Enterprise in forked process
|
133
|
+
process_holder = command.run
|
134
|
+
|
135
|
+
# Working process
|
136
|
+
|
137
|
+
# Kill 1C:Enterprise if no longer used
|
138
|
+
process_holder.kill
|
139
|
+
end
|
140
|
+
|
141
|
+
describe 'Building commands' do
|
142
|
+
extend AssLauncher::Api
|
143
|
+
|
144
|
+
# For building commands we can:
|
145
|
+
# 1) passing arguments array directly into command
|
146
|
+
# 2) using arguments builder DSL and passing block into command
|
147
|
+
# 3) using connection string passed into arguments builder
|
148
|
+
# 4) mix all this
|
149
|
+
|
150
|
+
|
151
|
+
# For more info about arguments builder see source code of
|
152
|
+
# class AssLauncher::Enterprise::Cli::ArgumentsBuilder
|
153
|
+
|
154
|
+
# Get binary wrapper
|
155
|
+
client = thicks(Examples::PLATFORM_VER).last
|
156
|
+
|
157
|
+
# Fail if not 1C:Enterprise instalation found
|
158
|
+
fail "1C:Enterprise v.#{Examples::PLATFORM_VER} not found" if client.nil?
|
159
|
+
|
160
|
+
# Build command for necessary run mode 1C:Enterprise
|
161
|
+
# using arguments array
|
162
|
+
command_first = client.command(:designer,
|
163
|
+
['/UC', 'uc value',
|
164
|
+
'/S','example.org/infobase',
|
165
|
+
'/CheckModules','',
|
166
|
+
'-Server','',
|
167
|
+
'/L', 'en'])
|
168
|
+
|
169
|
+
# Build command for necessary run mode 1C:Enterprise
|
170
|
+
# using arguments builder and arguments array
|
171
|
+
command_second = client.command(:designer, ['/UC', 'uc value']) do
|
172
|
+
_S 'example.org/infobase'
|
173
|
+
checkModules do
|
174
|
+
server
|
175
|
+
end
|
176
|
+
_L 'en'
|
177
|
+
end
|
178
|
+
|
179
|
+
# Build command for necessary run mode 1C:Enterprise
|
180
|
+
# using arguments builder and connection string and arguments array
|
181
|
+
conns = cs_srv srvr: 'example.org', ref: 'infobase'
|
182
|
+
command_third = client.command(:designer, ['/UC', 'uc value']) do
|
183
|
+
connection_string conns
|
184
|
+
checkModules do
|
185
|
+
server
|
186
|
+
end
|
187
|
+
_L 'en'
|
188
|
+
end
|
189
|
+
|
190
|
+
it 'All commands are equal exclude "/OUT" argument value' do
|
191
|
+
expected_args = ["DESIGNER",
|
192
|
+
"/UC", "uc value",
|
193
|
+
"/S", "example.org/infobase",
|
194
|
+
"/CheckModules", "",
|
195
|
+
"-Server", "",
|
196
|
+
"/L", "en",
|
197
|
+
"/DisableStartupDialogs", "",
|
198
|
+
"/DisableStartupMessages", "",
|
199
|
+
"/OUT"]
|
200
|
+
command_first.args.pop
|
201
|
+
command_first.args.must_equal expected_args
|
202
|
+
|
203
|
+
command_second.args.pop
|
204
|
+
command_second.args.must_equal expected_args
|
205
|
+
|
206
|
+
command_third.args.pop
|
207
|
+
command_third.args.must_equal expected_args
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|