sufia-models 4.0.0.beta4 → 4.0.0.rc1

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: 26e357f1f6b832085b27631a3f0b27a6965e5e5d
4
- data.tar.gz: 1848e22539c05d4fc6e65c4caf95dbb5bae3853d
3
+ metadata.gz: ee13e1774ba0de53ce7735b6bb93176a2e27e882
4
+ data.tar.gz: 0760211d652447c4c47680af22c5cb29afb215c0
5
5
  SHA512:
6
- metadata.gz: 46eef68b1e122d8a97d163b8af48276506129800d77713866097738d1f41930f93f1ca9d01f098ffc295bc2d964ca9c3f373edfb8983089d1507907637609b1d
7
- data.tar.gz: 692a11e6afe0f3fe8545eb12600f50233dc72b7de3fbee2e5bde078ed200e8d03497be4beb12354aaf666e36e651fd35243c3276870476566a9bb60cb51c679d
6
+ metadata.gz: dca80059d96ab1b9f09c53af4e76374fc0d8644ba44f1faf4fcc2d94365e75e49e1321dd2542390a1ee14459f098c8e64b16caf30bc1c104194c6a7562ac4b23
7
+ data.tar.gz: da74a7e90d7d9cd3f6a3da5bb67e7e2c0288b366322cb6d1431d0089b43845346188313c3cdca0bcbcf89bfdc22d654006a7133f273c08aab9e442c683b2fcca
@@ -32,7 +32,7 @@ module Sufia
32
32
 
33
33
  module ClassMethods
34
34
  def image_mime_types
35
- ['image/png', 'image/jpeg', 'image/jpg', 'image/jp2', 'image/bmp', 'image/gif']
35
+ ['image/png', 'image/jpeg', 'image/jpg', 'image/jp2', 'image/bmp', 'image/gif', 'image/tiff']
36
36
  end
37
37
 
38
38
  def pdf_mime_types
@@ -16,11 +16,8 @@ module Sufia
16
16
  end
17
17
 
18
18
  def namespaceize(identifier)
19
- if identifier.start_with?(namespace)
20
- identifier
21
- else
22
- "#{namespace}:#{identifier}"
23
- end
19
+ return identifier if identifier.include?(':')
20
+ "#{namespace}:#{identifier}"
24
21
  end
25
22
 
26
23
  protected
@@ -0,0 +1,78 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'rails/generators'
3
+ require 'rails/generators/migration'
4
+
5
+ class Sufia::Models::Upgrade400Generator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+
8
+ source_root File.expand_path('../templates', __FILE__)
9
+
10
+ argument :model_name, type: :string , default: "user"
11
+ desc """
12
+ This generator for upgrading sufia-models from 3.7.2 to 4.0 makes the following changes to your application:
13
+ 1. Creates several database migrations if they do not exist in /db/migrate
14
+ 2. Runs the mailboxer upgrade generator
15
+ 3. Adds analytics to the sufia.rb configuration file
16
+ """
17
+
18
+ # Implement the required interface for Rails::Generators::Migration.
19
+ # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
20
+ def self.next_migration_number(path)
21
+ if @prev_migration_nr
22
+ @prev_migration_nr += 1
23
+ else
24
+ if last_migration = Dir[File.join(path, '*.rb')].sort.last
25
+ @prev_migration_nr = last_migration.sub(File.join(path, '/'), '').to_i + 1
26
+ else
27
+ @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
28
+ end
29
+ end
30
+ @prev_migration_nr.to_s
31
+ end
32
+
33
+ def banner
34
+ say_status("warning", "UPGRADING SUFIA MODELS", :yellow)
35
+ end
36
+
37
+ # Setup the database migrations
38
+ def copy_migrations
39
+ # Can't get this any more DRY, because we need this order.
40
+ [
41
+ 'create_tinymce_assets.rb',
42
+ 'create_content_blocks.rb',
43
+ 'create_featured_works.rb'
44
+ ].each do |file|
45
+ better_migration_template file
46
+ end
47
+ end
48
+
49
+ # Upgrade mailboxer
50
+ def install_mailboxer
51
+ generate "mailboxer:namespacing_compatibility"
52
+ end
53
+
54
+ # Add config file for Google Analytics
55
+ def add_analytics_config
56
+ copy_file 'config/analytics.yml', 'config/analytics.yml'
57
+ end
58
+
59
+ # Add Google Analytics option to Sufia config
60
+ def inject_analytics_initializer
61
+ inject_into_file 'config/initializers/sufia.rb', after: /^Sufia\.config do.*$/ do
62
+ "\n # Enable displaying usage statistics in the UI\n" +
63
+ " # Defaults to FALSE\n" +
64
+ " # Requires a Google Analytics id and OAuth2 keyfile. See README for more info\n" +
65
+ " #config.analytics = false\n"
66
+ end
67
+ end
68
+
69
+ private
70
+
71
+ def better_migration_template(file)
72
+ begin
73
+ migration_template "migrations/#{file}", "db/migrate/#{file}"
74
+ rescue Rails::Generators::Error => e
75
+ say_status("warning", e.message, :yellow)
76
+ end
77
+ end
78
+ end
@@ -23,7 +23,7 @@ module Sufia
23
23
  config.enable_contact_form_delivery = false
24
24
  config.browse_everything = nil
25
25
  config.enable_local_ingest = nil
26
- config.usage_statistics = nil
26
+ config.analytics = false
27
27
  config.queue = Sufia::Resque::Queue
28
28
 
29
29
  config.autoload_paths += %W(
@@ -1,5 +1,5 @@
1
1
  module Sufia
2
2
  module Models
3
- VERSION = "4.0.0.beta4"
3
+ VERSION = "4.0.0.rc1"
4
4
  end
5
5
  end
data/sufia-models.gemspec CHANGED
@@ -29,12 +29,12 @@ Gem::Specification.new do |spec|
29
29
  spec.add_dependency 'rails', '~> 4.0', '< 5.0.0'
30
30
  spec.add_dependency 'activeresource', "~>4.0.0" # No longer a dependency of rails 4.0
31
31
 
32
- spec.add_dependency "hydra-head", "~> 7.0.1"
32
+ spec.add_dependency "hydra-head", "~> 7.0"
33
33
  spec.add_dependency 'nest', '~> 1.1.1'
34
34
  spec.add_dependency 'resque', '~> 1.23'
35
- spec.add_dependency 'resque-pool', '0.3.0'
35
+ spec.add_dependency 'resque-pool', '~> 0.3.0'
36
36
  spec.add_dependency 'noid', '~> 0.6.6'
37
- spec.add_dependency 'mailboxer', '~> 0.12.0.rc2'
37
+ spec.add_dependency 'mailboxer', '~> 0.12.0'
38
38
  spec.add_dependency 'acts_as_follower', '>= 0.1.1', '< 0.3'
39
39
  spec.add_dependency 'carrierwave', '~> 0.9.0'
40
40
  spec.add_dependency 'hydra-derivatives', '~> 0.1'
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: 4.0.0.beta4
4
+ version: 4.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Friesen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-27 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 7.0.1
81
+ version: '7.0'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 7.0.1
88
+ version: '7.0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: nest
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -118,14 +118,14 @@ dependencies:
118
118
  name: resque-pool
119
119
  requirement: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - '='
121
+ - - "~>"
122
122
  - !ruby/object:Gem::Version
123
123
  version: 0.3.0
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - '='
128
+ - - "~>"
129
129
  - !ruby/object:Gem::Version
130
130
  version: 0.3.0
131
131
  - !ruby/object:Gem::Dependency
@@ -148,14 +148,14 @@ dependencies:
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: 0.12.0.rc2
151
+ version: 0.12.0
152
152
  type: :runtime
153
153
  prerelease: false
154
154
  version_requirements: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
- version: 0.12.0.rc2
158
+ version: 0.12.0
159
159
  - !ruby/object:Gem::Dependency
160
160
  name: acts_as_follower
161
161
  requirement: !ruby/object:Gem::Requirement
@@ -345,6 +345,7 @@ files:
345
345
  - lib/generators/sufia/models/templates/migrations/create_tinymce_assets.rb
346
346
  - lib/generators/sufia/models/templates/migrations/create_trophies.rb
347
347
  - lib/generators/sufia/models/templates/migrations/create_version_committers.rb
348
+ - lib/generators/sufia/models/upgrade400_generator.rb
348
349
  - lib/generators/sufia/models/usagestats_generator.rb
349
350
  - lib/sufia/ability.rb
350
351
  - lib/sufia/models.rb