ass_launcher 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fbca40b83af00827002d71be4d50ca308bd130c
4
- data.tar.gz: 7124bde1c41c4c77ae4c34412635c793ca48ebc9
3
+ metadata.gz: 5008022ad5d5fd04a83c36b1f3fbe8acd4287d3b
4
+ data.tar.gz: 8de98dc56afa600f640676b3bd25007e60365c3b
5
5
  SHA512:
6
- metadata.gz: 17297f776ba83783f955196619faa77fd2eb473c2ea60e0e074d470712db6b0a79a8d1d55c30db2a511417ef7624502d6a8ba0e46cf397216bdb98ee3d7017bf
7
- data.tar.gz: 89a3f47c7bd215476a6314369994cb541523ea9e42699efec5a0c0468ab47f5d858f9083a5aaa01dce315e697dd6906e7f93c8cd2f85d4fc421f93264b2f2da0
6
+ metadata.gz: d913884ca7a19f1c69e6fc79139883a2c51ff9ca9bec2eb4b6c4ed8bc59b9186ad58721632d0185250f555dee795336decd9041c3cb020f657cbccf9f20a543e
7
+ data.tar.gz: 66e9ba2adafef61c6a8a1671196557c8ee92b800aef2c18562e2dd3ac01a27db446cc2219ef3922b6763b704c8326c0944d2e4bda33f9c8172563e49ef3d7e39
data/README.md CHANGED
@@ -76,6 +76,99 @@ For more info about `ass-launcher` execute:
76
76
  $ass-launcher --help
77
77
 
78
78
 
