bulk_ops 0.1.7 → 0.1.8

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: 4cd7f0776712d0ce3a2434c044def2e48b22a9205aa7fe72cea6dde32e60142d
4
- data.tar.gz: 706abceb8ddcea1ba1d876135f32c334693eb6edbf6b529b5baf287f1d1f2e25
3
+ metadata.gz: 4231e72e9eca7cf205487d52f2613ef8542e37789c117070cb7402cf489f77da
4
+ data.tar.gz: d788d06b28f38ff386578ef962a14b0e8cc9525f5bb408daa13c4d38ded94e7a
5
5
  SHA512:
6
- metadata.gz: 5a243cc191391eb59645b8ced1ff5752945f98744ad0e6c51f94fa0c78e1949b28b186c1078b80e6e17e00098185a6fea69728543942f7c9f1c146849773fc38
7
- data.tar.gz: 4fd360260733508e0ffb219ecabc156bc236bf6e90fcda0e8510f59dd019c4928c83b6e2af900f34983f50663e6b18e7e12c00281f65d0972b51c8c9ae89e760
6
+ metadata.gz: b86b3ddb3e462d2b6a098dbcea45a4945e31f88f135e6780eaa84fd908ff238a75f170bb05af3e093d46dab6e7bc52ce59cd6176aa29bc2da2df547866175425
7
+ data.tar.gz: 54be897f9392fe0e19fc85350ef57d2a1c503d65ff5cb7cbbea44efc6615573fa58d50d61d7e31e323a5271b1d6470dc1d9cddac3998a8d7b1de79195c097733
@@ -110,6 +110,7 @@ module BulkOps
110
110
  work_proxies.create(status: "queued",
111
111
  last_event: DateTime.now,
112
112
  row_number: row_number,
113
+ visibility: options['visibility'],
113
114
  message: "created during ingest initiated by #{user.name || user.email}")
114
115
  end
115
116
  # make sure the work proxies we just created are loaded in memory
@@ -124,7 +125,7 @@ module BulkOps
124
125
  user.email,
125
126
  data,
126
127
  proxy.id,
127
- proxy.visibility || "open")
128
+ proxy.visibility)
128
129
  end
129
130
  # If any errors have occurred, make sure they are logged in github and users are notified.
130
131
  report_errors!
@@ -191,7 +192,7 @@ module BulkOps
191
192
  user.email,
192
193
  data,
193
194
  proxy.id,
194
- proxy.visibility || "private")
195
+ proxy.visibility)
195
196
  end
196
197
  report_errors!
197
198
  end
@@ -230,20 +231,11 @@ module BulkOps
230
231
  unless options.blank?
231
232
  full_options = YAML.load_file(File.join(bulk_ops_dir,TEMPLATE_DIR, BulkOps::GithubAccess::OPTIONS_FILENAME))
232
233
 
233
- puts "Creating new bulk_ops options"
234
- puts "new options:"
235
- puts options.inspect
236
- puts "standard options:"
237
- puts full_options.inspect
238
-
239
234
  options.each { |option, value| full_options[option] = value }
240
235
 
241
236
  full_options[name] = name
242
237
  full_options[type] = type
243
238
  full_options[status] = status
244
-
245
- puts "final options:"
246
- puts full_options.inspect
247
239
 
248
240
  git.update_options full_options
249
241
  end
@@ -267,8 +259,8 @@ module BulkOps
267
259
  git.update_spreadsheet(file, message: message)
268
260
  end
269
261
 
270
- def update_options filename, message=nil
271
- git.update_options(filename, message: message)
262
+ def update_options options, message=nil
263
+ git.update_options(options, message: message)
272
264
  end
273
265
 
274
266
  def options
@@ -1,3 +1,3 @@
1
1
  module BulkOps
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -44,8 +44,9 @@ class BulkOps::WorkJob < ActiveJob::Base
44
44
  @work_proxy.operation.check_if_finished
45
45
  end
46
46
 
47
- def perform(workClass,user_email,attributes,work_proxy_id,visibility="private")
47
+ def perform(workClass,user_email,attributes,work_proxy_id,visibility=nil)
48
48
  update_status "starting", "Initializing the job"
49
+ attributes['visibility']= visibility if visibility.present?
49
50
  @work_proxy = BulkOps::WorkProxy.find(work_proxy_id)
50
51
  unless @work_proxy
51
52
  report_error("Cannot find work proxy with id: #{work_proxy_id}")
@@ -61,7 +62,7 @@ class BulkOps::WorkJob < ActiveJob::Base
61
62
  return
62
63
  end
63
64
  else # The work is not found in Solr. If we're trying to update a work, we're in trouble.
64
- if (type == "update")
65
+ if (type.to_s == "update")
65
66
  report_error "Could not find work to update with id: #{@work_proxy.work_id}"
66
67
  return
67
68
  end
@@ -154,7 +154,6 @@ class BulkOps::WorkProxy < ActiveRecord::Base
154
154
 
155
155
  remove = field_name.downcase.starts_with?("remove") || field_name.downcase.starts_with?("delete")
156
156
 
157
-
158
157
  # handle multiple values
159
158
  value_array = split_values(value)
160
159
  controlled_data[field_name_norm] ||= [] unless value_array.blank?
@@ -164,13 +163,13 @@ class BulkOps::WorkProxy < ActiveRecord::Base
164
163
  value.strip!
165
164
  if value =~ /^#{URI::regexp}$/ and !field_name.downcase.ends_with?("label")
166
165
  id = value
167
- label = WorkIndexer.fetch_remote_label(value)
168
- error_message = "cannot fetch remote label for url: #{value}"
169
- report_error( :cannot_retrieve_label , error_message, url: value, row_number: row_number) unless label
166
+ # label = WorkIndexer.fetch_remote_label(value)
167
+ # error_message = "cannot fetch remote label for url: #{value}"
168
+ # report_error( :cannot_retrieve_label , error_message, url: value, row_number: row_number) unless label
170
169
  else
171
170
  # It's a label, so get the id
172
171
  id = get_remote_id(value, property: field_name_norm, authority: authority) || localAuthUrl(field_name_norm, value)
173
- label = value
172
+ # label = value
174
173
  report_error(:cannot_retrieve_url,
175
174
  message: "cannot find or create url for controlled vocabulary label: #{value}",
176
175
  url: value,
@@ -385,20 +384,21 @@ class BulkOps::WorkProxy < ActiveRecord::Base
385
384
  return nil unless (entries = Qa::Authorities::Local.subauthority_for(auth).search(value))
386
385
  entries.each do |entry|
387
386
  #require exact match
388
- next unless entry["label"] == value
387
+ next unless entry["label"].encode('UTF-8') == value.encode('UTF-8')
389
388
  url = entry["url"]
390
389
  url ||= entry["id"]
391
- url = localIdToUrl(url,auth) unless url =~ URI::regexp
390
+ # url = localIdToUrl(url,auth) unless url =~ URI::regexp
392
391
  return url
393
392
  end
394
393
  return nil
395
394
  end
396
395
 
397
396
  def localIdToUrl(id,auth_name)
398
- hostname = Socket.gethostname
399
- hostname = "localhost" unless hostname.include?('.')
400
- protocol = (Rails.env == "production") ? "https" : "http"
401
- return "#{protocol}://#{hostname}/authorities/show/local/#{auth_name}/#{id}"
397
+ root_urls = {production: "https://digitalcollections.library.ucsc.edu",
398
+ staging: "http://digitalcollections-staging.library.ucsc.edu",
399
+ development: "http://#{Socket.gethostname}",
400
+ test: "http://#{Socket.gethostname}"}
401
+ return "#{root_urls[Rails.env.to_sym]}/authorities/show/local/#{auth_name}/#{id}"
402
402
  end
403
403
 
404
404
  def getLocalAuth(field_name)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulk_ops
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ned Henry, UCSC Library Digital Initiatives
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-25 00:00:00.000000000 Z
11
+ date: 2019-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails