ass_ole-app_extension 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fcdaf113e3cb1f775dbb0cf05caac34f5f3c291
4
- data.tar.gz: 350cd6db69d1d4f7e2320be5c9b165bc35d84b21
3
+ metadata.gz: 97cd547546dc7e68313af12ae6b24a4855ea38ee
4
+ data.tar.gz: c1ba225b2710175c649ebb5349ac940477712d3a
5
5
  SHA512:
6
- metadata.gz: bd0fac451578a2fc937ecd9a552e9fba7c8539fde0ba04f71ca1db01a1cd28a42c638a69619ce3c934a3657820d60125013909cc657cd9a2f0011206ca5d2807
7
- data.tar.gz: 3c8bd1fb20bc767c5a9e009b1dff089eb2c3671ce9be865b796d3b709140ab634388c6be46b55afb6007afc4c8b3c0c8120fb93d30b561b229ba57871141265d
6
+ metadata.gz: bd427278ce77d652bb98f680640fc33380c9cb296e6878b0fc2c551ce469f5c5a2a51e19f0e29b0880303b0e0261307bb749737720fd1483d605d0a9194a83af
7
+ data.tar.gz: 8e33282e82393f9732da593c0b512424fbe8e2a24cc31310cbfae71f545c68ed75786011ce47a619fa5b408d18ff7743d0ad59dbc76933f29734ed5b709c0741
data/README.md CHANGED
@@ -99,6 +99,20 @@ AssOle::AppExtension::Spy.explore(ib).each do |spy|
99
99
  end
100
100
  ```
101
101
 
102
+ 4. Convert xml extension source to `.cfe` binary file
103
+
104
+ ```ruby
105
+ src = AssOle::AppExtension::Src::Xml.new('foo_ext/xml.src', '~> 8.3.9')
106
+ src.to_binary('foo_ext.cfe') #=> 'foo_ext.cfe'
107
+ ```
108
+
109
+ 5. Convert `.cfe` extension binary file to xml files
110
+
111
+ ```ruby
112
+ src = AssOle::AppExtension::Src::Cfe.new('foo_ext.cfe', '~> 8.3.9')
113
+ src.to_xml('foo_ext/xml.src') #=> 'foo_ext/xml.src'
114
+ ```
115
+
102
116
  ## Development
103
117
 
104
118
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency 'ass_ole'
24
24
  spec.add_dependency 'ass_ole-snippets-shared', '~> 0.5'
25
- spec.add_dependency "ass_maintainer-info_base"
25
+ spec.add_dependency "ass_maintainer-info_bases"
26
26
 
27
27
  spec.add_development_dependency "bundler", "~> 1.15"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
@@ -491,5 +491,7 @@ module AssOle
491
491
  def self.plug(info_base, ext_klass, safe_mode = true)
492
492
  Plug.new(info_base).exec(ext_klass, safe_mode)
493
493
  end
494
+
495
+ require 'ass_ole/app_extension/src'
494
496
  end
495
497
  end
@@ -0,0 +1,93 @@
1
+ module AssOle
2
+ module AppExtension
3
+ # Provides classes for working with application extension sources like a
4
+ # +.cfe+ file or +xml+ files
5
+ module Src
6
+ require 'ass_maintainer/info_bases/tmp_info_base'
7
+ # @abstract
8
+ class Abstract
9
+ include AssMaintainer::InfoBases::TmpInfoBase::Api
10
+
11
+ attr_reader :path, :platform_require
12
+
13
+ # @param path [String] path to extension source
14
+ # @param platform_require [String] requirement for 1C:Enterprise
15
+ # platform version
16
+ def initialize(path, platform_require = '~> 8.3.8')
17
+ path_set(path)
18
+ @platform_require = platform_require
19
+ end
20
+
21
+ def path_set(path)
22
+ @path = path
23
+ fail ArgumentError, "Path not exist: #{path}" unless File.exist? path
24
+ end
25
+ private :path_set
26
+ end
27
+
28
+ # Class for extension +xml+ files source
29
+ # @example Convert xml extension source to +.cfe+ binary file
30
+ # src = AssOle::AppExtension::Src::Xml.new('foo_ext/xml.src', '~> 8.3.9')
31
+ # src.to_binary('foo_ext.cfe') #=> 'foo_ext.cfe'
32
+ class Xml < Abstract
33
+ def path_set(path)
34
+ super
35
+ fail ArgumentError, "Invalid extension xml source: `#{path}'" unless\
36
+ File.file? root_file
37
+ end
38
+ private :path_set
39
+
40
+ # Build binary +.cfe+ file from +xml+ source
41
+ # @param dest_path [String] +.cfe+ file path
42
+ def to_binary(dest_path)
43
+ src_path = path
44
+ with_tmp_ib platform_require: platform_require do |ib|
45
+ ib.designer do
46
+ _loadConfigFromFiles src_path do
47
+ _Extension 'WTF1C'
48
+ end
49
+ end.run.wait.result.verify!
50
+
51
+ ib.designer do
52
+ _DumpCfg dest_path do
53
+ _Extension 'WTF1C'
54
+ end
55
+ end.run.wait.result.verify!
56
+ end
57
+ dest_path
58
+ end
59
+
60
+ # @return [String] path to +Configuration.xml+ root file
61
+ def root_file
62
+ File.join(path, 'Configuration.xml')
63
+ end
64
+ end
65
+
66
+ # Class for extension +.cfe+ binary file
67
+ # @example Convert +.cfe+ extension binary file to xml files
68
+ # src = AssOle::AppExtension::Src::Cfe.new('foo_ext.cfe', '~> 8.3.9')
69
+ # src.to_xml('foo_ext/xml.src') #=> 'foo_ext/xml.src'
70
+ class Cfe < Abstract
71
+ # Disassemble binary +.cfe+ to +xml+ source
72
+ # @param dest_path [String] +xml+ sorce dir
73
+ def to_xml(dest_path)
74
+ src_path = path
75
+ with_tmp_ib platform_require: platform_require do |ib|
76
+ ib.designer do
77
+ _loadCfg src_path do
78
+ _Extension 'WTF1C'
79
+ end
80
+ end.run.wait.result.verify!
81
+
82
+ ib.designer do
83
+ _DumpConfigToFiles dest_path do
84
+ _Extension 'WTF1C'
85
+ end
86
+ end.run.wait.result.verify!
87
+ end
88
+ dest_path
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -1,5 +1,5 @@
1
1
  module AssOle
2
2
  module AppExtension
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ass_ole-app_extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Vlasov
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.5'
41
41
  - !ruby/object:Gem::Dependency
42
- name: ass_maintainer-info_base
42
+ name: ass_maintainer-info_bases
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -154,6 +154,7 @@ files:
154
154
  - bin/console
155
155
  - bin/setup
156
156
  - lib/ass_ole/app_extension.rb
157
+ - lib/ass_ole/app_extension/src.rb
157
158
  - lib/ass_ole/app_extension/version.rb
158
159
  homepage: https://github.com/leoniv/ass_ole-app_extension
159
160
  licenses: []