sufia-models 3.1.3 → 3.2.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: 72c416d322fb3bea980a2eccd7f10da2788bfc6c
4
- data.tar.gz: 6d00d262f2085368c8bae2a406b6db69ba0a0ca8
3
+ metadata.gz: 79d76149b1df8f00315c569a3e43db45937c92b7
4
+ data.tar.gz: 6bd416eab76f790a73f16a07a2abd337cfcd4e4e
5
5
  SHA512:
6
- metadata.gz: e38dc785cbd05a8404999089dabf5b76a920db07cc852bd961b1e0182ba227d477b5f3be19aca01174285e0786761e6afe184ab3410ace1868ca1fe59eae9b60
7
- data.tar.gz: 7ab56759eced4a028a5a23891618c3cc9ca303f877a7dc50eef59722aba6fbb99f0d22d4d69e8b4e23f5532ad7575ac078203e3d75def697a8c5ee6f5a12271e
6
+ metadata.gz: b776c781c53753d4de08fced94345ed0b45117c63012f8b2042fd18a6633d5c4ac1cb9a2c38cf666b7238b2307de0fd2deffda00db2d14721ec06d66ced04131
7
+ data.tar.gz: 70e8d9b4d5dc61fac26a93b76a45ca8deb743fec41a396c97b3f51d2a0f705ae5306841f33a9a30717eb1feadf346198dc613abd4f72592e2b4a6176f37e0a89
@@ -1,5 +1,5 @@
1
1
  class ChecksumAuditLog < ActiveRecord::Base
2
- attr_accessible :pass, :pid, :dsid, :version, :created_at if Rails::VERSION::MAJOR == 3
2
+ deprecated_attr_accessible :pass, :pid, :dsid, :version, :created_at
3
3
 
4
4
  def ChecksumAuditLog.get_audit_log(version)
5
5
  ChecksumAuditLog.find_or_create_by_pid_and_dsid_and_version(:pid => version.pid,
@@ -1,5 +1,5 @@
1
1
  class DomainTerm < ActiveRecord::Base
2
- attr_accessible :model, :term if Rails::VERSION::MAJOR == 3
2
+ deprecated_attr_accessible :model, :term
3
3
 
4
4
  # TODO we should add an index on this join table and remove the uniq query
5
5
  has_and_belongs_to_many :local_authorities, :uniq=> true
@@ -2,7 +2,7 @@ require 'rdf'
2
2
  require 'rdf/rdfxml'
3
3
 
4
4
  class LocalAuthority < ActiveRecord::Base
5
- attr_accessible :name if Rails::VERSION::MAJOR == 3
5
+ deprecated_attr_accessible :name
6
6
  # TODO we should add an index on this join table and remove the uniq query
7
7
  has_and_belongs_to_many :domain_terms, :uniq=> true
8
8
  has_many :local_authority_entries
@@ -1,4 +1,4 @@
1
1
  class LocalAuthorityEntry < ActiveRecord::Base
2
2
  belongs_to :local_authority
3
- attr_accessible :local_authority, :label, :uri if Rails::VERSION::MAJOR == 3
3
+ deprecated_attr_accessible :local_authority, :label, :uri
4
4
  end
@@ -1,6 +1,6 @@
1
1
  class SingleUseLink < ActiveRecord::Base
2
2
 
3
- attr_accessible :downloadKey, :expires, :itemId, :path if Rails::VERSION::MAJOR == 3
3
+ deprecated_attr_accessible :downloadKey, :expires, :itemId, :path
4
4
 
5
5
 
6
6
  def self.create_show(item_id)
data/app/models/trophy.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Trophy < ActiveRecord::Base
2
- attr_accessible :generic_file_id, :user_id if Rails::VERSION::MAJOR == 3
2
+ deprecated_attr_accessible :generic_file_id, :user_id
3
3
 
4
4
  validate :count_within_limit, :on => :create
5
5
 
@@ -1,3 +1,3 @@
1
1
  class VersionCommitter < ActiveRecord::Base
2
- attr_accessible :obj_id, :datastream_id, :version_id, :committer_login if Rails::VERSION::MAJOR == 3
2
+ deprecated_attr_accessible :obj_id, :datastream_id, :version_id, :committer_login
3
3
  end
@@ -92,7 +92,11 @@ This generator makes the following changes to your application:
92
92
  private
93
93
 
94
94
  def better_migration_template(file)
95
- migration_template "migrations/#{file}", "db/migrate/#{file}"
95
+ begin
96
+ migration_template "migrations/#{file}", "db/migrate/#{file}"
97
+ rescue Rails::Generators::Error => e
98
+ say_status("warning", e.message, :yellow)
99
+ end
96
100
  end
97
101
 
98
102
  end
@@ -0,0 +1,16 @@
1
+ module ActiveRecord
2
+ module DeprecatedAttrAccessible
3
+ extend ActiveSupport::Concern
4
+ module ClassMethods
5
+ def deprecated_attr_accessible(*args)
6
+ if Rails::VERSION::MAJOR < 4 || defined?(ProtectedAttributes)
7
+ ActiveSupport::Deprecation.warn("deprecated_attr_accessible is, wait for it, deprecated. It will be removed when Sufia stops support Rails 3.")
8
+ attr_accessible(*args)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ ActiveRecord::Base.class_eval do
15
+ include ActiveRecord::DeprecatedAttrAccessible
16
+ end
@@ -37,6 +37,7 @@ module Sufia
37
37
  initializer "patches" do
38
38
  require 'sufia/models/active_fedora/redis'
39
39
  require 'sufia/models/active_record/redis'
40
+ require 'sufia/models/active_record/deprecated_attr_accessible'
40
41
  require 'sufia/models/active_support/core_ext/marshal' unless Rails::VERSION::MAJOR == 4
41
42
  end
42
43
 
@@ -3,13 +3,8 @@ module Sufia
3
3
  module Visibility
4
4
  extend ActiveSupport::Concern
5
5
  extend Deprecation
6
- include ActiveModel::Dirty
7
6
 
8
- included do
9
- define_attribute_methods :visibility
10
- end
11
-
12
- def visibility= (value)
7
+ def visibility=(value)
13
8
  return if value.nil?
14
9
  # only set explicit permissions
15
10
  case value
@@ -17,7 +12,7 @@ module Sufia
17
12
  public_visibility!
18
13
  when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
19
14
  registered_visibility!
20
- when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
15
+ when Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
21
16
  private_visibility!
22
17
  else
23
18
  raise ArgumentError, "Invalid visibility: #{value.inspect}"
@@ -39,25 +34,32 @@ module Sufia
39
34
  self.visibility= visibility
40
35
  end
41
36
 
42
- private
43
- def public_visibility!
44
- visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
45
- self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "read")
46
- end
37
+ def visibility_changed?
38
+ @visibility_will_change
39
+ end
47
40
 
48
- def registered_visibility!
49
- visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
50
- self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "read")
51
- self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
52
- end
41
+ private
42
+ def visibility_will_change!
43
+ @visibility_will_change = true
44
+ end
45
+
46
+ def public_visibility!
47
+ visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
48
+ self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "read")
49
+ end
50
+
51
+ def registered_visibility!
52
+ visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
53
+ self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "read")
54
+ self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
55
+ end
56
+
57
+ def private_visibility!
58
+ visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
59
+ self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "none")
60
+ self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
61
+ end
53
62
 
54
- def private_visibility!
55
- visibility_will_change! unless visibility == Sufia::Models::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
56
- self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED}, "none")
57
- self.datastreams["rightsMetadata"].permissions({:group=>Sufia::Models::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC}, "none")
58
- end
59
63
  end
60
64
  end
61
65
  end
62
-
63
-
@@ -19,7 +19,7 @@ module Sufia::User
19
19
  acts_as_followable
20
20
 
21
21
  # Setup accessible (or protected) attributes for your model
22
- attr_accessible *permitted_attributes if Rails::VERSION::MAJOR == 3
22
+ deprecated_attr_accessible *permitted_attributes
23
23
 
24
24
  # Add user avatar (via paperclip library)
25
25
  has_attached_file :avatar, :styles => { medium: "300x300>", thumb: "100x100>" }, :default_url => '/assets/missing_:style.png'
@@ -1,5 +1,5 @@
1
1
  module Sufia
2
2
  module Models
3
- VERSION = "3.1.3"
3
+ VERSION = "3.2.1"
4
4
  end
5
5
  end
data/sufia-models.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  # This is a temporary homepage until we've had a chance to review the
18
18
  # process
19
- spec.homepage = "https://github.com/jeremyf/sufia"
19
+ spec.homepage = "https://github.com/projecthydra/sufia"
20
20
  spec.license = "Apache"
21
21
 
22
22
  spec.files = `git ls-files`.split($/)
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency 'rails', '>= 3.2.13', '< 5.0'
31
31
  spec.add_dependency 'activeresource' # No longer a dependency of rails 4.0
32
32
  spec.add_dependency "hydra-head", "~> 6.3.0"
33
- spec.add_dependency 'active-fedora', "~> 6.4.0"
33
+ spec.add_dependency 'active-fedora', "~> 6.5.0"
34
34
 
35
35
  spec.add_dependency 'nest', '~> 1.1.1'
36
36
  spec.add_dependency 'resque', '~> 1.23.0'#, :require => 'resque/server'
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: 3.1.3
4
+ version: 3.2.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-08-28 00:00:00.000000000 Z
11
+ date: 2013-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - ~>
94
94
  - !ruby/object:Gem::Version
95
- version: 6.4.0
95
+ version: 6.5.0
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ~>
101
101
  - !ruby/object:Gem::Version
102
- version: 6.4.0
102
+ version: 6.5.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: nest
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -281,6 +281,7 @@ files:
281
281
  - lib/generators/sufia/models/templates/migrations/create_version_committers.rb
282
282
  - lib/sufia/models.rb
283
283
  - lib/sufia/models/active_fedora/redis.rb
284
+ - lib/sufia/models/active_record/deprecated_attr_accessible.rb
284
285
  - lib/sufia/models/active_record/redis.rb
285
286
  - lib/sufia/models/active_support/core_ext/marshal.rb
286
287
  - lib/sufia/models/engine.rb
@@ -319,7 +320,7 @@ files:
319
320
  - lib/tasks/resque.rake
320
321
  - lib/tasks/sufia-models_tasks.rake
321
322
  - sufia-models.gemspec
322
- homepage: https://github.com/jeremyf/sufia
323
+ homepage: https://github.com/projecthydra/sufia
323
324
  licenses:
324
325
  - Apache
325
326
  metadata: {}
@@ -339,9 +340,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
340
  version: '0'
340
341
  requirements: []
341
342
  rubyforge_project:
342
- rubygems_version: 2.0.5
343
+ rubygems_version: 2.0.3
343
344
  signing_key:
344
345
  specification_version: 4
345
346
  summary: Models and services for sufia
346
347
  test_files: []
347
- has_rdoc: