sufia-models 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3f270df659dfb48b395c515f70e0447c94504f7
4
- data.tar.gz: d7db33a427da9b43b84e51e25ffc6fa2c3dbdd4a
3
+ metadata.gz: ddd7181cafb3b120aefffbbde8d170b1e2149ec5
4
+ data.tar.gz: 3f255cafe12f0e78f81fad2f8651adfb10f49404
5
5
  SHA512:
6
- metadata.gz: b76383a5af4b49c6bfd22e158233d0d51088cb3b1545b5dfafbde77827dcf6c662889fdf34bf01bfe46fc1406ef147009b2791d64c523fcee507cd8a5f910b67
7
- data.tar.gz: d800eba8c79b73b29da94a8ab1928dee3bf883e1c07115ddec34b85186cc41dc77a22075e51fac85f4141daffa03013ccf1f1e6c716a5ebaa0fa59ddd22172ff
6
+ metadata.gz: 9bb4039d4dd6ce49c74193559605ca2fccee547861654f4963ca664238656ae8fa78b03efefa09fddcab81da0d1f21780a6b775de95bb048c948f9fcf2acb928
7
+ data.tar.gz: bb7584fe3c1bb62f8f17390665df49f55c71e3dd2bd1c82dfef199435d5cf3f541c8c68e9d968204e98ceee05a027d0264337498ee2b5ad034a8c920e832c46a
data/app/models/batch.rb CHANGED
@@ -32,9 +32,9 @@ class Batch < ActiveFedora::Base
32
32
 
33
33
  def self.find_or_create(pid)
34
34
  begin
35
- @batch = Batch.find(pid)
35
+ Batch.find(pid)
36
36
  rescue ActiveFedora::ObjectNotFoundError
37
- @batch = Batch.create({pid: pid})
37
+ Batch.create({pid: pid})
38
38
  end
39
39
  end
40
40
 
@@ -16,10 +16,9 @@ class ChecksumAuditLog < ActiveRecord::Base
16
16
  attr_accessible :pass, :pid, :dsid, :version, :created_at
17
17
 
18
18
  def ChecksumAuditLog.get_audit_log(version)
19
- log = ChecksumAuditLog.find_or_create_by_pid_and_dsid_and_version(:pid => version.pid,
20
- :dsid => version.dsid,
21
- :version => version.versionID)
22
- log
19
+ ChecksumAuditLog.find_or_create_by_pid_and_dsid_and_version(:pid => version.pid,
20
+ :dsid => version.dsid,
21
+ :version => version.versionID)
23
22
  end
24
23
 
25
24
  def ChecksumAuditLog.prune_history(version)
data/lib/sufia/models.rb CHANGED
@@ -22,6 +22,7 @@ module Sufia
22
22
  end
23
23
 
24
24
  autoload :Resque, 'sufia/models/resque'
25
+ autoload :Utils, 'sufia/models/utils'
25
26
 
26
27
  attr_writer :queue
27
28
 
@@ -12,6 +12,11 @@ module Sufia
12
12
  config.autoload_paths += %W(
13
13
  #{config.root}/lib/sufia/models/jobs
14
14
  )
15
+
16
+ rake_tasks do
17
+ load File.expand_path('../../../tasks/sufia-models_tasks.rake', __FILE__)
18
+ end
19
+
15
20
  initializer "patches" do
16
21
  require 'sufia/models/active_fedora/redis'
17
22
  require 'sufia/models/active_record/redis'
@@ -6,6 +6,13 @@ module Sufia
6
6
  module GenericFile
7
7
  extend ActiveSupport::Concern
8
8
  extend ActiveSupport::Autoload
9
+ autoload :Export
10
+ autoload :Thumbnail
11
+ autoload :Characterization
12
+ autoload :Audit
13
+ autoload :Actions
14
+ autoload :Permissions
15
+ autoload :WebForm
9
16
  include Sufia::ModelMethods
10
17
  include Sufia::Noid
11
18
  include Sufia::GenericFile::Thumbnail
@@ -13,6 +20,7 @@ module Sufia
13
20
  include Sufia::GenericFile::Characterization
14
21
  include Sufia::GenericFile::Audit
15
22
  include Sufia::GenericFile::Permissions
23
+ include Sufia::GenericFile::WebForm
16
24
 
17
25
  included do
18
26
  has_metadata :name => "descMetadata", :type => GenericFileRdfDatastream
@@ -16,8 +16,12 @@ require 'noid'
16
16
 
17
17
  module Sufia
18
18
  module IdService
19
- @template = Sufia.config.noid_template rescue '.reeddeeddk'
20
- @minter = ::Noid::Minter.new(:template => @template)
19
+
20
+ def self.noid_template
21
+ Sufia.config.noid_template
22
+ end
23
+
24
+ @minter = ::Noid::Minter.new(:template => noid_template)
21
25
  @pid = $$
22
26
  @namespace = Sufia.config.id_namespace
23
27
  @semaphore = Mutex.new
@@ -39,20 +43,19 @@ module Sufia
39
43
 
40
44
  def self.next_id
41
45
  pid = ''
42
- File.open("tmp/minter-state", File::RDWR|File::CREAT, 0644) {|f|
46
+ File.open(Sufia::Engine.config.minter_statefile, File::RDWR|File::CREAT, 0644) do |f|
43
47
  f.flock(File::LOCK_EX)
44
48
  yaml = YAML::load(f.read)
45
- yaml = {:template => @template} unless yaml
49
+ yaml = {:template => noid_template} unless yaml
46
50
  minter = ::Noid::Minter.new(yaml)
47
- pid = "#{@namespace}:#{minter.mint}"
51
+ pid = "#{@namespace}:#{minter.mint}"
48
52
  f.rewind
49
53
  yaml = YAML::dump(minter.dump)
50
54
  f.write yaml
51
55
  f.flush
52
56
  f.truncate(f.pos)
53
- }
57
+ end
54
58
  return pid
55
59
  end
56
-
57
60
  end
58
61
  end
@@ -14,7 +14,6 @@
14
14
 
15
15
  class BatchUpdateJob
16
16
  include Hydra::PermissionsQuery
17
- include GenericFileHelper
18
17
  include Rails.application.routes.url_helpers
19
18
 
20
19
  def queue_name
@@ -79,7 +78,7 @@ class BatchUpdateJob
79
78
  end
80
79
 
81
80
  def file_list ( files)
82
- return files.map {|gf| '<a href="'+Sufia::Engine.routes.url_helpers.generic_files_path+'/'+gf.noid+'">'+display_title(gf)+'</a>'}.join(', ')
81
+ return files.map {|gf| '<a href="'+Sufia::Engine.routes.url_helpers.generic_files_path+'/'+gf.noid+'">'+gf.to_s+'</a>'}.join(', ')
83
82
 
84
83
  end
85
84
 
@@ -28,10 +28,9 @@ class TranscodeAudioJob < FfmpegTranscodeJob
28
28
  opts = ""
29
29
  if generic_file.mime_type == 'audio/mpeg'
30
30
  # Don't re-encode, just copy
31
- generic_file.add_file_datastream(generic_file.content.read, :dsid=>'mp3', :mimeType=>'audio/mp3')
32
- #generic_file.content.rewind
31
+ generic_file.add_file_datastream(generic_file.content.read, :dsid=>'mp3', :mimeType=>'audio/mpeg')
33
32
  else
34
- encode_datastream('mp3', 'audio/mp3', opts)
33
+ encode_datastream('mp3', 'audio/mpeg', opts)
35
34
  end
36
35
  end
37
36
 
@@ -35,5 +35,11 @@ module Sufia
35
35
 
36
36
  return true
37
37
  end
38
+
39
+ def to_s
40
+ return Array(title).join(" | ") if title.present?
41
+ label || "No Title"
42
+ end
43
+
38
44
  end
39
45
  end
@@ -1,5 +1,5 @@
1
1
  module Sufia
2
2
  module Models
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -1,4 +1,7 @@
1
- # desc "Explaining what the task does"
2
- # task :sufia-models do
3
- # # Task goes here
4
- # end
1
+ namespace :solr do
2
+
3
+ desc "Enqueue a job to resolrize the repository objects"
4
+ task :reindex => :environment do
5
+ Sufia.queue.push(ResolrizeJob.new)
6
+ end
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sufia-models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-20 00:00:00.000000000 Z
11
+ date: 2013-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler