use_salesforce_dataloader 0.0.8 → 0.0.9

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
  SHA256:
3
- metadata.gz: 8ddaf30c25c5ec5c092d0de40e2477b622bfb441eae8fd9556432de57a19498d
4
- data.tar.gz: 6f2c3c603164383be7326b7690d104cbbd394882476fe1e96b74234896b38916
3
+ metadata.gz: 8c205f7edd003200ca037bfc483f4ba77f9dbf5e32e2295462b3329a99fe6c5c
4
+ data.tar.gz: 13ad28263df44bf81a189335010dec9af3841d26b8e6e3c131889655e4112b72
5
5
  SHA512:
6
- metadata.gz: 5e909679727ea08bc3f7e84c885821ba38e6241fbdaffe70cba12510fcf860d20c388fd0e772f721d4eb7ad29de30be17a7321d13a05cdb713c043ea0034d763
7
- data.tar.gz: 7cdbe099b7a94449b8fe637246f78e16c6d78b417a0ab2a9ccc09430938784571e88db077cf653fa2d50fe3c2007861654a9b3d7eeb35d08c77a586619bd27a9
6
+ metadata.gz: ba23a81b62c2bf774f81bec39652650ef97ac719a84771070befd24539077f08a1806d3bfd1bb1c629e56ab6e147c95bd7ca83e6d74b703da6de3c275bb6fd8a
7
+ data.tar.gz: 196ae184ecb6f452500912368be2c3d51477c9cf7ddca80db805b78ea58b13cfecddf822d5937ba1cf9d4e91fd3a88e6ad72785c142e2ca99846e0702fb0a923
@@ -9,7 +9,7 @@ require 'open3'
9
9
  # - <tt>map.sdl</tt>
10
10
  #
11
11
  class UseSalesforceDataLoader
12
- VERSION = '0.0.8'
12
+ VERSION = '0.0.9'
13
13
 
14
14
  # Setter for <tt>@conf_dir</tt>, set values <tt>@conf_key_file</tt>, <tt>@conf_process_xml_file</tt> and <tt>@conf_map_file</tt> at the same time.
15
15
  def conf_dir=(path)
@@ -76,9 +76,10 @@ class UseSalesforceDataLoader
76
76
  # @param java [String] path of java runtime.
77
77
  # @param java_opt [String] command line option for java runtime.
78
78
  # @example
79
- # UseSalesforceDataLoader.new('/usr/lib/dataloader-41.0.0-uber.jar', '/usr/bin/java', '-Dfile.encoding=UTF-8')
79
+ # UseSalesforceDataLoader.new('/usr/lib/dataloader-42.0.0-uber.jar', '/usr/bin/java', '-Dfile.encoding=UTF-8')
80
80
  #
81
- def initialize(jar, java = nil, java_opt = nil)
81
+ def initialize(jar, java = nil, java_opt = nil, dataloader_major_version: 42)
82
+ @dataloader_major_version = dataloader_major_version
82
83
  java = exec_command('which java') unless java
83
84
  path_check(java)
84
85
  path_check(jar)
@@ -108,11 +109,14 @@ class UseSalesforceDataLoader
108
109
  # @see #conf_key_file
109
110
  # @return [String] conf_key_file
110
111
  def save_conf_key_file
111
- @conf_key_file.tap do |f|
112
- open(f, 'w:UTF-8') do |o|
112
+ if @dataloader_major_version < 43
113
+ open(@conf_key_file, 'w:UTF-8') do |o|
113
114
  o.print encrypt("-g #{text_seed}")
114
115
  end
116
+ else
117
+ encrypt("-k '#{@conf_key_file}'")
115
118
  end
119
+ @conf_key_file
116
120
  end
117
121
 
118
122
  # Save conf xml file
@@ -137,34 +141,38 @@ class UseSalesforceDataLoader
137
141
  .join
138
142
  .chomp
139
143
  PROCESS_XML_TEMPLATE % [@bean_id,
140
- @bean_descrption,
144
+ @bean_description,
141
145
  @property_name,
142
146
  entries_xml]
143
147
  end
144
148
 
145
149
  # @note
146
150
  #
147
- # Original:
148
- #
149
- # dataloader/bin/encrypt.sh
150
- #
151
- # Usage: dataloader/bin/encrypt.sh
152
- #
153
- # Utility to encrypt a string based on a static or a provided key
154
- #
155
- # Options (mutually exclusive - use one at a time):
156
- #
157
- # -g <seed text> Generate key based on seed
151
+ # ref. https://github.com/forcedotcom/dataloader/commit/dda55319ebf741b3fc3e2baf45d49b82e598f2fa#diff-8943e367622f270c051690266c3b9d44
158
152
  #
159
- # -v <encrypted> <decrypted value> [Path to Key] Validate whether decryption of encrypted value matches the decrypted value, optionally provide key file
153
+ # $ java -cp ./lib/dataloader-43.0.0-uber.jar com.salesforce.dataloader.security.EncryptionUtil
154
+ # Utility to encrypt a string based on a static or a provided key
155
+ # Options (mutually exclusive - use one at a time):
156
+ # -e <plain text> <Path to keyfile> Encrypt a plain text value, keyfile path
157
+ # -d <encryptText> <Path to keyfile> Decrypt an encrypted text back to plain text value using keyfile
158
+ # -k [Path to Keyfile] Generate keyfile with optional keyfile path
160
159
  #
161
- # -e <plain text> [Path to Key] Encrypt a plain text value, optionally provide key file (generate key using option -g)
160
+ # $ java -cp ./lib/dataloader-42.0.0-uber.jar com.salesforce.dataloader.security.EncryptionUtil
161
+ # Utility to encrypt a string based on a static or a provided key
162
+ # Options (mutually exclusive - use one at a time):
163
+ # -g <seed text> Generate key based on seed
164
+ # -v <encrypted> <decrypted value> [Path to Key] Validate whether decryption of encrypted value matches the decrypted value, optionally provide key file
165
+ # -e <plain text> [Path to Key] Encrypt a plain text value, optionally provide key file (generate key using option -g)
162
166
  #
163
167
  # internal use
164
168
  # @param [String] options
165
169
  # @return [String]
166
170
  def encrypt(options)
167
- cmd = "#{@encrypt} #{options} | sed 's/^.*) \- //g'"
171
+ cmd = if @dataloader_major_version < 43
172
+ "#{@encrypt} #{options} | sed 's/^.*) \- //g'"
173
+ else
174
+ "#{@encrypt} #{options} | tail -1"
175
+ end
168
176
  exec_command(cmd)
169
177
  end
170
178
 
@@ -230,6 +238,7 @@ PROCESS_XML
230
238
  ENTRIES_XML
231
239
 
232
240
  # @note internal use
241
+ # ref. https://developer.salesforce.com/docs/atlas.en-us.dataLoader.meta/dataLoader/loader_params.htm
233
242
  BASE_ENTRIES = {
234
243
  'dataAccess.readUTF8' => 'true',
235
244
  'dataAccess.writeUTF8' => 'true',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_salesforce_dataloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroaki Nagoya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-20 00:00:00.000000000 Z
11
+ date: 2018-06-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: hnagoya@gmail.com
@@ -37,7 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  version: '0'
38
38
  requirements: []
39
39
  rubyforge_project:
40
- rubygems_version: 2.7.3
40
+ rubygems_version: 2.7.6
41
41
  signing_key:
42
42
  specification_version: 4
43
43
  summary: Force.com Apex Data Loader for Ruby/Linux - command line version