79
+ ## x86_64 1C:Enterprise for Windows
80
+
81
+ From `v8.3.9` 1C provides x86_64 arch platform for Windows.
82
+
83
+ For choosing which arch of 1C binary you need
84
+ `AssLauncher::Enterprise::BinaryWrapper` has `arch` property and some helpers
85
+ in `AssLauncher::Api` like a `*_i386` and `*_x86_64`.
86
+
87
+ For inproc OLE server `v83.ComConnector` aka `comcntr.dll`, arch of 1C
88
+ binary selects automaticaly in depends of Ruby arch.
89
+
90
+ On default using of `x86_64` 1C OLE server is forbidden (see below trouble).
91
+ For forcing to use `x86_64` OLE server set config flag `use_x86_64_ole`:
92
+
93
+ ```ruby
94
+ AssLauncher.configure do |conf|
95
+ conf.use_x86_64_ole = true
96
+ end
97
+ ```
98
+
99
+ ### Trouble with x86_64 inproc OLE server `v83.ComConnector`
100
+
101
+ `x86_64` inproc OLE server or Ruby `win32ole` is unstable now
102
+ and Ruby usually crashed while handling connect error.
103
+
104
+ Еxample for `x86_64` Ruby and 1C OLE server:
105
+
106
+ ```
107
+ $ruby -v
108
+ ruby 2.3.6p384 (2017-12-14 revision 9808) [x86_64-cygwin]
109
+
110
+ $pry
111
+
112
+ RbConfig::CONFIG['arch'] #=> "x86_64-cygwin"
113
+
114
+ require 'win32ole'
115
+
116
+ inproc = WIN32OLE.new('V83.COMConnector')
117
+
118
+ inproc.connect('invalid connection string')
119
+
120
+ ....*** buffer overflow detected ***: terminated
121
+ Aborted (стек памяти сброшен на диск)
122
+ ```
123
+
124
+ The same example for `i386` Ruby and 1C OLE server working fine:
125
+
126
+ ```
127
+ $ruby -v
128
+ ruby 2.3.6p384 (2017-12-14 revision 9808) [i386-cygwin]
129
+
130
+ $pry
131
+
132
+ RbConfig::CONFIG['arch'] #=> "i386-cygwin"
133
+
134
+ require 'win32ole'
135
+
136
+ inproc = WIN32OLE.new('V83.COMConnector')
137
+
138
+ inproc.connect('invalid connection string')
139
+
140
+ WIN32OLERuntimeError: (in OLE method `connect': )
141
+ OLE error code:80004005 in V83.COMConnector.1
142
+ Неверные или отсутствующие параметры соединения с информационной базой
143
+ HRESULT error code:0x80020009
144
+ Exception occurred.
145
+ from (pry):3:in `method_missing'
146
+ ```
147
+
148
+
149
+ ### Trouble with x86_64 standalone OLE servers `v83c.Application` and `v83.Application`
150
+
151
+ On theory, architecture of standalone OLE server isn't important for using them
152
+ in various Ruby architectures.
153
+
154
+ But it only theory. While in the run [exaples](examples/) in the `i386` Ruby
155
+ with `x86_64` standalone 1C OLE observes the unexpected behavior of 1C OLE
156
+ servers like a errors while to connect to information base:
157
+
158
+ ```
159
+ WIN32OLERuntimeError: (in OLE method `connect': )
160
+ OLE error code:0 in <Unknown>
161
+ <No Description>
162
+ HRESULT error code:0x80010108
163
+ The object invoked has disconnected from its clients.
164
+ /tmp/ass_launcher/lib/ass_launcher/enterprise/ole/win32ole.rb:87:in `method_missing'
165
+ /tmp/ass_launcher/lib/ass_launcher/enterprise/ole/win32ole.rb:87:in `call'
166
+ /tmp/ass_launcher/lib/ass_launcher/enterprise/ole/win32ole.rb:87:in `block in <class:WIN32OLE>'
167
+ /tmp/ass_launcher/lib/ass_launcher/enterprise/ole.rb:142:in `__try_open__'
168
+ /tmp/ass_launcher/lib/ass_launcher/enterprise/ole.rb:136:in `__open__'
169
+ /tmp/ass_launcher/examples/enterprise_ole_example.rb:131:in `block (4 levels) in <module:EnterpriseOle>'
170
+ ```
171
+
79
172
  ## Usage
80
173
 
81
174
  ### Examples
data/ass_launcher.gemspec CHANGED
@@ -23,18 +23,19 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.metadata = {'known_enterprise_versions' => AssLauncher::KNOWN_ENTERPRISE_VERSIONS.get.join(', ')}
25
25
 
26
- spec.add_dependency "inifile"
27
- spec.add_dependency "methadone"
26
+ spec.add_dependency "inifile", "~> 3.0"
27
+ spec.add_dependency "methadone", "~> 1.9"
28
28
  spec.add_dependency "addressable", "= 2.4.0"
29
- spec.add_dependency "clamp"
30
- spec.add_dependency "colorize"
31
- spec.add_dependency "command_line_reporter", '>=3.0'
29
+ spec.add_dependency "clamp", "~> 1.2"
30
+ spec.add_dependency "colorize", "~> 0.8"
31
+ spec.add_dependency "io-console", "~> 0.4.6"
32
+ spec.add_dependency "command_line_reporter", '~> 3.0'
32
33
 
33
34
  spec.add_development_dependency "bundler", "~> 1.10"
34
35
  spec.add_development_dependency "rake", "~> 10.0"
35
- spec.add_development_dependency "minitest"
36
- spec.add_development_dependency "pry"
36
+ spec.add_development_dependency "minitest", "~> 5.11"
37
+ spec.add_development_dependency "pry", "~> 0.11"
37
38
  spec.add_development_dependency "mocha", "= 1.1.0"
38
- spec.add_development_dependency "simplecov"
39
- spec.add_development_dependency "coderay"
39
+ spec.add_development_dependency "simplecov", "~> 0.15"
40
+ spec.add_development_dependency "coderay", "~> 1.1"
40
41
  end
@@ -196,6 +196,7 @@ module Examples
196
196
  "/L", "en",
197
197
  "/DisableStartupDialogs", "",
198
198
  "/DisableStartupMessages", "",
199
+ "/AppAutoCheckVersion-", "",
199
200
  "/OUT"]
200
201
  command_first.args.pop
201
202
  command_first.args.must_equal expected_args
@@ -215,9 +215,9 @@ module Examples
215
215
 
216
216
  ruby_obj = Object.new
217
217
 
218
- skip 'It Segmentation fault in:'\
219
- ' ruby 2.0.0p645 (2015-04-13 revision 50299)'\
220
- ' [i386-cygwin]' if RUBY_VERSION == '2.0.0'
218
+ skip "It usually Segmentation fault in ruby:\n"\
219
+ " 2.0.0p645 (2015-04-13 revision 50299) [i386-cygwin]\n"\
220
+ " 2.3.6p384 (2017-12-14 revision 9808) [i386-cygwin]"
221
221
 
222
222
  # Call OLE server
223
223
  ole_server.add(1, ruby_obj)
@@ -2,7 +2,7 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
  require 'ass_launcher'
3
3
 
4
4
  module Examples
5
- MIN_PLATFORM_VERSION = '8.3.8'
5
+ MIN_PLATFORM_VERSION = '8.3.10'
6
6
 
7
7
  PLATFORM_VER = "~> #{MIN_PLATFORM_VERSION}"
8
8
  OLE_V8 = '83'
@@ -31,6 +31,7 @@ module Examples
31
31
  File.exists?(conns.file).must_equal false
32
32
 
33
33
  # But created infobase which we don't want
34
+ skip 'It fixed from 1C:Enterprise 8.3.10'
34
35
  command.process_holder.result.success?.must_equal true
35
36
  command.process_holder.result.assout =~\
36
37
  /Creation of infobase \("File\s?=\s?"([^"]+)/i
@@ -91,6 +92,8 @@ module Examples
91
92
  end
92
93
 
93
94
  it "Fails if connection string double quoted" do
95
+ skip 'It fixed from 1C:Enterprise 8.3.10'
96
+
94
97
  conns = "File=\"#{infobasedir}\""
95
98
 
96
99
  # Path like C:\tempdir\infobase
@@ -151,6 +154,7 @@ module Examples
151
154
  conns = "File=\'#{infobasedir}\'"
152
155
 
153
156
  it 'Fails CREATEINFOBASE' do
157
+ skip 'It fixed from 1C:Enterprise 8.3.10'
154
158
  skip 'Not actual in Linux' if PLATFORM::LINUX
155
159
 
156
160
  command = CLIENTS::THICK.command :createinfobase,
@@ -188,6 +192,7 @@ module Examples
188
192
  command.process_holder.result.assout.must_match(
189
193
  /Creation of infobase \("File=\\;.+\) completed successfully/i)
190
194
  else
195
+ skip 'It fixed from 1C:Enterprise 8.3.10'
191
196
  # Next runs test: found infobase files in root the file system
192
197
  command.process_holder.result.assout.must_match(
193
198
  /The Infobase specified already exists/i)
@@ -227,6 +232,7 @@ module Examples
227
232
  # Exit status and assout:
228
233
  if command.process_holder.result.exitstatus == 0
229
234
  # First run test: created new infobase in the current directory
235
+ skip 'It fixed from 1C:Enterprise 8.3.10'
230
236
  command.process_holder.result.assout.must_match(
231
237
  /Creation of infobase \("File='\.\.\\trouble_.+\) \S+ successfully/i)
232
238
  else
@@ -245,6 +251,8 @@ module Examples
245
251
 
246
252
  describe 'Using double quoted connection string' do
247
253
  it "Fails if connection string double quoted" do
254
+ skip 'It fixed from 1C:Enterprise 8.3.10'
255
+
248
256
  conns = "File=\"#{infobasedir}\""
249
257
  Pathname.new(infobasedir).relative?.must_equal true
250
258
 
@@ -288,6 +296,8 @@ module Examples
288
296
 
289
297
  describe 'Using single quoted connection' do
290
298
  it 'Fails CREATEINFOBASE' do
299
+ skip 'It fixed from 1C:Enterprise 8.3.10'
300
+
291
301
  extend AssLauncher::Api
292
302
 
293
303
  File.exists?(root).must_equal true
@@ -325,6 +335,7 @@ module Examples
325
335
  command.process_holder.result.assout.must_match(
326
336
  /Creation of infobase \("File=\\;.+\) completed successfully/i)
327
337
  else
338
+ skip 'It fixed from 1C:Enterprise 8.3.10'
328
339
  # Next runs test: found infobase files in root of the file system
329
340
  command.process_holder.result.assout.must_match(
330
341
  /The Infobase specified already exists/i)
@@ -201,6 +201,7 @@ module Examples
201
201
  designer.run.wait
202
202
 
203
203
  it 'Exitstatus == 0' do
204
+ skip 'It fixed from 1C:Enterprise 8.3.10'
204
205
  designer.process_holder.result.exitstatus.must_equal 0
205
206
  end
206
207
 
@@ -14,6 +14,24 @@ module AssLauncher
14
14
  AssLauncher::Enterprise.thick_clients(requiremet).sort
15
15
  end
16
16
 
17
+ # Return sorted array of instaled x86_64 1C binary wrappers
18
+ # @param (see thicks)
19
+ # @return (see thicks)
20
+ def thicks_x86_64(requiremet = '>=0')
21
+ thicks(requiremet).select do |bw|
22
+ bw.x86_64?
23
+ end
24
+ end
25
+
26
+ # Return sorted array of instaled i386 1C binary wrappers
27
+ # @param (see thicks)
28
+ # @return (see thicks)
29
+ def thicks_i386(requiremet = '>=0')
30
+ thicks(requiremet).select do |bw|
31
+ !bw.x86_64?
32
+ end
33
+ end
34
+
17
35
  # Return sorted array of instaled 1C binary wrappers
18
36
  # @example
19
37
  # inclide AssLauncher::Api
@@ -26,6 +44,24 @@ module AssLauncher
26
44
  AssLauncher::Enterprise.thin_clients(requiremet).sort
27
45
  end
28
46
 
47
+ # Return sorted array of instaled x86_64 1C binary wrappers
48
+ # @param (see thins)
49
+ # @return (see thins)
50
+ def thins_x86_64(requiremet = '>=0')
51
+ thins(requiremet).select do |bw|
52
+ bw.x86_64?
53
+ end
54
+ end
55
+
56
+ # Return sorted array of instaled i386 1C binary wrappers
57
+ # @param (see thins)
58
+ # @return (see thins)
59
+ def thins_i386(requiremet = '>=0')
60
+ thins(requiremet).select do |bw|
61
+ !bw.x86_64?
62
+ end
63
+ end
64
+
29
65
  # (see AssLauncher::Support::ConnectionString.new)
30
66
  # @example
31
67
  # include AssLauncher::Api
@@ -148,6 +148,11 @@ module AssLauncher
148
148
  include AssLauncher::Api
149
149
  include ClientMode
150
150
 
151
+ def self.included(base)
152
+ fail "#{base} must include Option::Arch module before include"\
153
+ ' BinaryWrapper' unless base.include? Option::Arch
154
+ end
155
+
151
156
  def binary_wrapper
152
157
  binary_get || (fail Clamp::ExecutionError
153
158
  .new(not_inst_message, invocation_path, 1))
@@ -169,12 +174,26 @@ module AssLauncher
169
174
 
170
175
  def binary_get
171
176
  case client
172
- when :thick then thicks(vrequrement).last
173
- when :thin then thins(vrequrement).last
177
+ when :thick then thicks_get(vrequrement).last
178
+ when :thin then thins_get(vrequrement).last
174
179
  end
175
180
  end
176
181
  private :binary_get
177
182
 
183
+ def thicks_get(req)
184
+ thicks(req).select do |bw|
185
+ arch_any? || bw.arch == arch
186
+ end
187
+ end
188
+ private :thicks_get
189
+
190
+ def thins_get(req)
191
+ thins(req).select do |bw|
192
+ arch_any? || bw.arch == arch
193
+ end
194
+ end
195
+ private :thins_get
196
+
178
197
  # rubocop:disable all
179
198
  def dry_run(cmd)
180
199
  r = "#{cmd.cmd.gsub(' ', '\\ ')} "
@@ -428,6 +447,33 @@ module AssLauncher
428
447
  end
429
448
  end
430
449
  end
450
+
451
+ # Mixin
452
+ # Command option
453
+ module Arch
454
+ def expected_archs
455
+ [AssLauncher::Enterprise::BinaryWrapper::X86_64,
456
+ AssLauncher::Enterprise::BinaryWrapper::I386]
457
+ end
458
+
459
+ def self.included(base)
460
+ base.option '--arch', 'ARCH',
461
+ 'specify x86_64 or i386 platform arch' do |s|
462
+ fail ArgumentError, "Invalid arch `#{s}'."\
463
+ " Valid values #{expected_archs.join('|')}" unless\
464
+ expected_archs.include? s
465
+ s
466
+ end
467
+ end
468
+
469
+ def x86_64?
470
+ arch.to_s == AssLauncher::Enterprise::BinaryWrapper::X86_64
471
+ end
472
+
473
+ def arch_any?
474
+ arch.nil?
475
+ end
476
+ end
431
477
  end
432
478
 
433
479
  # @api private
@@ -673,7 +719,7 @@ module AssLauncher
673
719
  r = 'CLI PARAMETERS'
674
720
  end
675
721
  r << " AVAILABLE FOR: \"#{client}\" CLIENT V#{version}"
676
- r << " IN \"#{mode}\" RUNING MODE" if client == :thick
722
+ r << " IN \"#{mode}\" RUNNING MODE" if client == :thick
677
723
  r.upcase
678
724
  end
679
725
  # rubocop:enable Style/ConditionalAssignment
@@ -785,6 +831,7 @@ module AssLauncher
785
831
  include Option::Password
786
832
  include Option::Uc
787
833
  include Option::Raw
834
+ include Option::Arch
788
835
  include BinaryWrapper
789
836
  include ParseIbPath
790
837
 
@@ -815,8 +862,6 @@ module AssLauncher
815
862
  _N usr if usr
816
863
  _P pass if pass
817
864
  _UC uc_ if uc_
818
- _AppAutoCheckVersion(:-) if Gem::Requirement.new('>= 8.3.8')
819
- .satisfied_by? binary_wrapper.version
820
865
  end
821
866
  cmd
822
867
  end
@@ -872,18 +917,21 @@ module AssLauncher
872
917
  end
873
918
 
874
919
  def list(clients)
875
- " - v#{clients.map(&:version).sort.reverse.join("\n - v")}"
920
+ " - v#{clients.map do |cl|
921
+ "#{cl.version} (#{cl.arch})"
922
+ end.join("\n - v")}"
876
923
  end
877
924
 
878
925
  # rubocop:disable Metrics/AbcSize
879
926
  def execute
927
+ puts Colorize.red "Ruby arch: #{RbConfig::CONFIG['arch']}"
880
928
  puts Colorize.yellow '1C:Enterprise installations was searching in:'
881
929
  puts Colorize
882
930
  .green " - #{AssLauncher::Enterprise.search_paths.join("\n - ")}"
883
931
  puts Colorize.yellow 'Thick client installations:'
884
- puts Colorize.green list(thicks)
932
+ puts Colorize.green list(thicks.reverse)
885
933
  puts Colorize.yellow 'Thin client installations:'
886
- puts Colorize.green list(thins)
934
+ puts Colorize.green list(thins.reverse)
887
935
  end
888
936
  # rubocop:enable Metrics/AbcSize
889
937
  end
@@ -12,6 +12,7 @@ module AssLauncher
12
12
  include Abstract::Option::Version
13
13
  include Abstract::Option::DryRun
14
14
  include Abstract::Option::SearchPath
15
+ include Abstract::Option::Arch
15
16
  include Abstract::BinaryWrapper
16
17
 
17
18
  def self.command_name
@@ -41,7 +41,7 @@ module AssLauncher
41
41
  sp = []
42
42
  sp << AssLauncher.config.search_path
43
43
  if windows_or_cygwin?
44
- sp += platform.env[/\Aprogram\s*files.*/i].uniq.map { |pf| "#{pf}/1c*" }
44
+ sp += platform.env[/\Aprogram\s*(files.*|W6432)/i].uniq.map { |pf| "#{pf}/1c*" }
45
45
  elsif linux?
46
46
  sp += %w(/opt/1C /opt/1c)
47
47
  end
@@ -17,6 +17,11 @@ module AssLauncher
17
17
  class BinaryWrapper
18
18
  include AssLauncher::Support::Platforms
19
19
  attr_reader :path
20
+ V64_FILES = %w{version64.dat version64.txt}
21
+ # @api public
22
+ X86_64 = 'x86_64'
23
+ # @api public
24
+ I386 = 'i386'
20
25
 
21
26
  def initialize(binpath)
22
27
  @path = platform.path(binpath).realpath
@@ -42,11 +47,16 @@ module AssLauncher
42
47
  end
43
48
 
44
49
  # Define arch on 1C platform.
45
- # @note Arch of platform actual for Linux. In windows return i386
46
50
  # @api public
47
- # @return [String]
51
+ # @return [String] {X86_64} or {I386}
48
52
  def arch
49
- @arch ||= extract_arch(path.to_s)
53
+ @arch ||= extract_arch
54
+ end
55
+
56
+ # True if {#arch} == {X86_64}
57
+ # @api public
58
+ def x86_64?
59
+ arch == X86_64
50
60
  end
51
61
 
52
62
  # Extract version from path
@@ -57,27 +67,44 @@ module AssLauncher
57
67
  # +/opt/1C/v8.3/i386/1cv8+
58
68
  def extract_version(realpath)
59
69
  return AssLauncher::Support::Linux.get_pkg_version(realpath) if\
60
- platform.linux?
70
+ linux?
61
71
  extracted = realpath.to_s.split('/')[-3]
62
- extracted =~ /(\d+\.\d+\.?\d*\.?\d*)/i
63
- extracted = (Regexp.last_match(1).to_s.split('.')\
64
- + [0, 0, 0, 0])[0, 4].join('.')
65
- Gem::Version.new(extracted)
72
+ Gem::Version.new v8(extracted)
66
73
  end
67
74
  private :extract_version
68
75
 
76
+ def v8(extracted)
77
+ return '8.1.0.0' if extracted =~ %r{1cv81}i
78
+ extracted =~ /(\d+\.\d+\.?\d*\.?\d*)/i
79
+ (Regexp.last_match(1).to_s.split('.') + [0, 0, 0, 0])[0, 4].join('.')
80
+ end
81
+ private :v8
82
+
69
83
  # Extract arch from path
70
84
  # @note (see #extract_version)
71
- def extract_arch(realpath)
85
+ def extract_arch
72
86
  if linux?
73
- extracted = realpath.to_s.split('/')[-2]
87
+ extracted = path.to_s.split('/')[-2]
74
88
  else
75
- extracted = 'i386'
89
+ extracted = version64? ? X86_64 : I386
76
90
  end
77
91
  extracted
78
92
  end
79
93
  private :extract_arch
80
94
 
95
+ def version64?
96
+ V64_FILES.each do |f|
97
+ return true if version64_exist?(f)
98
+ end
99
+ false
100
+ end
101
+ private :version64?
102
+
103
+ def version64_exist?(file)
104
+ File.exist?(File.join(path.dirname, file))
105
+ end
106
+ private :version64_exist?
107
+
81
108
  # Compare wrappers on version for sortable
82
109
  # @param other [BinaryWrapper]
83
110
  # @return [Bollean]
@@ -0,0 +1,23 @@
1
+ module AssLauncher::Enterprise::CliDef
2
+ restrict '/TESTCLIENT'
3
+
4
+ group :debug do
5
+ mode :webclient, :enterprise do
6
+ flag '/TESTCLIENT',
7
+ 'запуск в качестве объекта автоматизированного тестирования.'\
8
+ ' Для идентификации конкретного экземпляра веб-клиента следует'\
9
+ ' использовать параметр TestClientID' do
10
+ num '-TPort', 'Номер TCP порта. По умолчанию 1538'\
11
+ ' Не используется в вэб-клиенте!'
12
+ end
13
+ end
14
+ end
15
+
16
+ group :packge_mode do
17
+ mode :designer do
18
+ change '/CheckConfig' do
19
+ flag '-CheckUseSynchronousCalls', 'проверять синхронные вызовы'
20
+ end
21
+ end
22
+ end
23
+ end
@@ -17,7 +17,8 @@ module AssLauncher::Enterprise::CliDef
17
17
  mode :designer do
18
18
  flag '/ConfigurationRepositoryCreate',
19
19
  'создание хранилища конфигурации' do
20
- flag '-AllowConfigurationChanges', ''
20
+ flag '-AllowConfigurationChanges', 'включет возможность изменения'\
21
+ ' конфигурации находящейся на поддержке'
21
22
  chose '-ChangesAllowedRule',
22
23
  'устанавливает правило поддержки для объектов для которых'\
23
24
  ' изменения разрешены поставщиком',
@@ -2,7 +2,16 @@
2
2
  require 'ass_launcher/enterprise/ole/win32ole'
3
3
  #
4
4
  module AssLauncher
5
- #
5
+ class Configuration
6
+ # Forcing to use inproc x86_64 1C Ole server in x86_64 Ruby.
7
+ attr_writer :use_x86_64_ole
8
+
9
+ # Forcing to use inproc x86_64 1C Ole server in x86_64 Ruby.
10
+ def use_x86_64_ole?
11
+ @use_x86_64_ole ||= false
12
+ end
13
+ end
14
+
6
15
  module Enterprise
7
16
  #
8
17
  module Ole
@@ -138,10 +147,19 @@ module AssLauncher
138
147
  # (see AbstractAssOleBinary#initialize)
139
148
  def initialize(requirement)
140
149
  super requirement
141
- fail "v8x.COMConnector unavailable for #{arch} Ruby" unless\
142
- x32_arch?
150
+ fail unstable if failure_unstable?
151
+ end
152
+
153
+ def failure_unstable?
154
+ ruby_x86_64? && !AssLauncher.config.use_x86_64_ole?
143
155
  end
144
156
 
157
+ def unstable
158
+ "v8x.COMConnector is unstable in #{arch} Ruby.\n"\
159
+ "Set `AssLauncher.config.use_x86_64_ole' for bypass this failure."
160
+ end
161
+ private :unstable
162
+
145
163
  def arch
146
164
  RbConfig::CONFIG['arch']
147
165
  end
@@ -150,6 +168,10 @@ module AssLauncher
150
168
  X32_ARCHS.include? arch
151
169
  end
152
170
 
171
+ def ruby_x86_64?
172
+ !x32_arch?
173
+ end
174
+
153
175
  def binary
154
176
  BINARY
155
177
  end
@@ -169,7 +191,9 @@ module AssLauncher
169
191
  private :clsids
170
192
 
171
193
  def _binary_wrapper
172
- Enterprise.thick_clients(requirement.to_s).sort.last
194
+ Enterprise.thick_clients(requirement.to_s).select do |bw|
195
+ bw.x86_64? == ruby_x86_64?
196
+ end.sort.last
173
197
  end
174
198
  private :_binary_wrapper
175
199
 
@@ -18,7 +18,7 @@ module AssLauncher
18
18
  class Error < StandardError; end
19
19
  class ParseError < StandardError; end
20
20
  # Commonn connection string fields
21
- COMMON_FIELDS = %w(Usr Pwd LicDstr prmod Locale Zn)
21
+ COMMON_FIELDS = %w(Usr Pwd LicDstr prmod Locale Zn Uc)
22
22
  # Fields for server-infobase
23
23
  SERVER_FIELDS = %w(Srvr Ref)
24
24
  # Fields for file-infobase
@@ -31,10 +31,18 @@ module AssLauncher
31
31
  # Fields for makes server-infobase
32
32
  IB_MAKER_FIELDS = %w(DBMS DBSrvr DB
33
33
  DBUID DBPwd SQLYOffs
34
- CrSQLDB SchJobDn SUsr SPwd)
34
+ CrSQLDB SchJobDn SUsr SPwd
35
+ DBFormat DBPageSize)
35
36
  # Values for DBMS field
36
37
  DBMS_VALUES = %w(MSSQLServer PostgreSQL IBMDB2 OracleDatabase)
37
38
 
39
+ # Values for DBPageSize
40
+ DB_PAGE_SIZE_VALUES = %w{4k , 8k, 16k, 32k, 64k}
41
+
42
+ # Values for DBFormat
43
+ DB_FORMAT_VALUES = %w{8.2.14 8.3.8}
44
+
45
+
38
46
  # Analyzes connect string and build suitable class
39
47
  # @param connstr (see parse)
40
48
  # @return [Server | File | Http] instanse
@@ -268,7 +276,7 @@ module AssLauncher
268
276
  # :createinfibase runmode
269
277
  # @todo validte createinfibase params
270
278
  def createinfobase_cmd
271
- to_s
279
+ to_s(fields - %w{Usr Pwd})
272
280
  end
273
281
 
274
282
  # Build string suitable for Ole objects connecting.
@@ -282,6 +290,16 @@ module AssLauncher
282
290
  [createinfobase_cmd.gsub(%r{=\s*"},"='").gsub(%r{"\s*;},"';")]
283
291
  end
284
292
 
293
+ # (see DB_PAGE_SIZE_VALUES)
294
+ def dbpagesize=(value)
295
+ @dbpagesize = valid_value(value, DB_PAGE_SIZE_VALUES)
296
+ end
297
+
298
+ # (see DB_FORMAT_VALUES)
299
+ def dbformat=(value)
300
+ @dbformat = valid_value(value, DB_FORMAT_VALUES)
301
+ end
302
+
285
303
  # (see DBMS_VALUES)
286
304
  def dbms=(value)
287
305
  @dbms = valid_value(value, DBMS_VALUES)
@@ -63,6 +63,7 @@ module AssLauncher
63
63
  l
64
64
  end
65
65
  end
66
+
66
67
  module Support
67
68
  # Shell utils for run 1C:Enterprise binary
68
69
  module Shell
@@ -102,8 +103,8 @@ module AssLauncher
102
103
  private :process_holder=
103
104
  private :ass_out_file
104
105
  DEFAULT_OPTIONS = { silent_mode: true,
105
- capture_assout: true
106
- }
106
+ capture_assout: true,
107
+ disable_auto_check_version: true}.freeze
107
108
  # @param cmd [String] path to 1C binary
108
109
  # @param args [Array] arguments for 1C binary
109
110
  # @option options [String] :assout_encoding encoding for assoutput file.
@@ -115,12 +116,13 @@ module AssLauncher
115
116
  # Default true
116
117
  # @raise [ArgumentError] when +capture_assout: true+ and +args+
117
118
  # include +/OUT+ parameter
119
+ # @api private
118
120
  def initialize(cmd, args = [], options = {})
119
121
  @options = DEFAULT_OPTIONS.merge(options).freeze
120
122
  @cmd = cmd
121
123
  @args = args
122
124
  validate_args
123
- @args += _silent_mode
125
+ @args += (_silent_mode + _disable_auto_check_version)
124
126
  @ass_out_file = _ass_out_file
125
127
  end
126
128
 
@@ -159,6 +161,15 @@ module AssLauncher
159
161
  ProcessHolder.run(self, options)
160
162
  end
161
163
 
164
+ def _disable_auto_check_version
165
+ if options[:disable_auto_check_version]
166
+ ['/AppAutoCheckVersion-', '']
167
+ else
168
+ []
169
+ end
170
+ end
171
+ private :_disable_auto_check_version
172
+
162
173
  def _silent_mode
163
174
  if options[:silent_mode]
164
175
  ['/DisableStartupDialogs', '',
@@ -194,6 +205,9 @@ module AssLauncher
194
205
  encode_out(err), ass_out_file.read)
195
206
  end
196
207
 
208
+ # @todo It's stub returns +out+ directly
209
+ # but may be require encoding out
210
+ # encoding must executed in try block
197
211
  def encode_out(out)
198
212
  out
199
213
  end
@@ -377,7 +391,13 @@ module AssLauncher
377
391
  @file = Tempfile.new('ass_out')
378
392
  @file.close
379
393
  @path = platform.path(@file.path)
380
- @encoding = encoding || Encoding::CP1251
394
+ @encoding = encoding || detect_ass_encoding
395
+ end
396
+
397
+ # @todo It's stub returns the CP1251 encoding
398
+ # but requires to detect 1C out encoding automatically
399
+ def detect_ass_encoding
400
+ Encoding::CP1251
381
401
  end
382
402
 
383
403
  def to_s
@@ -391,10 +411,17 @@ module AssLauncher
391
411
  s.encode! Encoding::UTF_8, encoding unless linux?
392
412
  ensure
393
413
  @file.close
394
- @file.unlink
414
+ try_unlink
395
415
  end
396
416
  s.to_s
397
417
  end
418
+
419
+ # File can be busy
420
+ def try_unlink
421
+ @file.unlink if @file
422
+ rescue Errno::EBUSY
423
+ # NOP
424
+ end
398
425
  end
399
426
  end
400
427
  end
@@ -152,10 +152,9 @@ module AssLauncher
152
152
  @result = command.exit_handling(exitstatus,\
153
153
  stdout.read,\
154
154
  stderr.read)
155
- rescue StandardError => e
156
- @result = e
155
+ ensure
156
+ self.class.send(:unreg_process, self)
157
157
  end
158
- self.class.send(:unreg_process, self)
159
158
  end
160
159
  end
161
160
  private :wait_process_in_thread
@@ -1,5 +1,5 @@
1
1
  module AssLauncher
2
- VERSION = "0.3.4"
2
+ VERSION = "0.4.0"
3
3
  module KNOWN_ENTERPRISE_VERSIONS
4
4
  require 'ass_launcher/enterprise/cli_defs_loader'
5
5
  extend AssLauncher::Enterprise::CliDefsLoader
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ass_launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Vlasov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-29 00:00:00.000000000 Z
11
+ date: 2018-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inifile
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: methadone
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.9'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: addressable
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -56,42 +56,56 @@ dependencies:
56
56
  name: clamp
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '1.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: colorize
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '0.8'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '0.8'
83
+ - !ruby/object:Gem::Dependency
84
+ name: io-console
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.4.6
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.4.6
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: command_line_reporter
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ">="
101
+ - - "~>"
88
102
  - !ruby/object:Gem::Version
89
103
  version: '3.0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ">="
108
+ - - "~>"
95
109
  - !ruby/object:Gem::Version
96
110
  version: '3.0'
97
111
  - !ruby/object:Gem::Dependency
@@ -126,30 +140,30 @@ dependencies:
126
140
  name: minitest
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - ">="
143
+ - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: '0'
145
+ version: '5.11'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - ">="
150
+ - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: '0'
152
+ version: '5.11'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: pry
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - ">="
157
+ - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '0'
159
+ version: '0.11'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - ">="
164
+ - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '0'
166
+ version: '0.11'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: mocha
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -168,30 +182,30 @@ dependencies:
168
182
  name: simplecov
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - ">="
185
+ - - "~>"
172
186
  - !ruby/object:Gem::Version
173
- version: '0'
187
+ version: '0.15'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - ">="
192
+ - - "~>"
179
193
  - !ruby/object:Gem::Version
180
- version: '0'
194
+ version: '0.15'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: coderay
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
- - - ">="
199
+ - - "~>"
186
200
  - !ruby/object:Gem::Version
187
- version: '0'
201
+ version: '1.1'
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
- - - ">="
206
+ - - "~>"
193
207
  - !ruby/object:Gem::Version
194
- version: '0'
208
+ version: '1.1'
195
209
  description: Don't ask why this necessary. Believe this necessary!
196
210
  email:
197
211
  - leoniv.vlasov@gmail.com
@@ -253,6 +267,7 @@ files:
253
267
  - lib/ass_launcher/enterprise/cli_def/8.2.17.rb
254
268
  - lib/ass_launcher/enterprise/cli_def/8.2.18.rb
255
269
  - lib/ass_launcher/enterprise/cli_def/8.3.10.rb
270
+ - lib/ass_launcher/enterprise/cli_def/8.3.11.rb
256
271
  - lib/ass_launcher/enterprise/cli_def/8.3.3.rb
257
272
  - lib/ass_launcher/enterprise/cli_def/8.3.4.rb
258
273
  - lib/ass_launcher/enterprise/cli_def/8.3.5.rb
@@ -279,7 +294,7 @@ licenses:
279
294
  - MIT
280
295
  metadata:
281
296
  known_enterprise_versions: 8.2.17, 8.2.18, 8.3.3, 8.3.4, 8.3.5, 8.3.6, 8.3.7, 8.3.8,
282
- 8.3.9, 8.3.10
297
+ 8.3.9, 8.3.10, 8.3.11
283
298
  post_install_message:
284
299
  rdoc_options: []
285
300
  require_paths: