ddr-batch 2.0.0.beta.2 → 2.0.0.beta.3

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: 61fc23605e8881dfc9f97e122bd65400afb190d2
4
- data.tar.gz: e604d8522d0263d9b794ecb278688f48fb4e4a13
3
+ metadata.gz: edade02b9a093a2f96346cdd4c1be1a96dc72aca
4
+ data.tar.gz: 1cf48aa8494ccec2da2da86c76392c1b85269aa4
5
5
  SHA512:
6
- metadata.gz: dabddac82026a2a86c24962db9581a20307809c21f872193efb2f6489295f30a9f5bb8fa8f1273e7f4019fe39b11709a73bb7130ca822b4a5f0452a11be3a953
7
- data.tar.gz: aa86ea167a533f8203d639e7e537a1018f02537603581b81e9e75c14ba8b4196f43a1b531fdd4213236f6e1492f02dd867455d7c098452f48b7b7488f12afb59
6
+ metadata.gz: 87c19f8e727145795d87fb8e97a738049976da148b0030bf17efba95174b577c5a33224581577196a20ace8525edd8604d4b560bafe7de147f4d45545ee03136
7
+ data.tar.gz: 828a723bedeb17d3906f7ada5ea4a1b9485ecd125b60b67ef44f4e4fa20213506e576cd92bfc392254572aad55206ae28e71123320b7d2ba96f10d481762aa31
@@ -1,19 +1,25 @@
1
1
  module Ddr::Batch
2
-
3
2
  class BatchProcessorRunMailer < ActionMailer::Base
4
3
 
5
- default :from => "noreply@duke.edu"
6
-
7
4
  def send_notification(batch)
8
5
  @batch = batch
9
6
  @title = "Batch Processor Run #{@batch.status}"
10
7
  @host = `uname -n`.strip
11
8
  @subject = "[#{@host}] #{@title}"
12
- from = "#{`echo $USER`.strip}@#{@host}"
13
9
  attachments["details.txt"] = File.read(@batch.logfile.path)
14
- mail(from: from, to: @batch.user.email, subject: @subject)
10
+ mail(from: from_address, to: @batch.user.email, subject: @subject)
15
11
  end
16
12
 
17
- end
13
+ private
18
14
 
19
- end
15
+ def from_address
16
+ if Rails.application.config.action_mailer.default_options &&
17
+ addr = Rails.application.config.action_mailer.default_options[:from]
18
+ addr
19
+ else
20
+ raise Ddr::Batch::Error, 'Application config.action_mailer.default_options[:from] must be set'
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -120,7 +120,6 @@ module Ddr::Batch
120
120
  else
121
121
  verifications["Object exists in repository"] = VERIFICATION_PASS
122
122
  verifications["Object is correct model"] = verify_model(repo_object) if model
123
- # verifications["Object has correct label"] = verify_label(repo_object) if label
124
123
  unless batch_object_attributes.empty?
125
124
  batch_object_attributes.each do |a|
126
125
  if a.operation == BatchObjectAttribute::OPERATION_ADD
@@ -157,10 +156,6 @@ module Ddr::Batch
157
156
  end
158
157
  end
159
158
 
160
- # def verify_label(repo_object)
161
- # repo_object.label.eql?(label) ? VERIFICATION_PASS : VERIFICATION_FAIL
162
- # end
163
- #
164
159
  def verify_attribute(repo_object, attribute)
165
160
  verified = case attribute.datastream
166
161
  when 'descMetadata'
@@ -4,9 +4,9 @@ module Ddr::Batch
4
4
 
5
5
  belongs_to :batch_object, :inverse_of => :batch_object_datastreams
6
6
 
7
- DATASTREAMS = [ Ddr::Datastreams::CONTENT,
8
- Ddr::Datastreams::DESC_METADATA,
9
- Ddr::Datastreams::STRUCT_METADATA ]
7
+ DATASTREAMS = [ Ddr::Models::File::CONTENT,
8
+ Ddr::Models::File::DESC_METADATA,
9
+ Ddr::Models::File::STRUCT_METADATA ]
10
10
 
11
11
  OPERATION_ADD = "ADD" # add this datastream to the object -- considered an error if datastream already exists
12
12
  OPERATION_ADDUPDATE = "ADDUPDATE" # add this datastream to or update this datastream in the object
@@ -44,7 +44,6 @@ module Ddr::Batch
44
44
  event.detail = ingest_outcome_detail.join("\n")
45
45
  event.save!
46
46
  end
47
- update_attributes(:pid => repo_object.pid)
48
47
  verifications = verify_repository_object
49
48
  verification_outcome_detail = []
50
49
  verified = true
@@ -76,8 +75,8 @@ module Ddr::Batch
76
75
  repo_object = nil
77
76
  begin
78
77
  repo_object = model.constantize.new(:id => repo_pid)
79
- # repo_object.label = label if label
80
78
  repo_object.save(validate: false)
79
+ update_attributes(:pid => repo_object.pid)
81
80
  batch_object_attributes.each { |a| repo_object = add_attribute(repo_object, a) }
82
81
  batch_object_datastreams.each { |d| repo_object = populate_datastream(repo_object, d) }
83
82
  batch_object_relationships.each { |r| repo_object = add_relationship(repo_object, r) }
@@ -94,6 +93,7 @@ module Ddr::Batch
94
93
  else
95
94
  repo_clean = true
96
95
  end
96
+ update_attributes(pid: nil)
97
97
  else
98
98
  repo_clean = true
99
99
  end
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Batch
3
- VERSION = "2.0.0.beta.2"
3
+ VERSION = "2.0.0.beta.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddr-batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.2
4
+ version: 2.0.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Coble
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-09 00:00:00.000000000 Z
12
+ date: 2016-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails