kuali_toolbox 0.43 → 0.44

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: 736610fb63802017bf7aa5cc2c3fd902e9a0b52b
4
- data.tar.gz: 46984376a718e11305f1b2f8c5f4e78f4e78042b
3
+ metadata.gz: 36f892f8e86ea384eb660241e4ae94b9b5cc5b5d
4
+ data.tar.gz: 26e1990536eca7fa2f41ea631ab3f6006add0761
5
5
  SHA512:
6
- metadata.gz: d90bb807d125b12770db7d6152721cd2f7fa195c6d8e3ad89c6070d9c81e97e146f39a79fe8378479e68f1de22a123d68fe23c86d3cadd7d10595eda27b9524d
7
- data.tar.gz: f77dcc09714862c7ce1bdab1fb018fe8a89cb612b516aef27538f7d6e3870129e0b141e9aba57d164e73745e9d3ccccb0e76af4d9f14c5febc58a006b725779a
6
+ metadata.gz: 1e5dee26ad9b81d9e9bec50bf6ac2c3f900a5150f575fb340dd5781e320eb77ccfcf5554949b1f6d6e07143e46a30fcc79a56e3f05b6ac8400c30a16be322560
7
+ data.tar.gz: 683041d12e698b925c9b947e6c454b00ccc410b61e94698fea9d5cd2753fe4b404b52952b1839154aa3cb9729c95f6445cc98b29819e95a95879b56e532765d6
@@ -45,6 +45,9 @@ def self.parse_command_line_options(
45
45
  opts.on( '-l [url]', '--url [url]', 'The full URL of the HR REST API; e.g. https://localhost/kc-dev/hr-import/hrimport/import' ) do |l|
46
46
  opt[:url] = l
47
47
  end
48
+ opts.on( '-c', '--continue', 'Continue writing the output file if errors are present' ) do
49
+ opt[:continue] = true
50
+ end
48
51
  opts.on( '-h', '--help', 'Display this screen' ) do
49
52
  puts opts
50
53
  exit 1
@@ -451,9 +454,13 @@ end
451
454
 
452
455
  num_errors = number_of_errors text_parse_errors
453
456
  if num_errors > 0
454
- puts "\n#{num_errors} errors found and must be corrected.\n\n"
455
- File.unlink opt[:xml_filename]
456
- exit 1
457
+ if opt[:continue]
458
+ puts "\n#{num_errors} errors found and skipped during XML tranformation."
459
+ else
460
+ puts "\n#{num_errors} errors found and must be corrected. To save only valid records, run with the -c option.\n\n"
461
+ File.unlink opt[:xml_filename]
462
+ exit 1
463
+ end
457
464
  end
458
465
 
459
466
  puts "\nXML file written to #{opt[:xml_filename]}\n\n"
@@ -141,22 +141,10 @@ module KualiCo::ETL
141
141
  return nil
142
142
  end
143
143
 
144
- # Prepares a String for a SQL statement where single quotes need to be escaped.
145
- # @param [String] str the String to be escaped.
146
- # @return [String, nil] the resulting String with single quotes escaped with a backslash.
147
- # If a nil is passed, nil is returned.
148
- def self.escape_single_quotes(str)
149
- if str.nil?
150
- return nil
151
- end
152
- return str.to_s.gsub("'", "\\\\'")
153
- end
154
-
155
144
  # Parses a string using common parsing behavior with options. This method forms the foundation
156
145
  # of all the other parsing methods.
157
146
  # @param [String] str the String to be parsed.
158
147
  # @option opt [String, #to_s] :default the default return value if str is empty. Must respond to #to_s
159
- # @option opt [Boolean] :escape_single_quotes escape single quote characters.
160
148
  # @option opt [Integer] :length raise a TextParseError if str.length > :length.
161
149
  # @option opt [Boolean] :truncate string if longer than length.
162
150
  # @option opt [String] :name the name of the field being parsed. Used only for error handling.
@@ -170,10 +158,8 @@ module KualiCo::ETL
170
158
  # @example nil or empty inputs will return the empty String by default
171
159
  # '' == parse_string(nil) && '' == parse_string('')
172
160
  # @see valid_value
173
- # @see escape_single_quotes
174
- def self.parse_string(str, opt={ strict: true, required: false, escape_single_quotes: true })
161
+ def self.parse_string(str, opt={ strict: true, required: false })
175
162
  opt[:strict] = true if opt[:strict].nil?
176
- opt[:escape_single_quotes] = true if opt[:escape_single_quotes].nil?
177
163
  retval = encode str.to_s.strip
178
164
  if opt[:required] && retval.empty?
179
165
  raise KualiCo::ETL::error TextParseError.new "Required data element '#{opt[:name]}' not found: '#{str}'"
@@ -194,9 +180,6 @@ module KualiCo::ETL
194
180
  if opt[:valid_values] && ! valid_value(retval, opt[:valid_values], opt)
195
181
  raise KualiCo::ETL::error TextParseError.new "Illegal #{opt[:name]}: value '#{str}' not found in: #{opt[:valid_values]}"
196
182
  end
197
- if opt[:escape_single_quotes]
198
- retval = escape_single_quotes retval
199
- end
200
183
  return retval
201
184
  end
202
185
 
@@ -16,5 +16,5 @@
16
16
 
17
17
  module KualiCo
18
18
  # The gem version number.
19
- VERSION = "0.43"
19
+ VERSION = "0.44"
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuali_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.43'
4
+ version: '0.44'
5
5
  platform: ruby
6
6
  authors:
7
7
  - KualiCo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-17 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder