hyrax 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/services/hyrax/database_migrator.rb +66 -0
  4. data/lib/generators/hyrax/models_generator.rb +6 -6
  5. data/{db/migrate/20160328222152_create_version_committers.rb → lib/generators/hyrax/templates/db/migrate/20160328222152_create_version_committers.rb.erb} +1 -1
  6. data/{db/migrate/20160328222153_create_checksum_audit_logs.rb → lib/generators/hyrax/templates/db/migrate/20160328222153_create_checksum_audit_logs.rb.erb} +1 -1
  7. data/{db/migrate/20160328222154_create_single_use_links.rb → lib/generators/hyrax/templates/db/migrate/20160328222154_create_single_use_links.rb.erb} +1 -1
  8. data/{db/migrate/20160328222156_add_social_to_users.rb → lib/generators/hyrax/templates/db/migrate/20160328222156_add_social_to_users.rb.erb} +1 -1
  9. data/{db/migrate/20160328222157_add_ldap_attrs_to_user.rb → lib/generators/hyrax/templates/db/migrate/20160328222157_add_ldap_attrs_to_user.rb.erb} +1 -1
  10. data/{db/migrate/20160328222158_add_avatars_to_users.rb → lib/generators/hyrax/templates/db/migrate/20160328222158_add_avatars_to_users.rb.erb} +1 -1
  11. data/{db/migrate/20160328222161_create_trophies.rb → lib/generators/hyrax/templates/db/migrate/20160328222161_create_trophies.rb.erb} +1 -1
  12. data/lib/generators/hyrax/templates/db/migrate/20160328222162_add_linkedin_to_users.rb.erb +5 -0
  13. data/{db/migrate/20160328222163_create_tinymce_assets.rb → lib/generators/hyrax/templates/db/migrate/20160328222163_create_tinymce_assets.rb.erb} +1 -1
  14. data/{db/migrate/20160328222164_create_content_blocks.rb → lib/generators/hyrax/templates/db/migrate/20160328222164_create_content_blocks.rb.erb} +1 -1
  15. data/{db/migrate/20160328222165_create_featured_works.rb → lib/generators/hyrax/templates/db/migrate/20160328222165_create_featured_works.rb.erb} +1 -1
  16. data/{db/migrate/20160328222166_add_external_key_to_content_blocks.rb → lib/generators/hyrax/templates/db/migrate/20160328222166_add_external_key_to_content_blocks.rb.erb} +1 -1
  17. data/{db/migrate/20160328222226_create_proxy_deposit_rights.rb → lib/generators/hyrax/templates/db/migrate/20160328222226_create_proxy_deposit_rights.rb.erb} +3 -1
  18. data/{db/migrate/20160328222227_create_proxy_deposit_requests.rb → lib/generators/hyrax/templates/db/migrate/20160328222227_create_proxy_deposit_requests.rb.erb} +3 -1
  19. data/{db/migrate/20160328222228_create_file_view_stats.rb → lib/generators/hyrax/templates/db/migrate/20160328222228_create_file_view_stats.rb.erb} +1 -1
  20. data/{db/migrate/20160328222229_create_file_download_stats.rb → lib/generators/hyrax/templates/db/migrate/20160328222229_create_file_download_stats.rb.erb} +1 -1
  21. data/lib/generators/hyrax/templates/db/migrate/20160328222230_add_orcid_to_users.rb.erb +5 -0
  22. data/{db/migrate/20160328222231_create_user_stats.rb → lib/generators/hyrax/templates/db/migrate/20160328222231_create_user_stats.rb.erb} +1 -1
  23. data/{db/migrate/20160328222232_create_work_view_stats.rb → lib/generators/hyrax/templates/db/migrate/20160328222232_create_work_view_stats.rb.erb} +1 -1
  24. data/{db/migrate/20160328222233_add_works_to_user_stats.rb → lib/generators/hyrax/templates/db/migrate/20160328222233_add_works_to_user_stats.rb.erb} +1 -1
  25. data/{db/migrate/20160328222236_change_trophy_generic_file_id_to_work_id.rb → lib/generators/hyrax/templates/db/migrate/20160328222236_change_trophy_generic_file_id_to_work_id.rb.erb} +1 -1
  26. data/{db/migrate/20160328222237_change_proxy_deposit_generic_file_id_to_work_id.rb → lib/generators/hyrax/templates/db/migrate/20160328222237_change_proxy_deposit_generic_file_id_to_work_id.rb.erb} +1 -1
  27. data/{db/migrate/20160328222238_change_audit_log_generic_file_id_to_file_set_id.rb → lib/generators/hyrax/templates/db/migrate/20160328222238_change_audit_log_generic_file_id_to_file_set_id.rb.erb} +1 -1
  28. data/{db/migrate/20160328222239_change_proxy_deposit_request_generic_file_id_to_work_id.rb → lib/generators/hyrax/templates/db/migrate/20160328222239_change_proxy_deposit_request_generic_file_id_to_work_id.rb.erb} +1 -1
  29. data/{db/migrate/20160401142419_create_uploaded_files.rb → lib/generators/hyrax/templates/db/migrate/20160401142419_create_uploaded_files.rb.erb} +1 -1
  30. data/{db/migrate/20160415212015_create_features.rb → lib/generators/hyrax/templates/db/migrate/20160415212015_create_features.rb.erb} +1 -1
  31. data/{db/migrate/20160427155928_create_operations.rb → lib/generators/hyrax/templates/db/migrate/20160427155928_create_operations.rb.erb} +1 -1
  32. data/{db/migrate/20160510000007_change_featured_work_generic_file_id_to_work_id.rb → lib/generators/hyrax/templates/db/migrate/20160510000007_change_featured_work_generic_file_id_to_work_id.rb.erb} +1 -1
  33. data/{db/migrate/20160516190435_add_arkivo_to_users.rb → lib/generators/hyrax/templates/db/migrate/20160516190435_add_arkivo_to_users.rb.erb} +1 -1
  34. data/{db/migrate/20160919151348_create_sipity.rb → lib/generators/hyrax/templates/db/migrate/20160919151348_create_sipity.rb.erb} +1 -1
  35. data/{db/migrate/20161012182404_create_sipity_workflow_methods.rb → lib/generators/hyrax/templates/db/migrate/20161012182404_create_sipity_workflow_methods.rb.erb} +1 -1
  36. data/{db/migrate/20161021175854_create_permission_template.rb → lib/generators/hyrax/templates/db/migrate/20161021175854_create_permission_template.rb.erb} +1 -1
  37. data/{db/migrate/20161021180154_create_permission_template_access.rb → lib/generators/hyrax/templates/db/migrate/20161021180154_create_permission_template_access.rb.erb} +1 -1
  38. data/{db/migrate/20161116222307_add_release_to_permission_templates.rb → lib/generators/hyrax/templates/db/migrate/20161116222307_add_release_to_permission_templates.rb.erb} +1 -1
  39. data/{db/migrate/20170131142607_add_permission_template_to_sipity_workflow.rb → lib/generators/hyrax/templates/db/migrate/20170131142607_add_permission_template_to_sipity_workflow.rb.erb} +1 -1
  40. data/{db/migrate/20170307142607_tidy_up_because_of_bad_exception.rb → lib/generators/hyrax/templates/db/migrate/20170307142607_tidy_up_because_of_bad_exception.rb.erb} +1 -1
  41. data/{db/migrate/20170308175556_add_allows_access_grant_to_workflow.rb → lib/generators/hyrax/templates/db/migrate/20170308175556_add_allows_access_grant_to_workflow.rb.erb} +1 -1
  42. data/{db/migrate/20170504192714_change_checksum_audit_log.rb → lib/generators/hyrax/templates/db/migrate/20170504192714_change_checksum_audit_log.rb.erb} +1 -1
  43. data/{db/migrate/20170621201939_create_job_io_wrappers.rb → lib/generators/hyrax/templates/db/migrate/20170621201939_create_job_io_wrappers.rb.erb} +1 -1
  44. data/lib/generators/hyrax/templates/db/migrate/20170905135339_add_preferred_locale_to_users.rb.erb +5 -0
  45. data/lib/generators/hyrax/templates/db/migrate/20171117153051_add_unique_constraint_to_permission_template_accesses.rb.erb +8 -0
  46. data/lib/hyrax/version.rb +1 -1
  47. data/lib/tasks/install.rake +8 -0
  48. data/spec/services/hyrax/database_migrator_spec.rb +20 -0
  49. data/template.rb +1 -1
  50. metadata +47 -42
  51. data/db/migrate/20160328222162_add_linkedin_to_users.rb +0 -5
  52. data/db/migrate/20160328222230_add_orcid_to_users.rb +0 -5
  53. data/db/migrate/20170905135339_add_preferred_locale_to_users.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78fd77d23cc9c553c406db319e2196e0ddabc284
4
- data.tar.gz: 5e5f08cdc8b211df27363d5df38050341c24b33c
3
+ metadata.gz: e9b7ae0472d87866ad612907024ff728a7c2b991
4
+ data.tar.gz: 8f99d3bdc928281c81c66382e67008d266200f85
5
5
  SHA512:
6
- metadata.gz: 539a8621018cf3d3528c227b133619a796c74f64cbf127b27969c5d5aa0c76feb0880d151394ad48b57cd3c65b2d6525a21b084a18a85d62e5f39a2d1d431353
7
- data.tar.gz: 33249e68e552bfecf82ec58687a8bc4afeb625899a9943b390d4df3b1fec03683b5c6f681011667c1da0a215e4b2271308c78fc697f3294aab35742d5a8213e3
6
+ metadata.gz: 16a63bc04587ca44251e3da2a1ea2f7071f2eac1d42ed378a3ee41d2697312d72029076cabe4828f2e2ce1411fee3afa9d5050f95cd62a17e21434e89aa6cdaa
7
+ data.tar.gz: c7210a56ee4b20462c135c2faa85cd95a46ac8fc16db98ffbd4b7f576fb8e2cb3b143fb515ab391dff4265511ccb3a8243416b2fa5ef1b73ceb3f0995a2156ad
data/README.md CHANGED
@@ -63,7 +63,7 @@ The Samvera community is here to help. Please see our [support guide](./.github/
63
63
  # Getting started
64
64
 
65
65
  This document contains instructions specific to setting up an app with __Hyrax
66
- v2.0.0__. If you are looking for instructions on installing a different
66
+ v2.0.1__. If you are looking for instructions on installing a different
67
67
  version, be sure to select the appropriate branch or tag from the drop-down
68
68
  menu above.
69
69
 
@@ -160,7 +160,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
160
160
  Generate a new Rails application using the template.
161
161
 
162
162
  ```
163
- rails _5.0.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.0.0/template.rb
163
+ rails _5.0.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.0.1/template.rb
164
164
  ```
165
165
 
166
166
  Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
@@ -0,0 +1,66 @@
1
+ require 'rails/generators/active_record'
2
+
3
+ module Hyrax
4
+ # Hyrax::DatabaseMigrator is responsible for copying Hyrax's required database
5
+ # migrations into applications. Rails engines typically use the built-in
6
+ # `{ENGINE_NAME}:install:migrations` task to handle this; instead Hyrax
7
+ # follows the practice used by Devise to dynamically subclass migrations with
8
+ # the version of `ActiveRecord::Migration` corresponding to the version of
9
+ # Rails used by the application. This class was added to resolve Hyrax issue
10
+ # #2347
11
+ #
12
+ # @see https://github.com/samvera/hyrax/issues/2347
13
+ #
14
+ # @note Hyrax::DatabaseMigrator uses Rails' generator internals to avoid
15
+ # having to re-implement code that knows how to copy migrations only if
16
+ # needed
17
+ class DatabaseMigrator < Rails::Generators::Base
18
+ # @note included to pick up AR's migration numbering algorithm
19
+ include ActiveRecord::Generators::Migration
20
+
21
+ # @note This method is required by Rails::Generators::Base
22
+ def self.source_root
23
+ migrations_dir
24
+ end
25
+
26
+ def self.migrations_dir
27
+ Hyrax::Engine.root.join('lib', 'generators', 'hyrax', 'templates')
28
+ end
29
+
30
+ def self.copy
31
+ new.copy
32
+ end
33
+
34
+ def copy
35
+ # Hyrax's migrations changed between 2.0.0 and subsequent versions, so the
36
+ # migration comparison algorithm decides that those older migrations are a
37
+ # source of conflict. Default Rails behavior here is to abort and
38
+ # explicitly instruct the user to try again with either the `--skip` or
39
+ # `--force` option. Hyrax skips these conflicts.
40
+ migrations.each do |filename|
41
+ migration_template filename,
42
+ "db/migrate/#{parse_basename_from(filename)}",
43
+ migration_version: migration_version,
44
+ skip: true
45
+ end
46
+ end
47
+
48
+ private
49
+
50
+ def migrations
51
+ Dir.chdir(self.class.migrations_dir) { Dir.glob('db/migrate/[0-9]*_*.rb.erb') }.sort
52
+ end
53
+
54
+ def parse_basename_from(filename)
55
+ # Add engine name to filename to mimic ``ActiveRecord::Migration.copy` behavior
56
+ filename.slice(/(?<dateprefix>\d)+_(?<basename>.+)\.erb/, 'basename').sub('.', '.hyrax.')
57
+ end
58
+
59
+ def migration_version
60
+ # Don't use AR migration versioning in Rails 4
61
+ return if Rails.version < '5.0.0'
62
+ # Specify the current major.minor version of Rails for AR migrations
63
+ "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
64
+ end
65
+ end
66
+ end
@@ -1,12 +1,12 @@
1
1
  class Hyrax::ModelsGenerator < Rails::Generators::Base
2
2
  source_root File.expand_path('../templates', __FILE__)
3
3
  argument :model_name, type: :string, default: 'user'
4
- desc '
5
- This generator makes the following changes to your application:
6
- 1. Injects the user behavior onto the user models.
7
- 2. Creates the file_set.rb and collection.rb models.
8
- 3. Generates the clam anti-virus configuration.
9
- '
4
+ desc 'This generator makes the following changes to your application:
5
+ 1. Copies database migrations
6
+ 2. Injects the user behavior onto the user models.
7
+ 3. Creates the file_set.rb and collection.rb models.
8
+ 4. Generates the clam anti-virus configuration.'
9
+
10
10
  def banner
11
11
  say_status('info', 'GENERATING HYRAX MODELS', :blue)
12
12
  end
@@ -1,4 +1,4 @@
1
- class CreateVersionCommitters < ActiveRecord::Migration[4.2]
1
+ class CreateVersionCommitters < ActiveRecord::Migration<%= migration_version %>
2
2
  def self.up
3
3
  create_table :version_committers do |t|
4
4
  t.string :obj_id
@@ -1,4 +1,4 @@
1
- class CreateChecksumAuditLogs < ActiveRecord::Migration[4.2]
1
+ class CreateChecksumAuditLogs < ActiveRecord::Migration<%= migration_version %>
2
2
  def self.up
3
3
  create_table :checksum_audit_logs do |t|
4
4
  t.string :file_set_id
@@ -1,4 +1,4 @@
1
- class CreateSingleUseLinks < ActiveRecord::Migration[4.2]
1
+ class CreateSingleUseLinks < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :single_use_links do |t|
4
4
  t.string :downloadKey
@@ -1,4 +1,4 @@
1
- class AddSocialToUsers < ActiveRecord::Migration[4.2]
1
+ class AddSocialToUsers < ActiveRecord::Migration<%= migration_version %>
2
2
  def self.up
3
3
  add_column :users, :facebook_handle, :string
4
4
  add_column :users, :twitter_handle, :string
@@ -1,4 +1,4 @@
1
- class AddLdapAttrsToUser < ActiveRecord::Migration[4.2]
1
+ class AddLdapAttrsToUser < ActiveRecord::Migration<%= migration_version %>
2
2
  def self.up
3
3
  add_column :users, :display_name, :string
4
4
  add_column :users, :address, :string
@@ -1,4 +1,4 @@
1
- class AddAvatarsToUsers < ActiveRecord::Migration[4.2]
1
+ class AddAvatarsToUsers < ActiveRecord::Migration<%= migration_version %>
2
2
  def self.up
3
3
  add_column :users, "avatar_file_name", :string
4
4
  add_column :users, "avatar_content_type", :string
@@ -1,4 +1,4 @@
1
- class CreateTrophies < ActiveRecord::Migration[4.2]
1
+ class CreateTrophies < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :trophies do |t|
4
4
  t.integer :user_id
@@ -0,0 +1,5 @@
1
+ class AddLinkedinToUsers < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ add_column :users, :linkedin_handle, :string
4
+ end
5
+ end
@@ -1,4 +1,4 @@
1
- class CreateTinymceAssets < ActiveRecord::Migration[4.2]
1
+ class CreateTinymceAssets < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :tinymce_assets do |t|
4
4
  t.string :file
@@ -1,4 +1,4 @@
1
- class CreateContentBlocks < ActiveRecord::Migration[4.2]
1
+ class CreateContentBlocks < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :content_blocks do |t|
4
4
  t.string :name
@@ -1,4 +1,4 @@
1
- class CreateFeaturedWorks < ActiveRecord::Migration[4.2]
1
+ class CreateFeaturedWorks < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :featured_works do |t|
4
4
  t.integer :order, default: 5
@@ -1,4 +1,4 @@
1
- class AddExternalKeyToContentBlocks < ActiveRecord::Migration[4.2]
1
+ class AddExternalKeyToContentBlocks < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  add_column :content_blocks, :external_key, :string
4
4
  remove_index :content_blocks, :name
@@ -1,11 +1,13 @@
1
- class CreateProxyDepositRights < ActiveRecord::Migration[4.2]
1
+ class CreateProxyDepositRights < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :proxy_deposit_rights do |t|
4
4
  t.references :grantor
5
5
  t.references :grantee
6
6
  t.timestamps null: false
7
7
  end
8
+ <% if migration_version.to_s < '5.1' %>
8
9
  add_index :proxy_deposit_rights, :grantor_id
9
10
  add_index :proxy_deposit_rights, :grantee_id
11
+ <% end %>
10
12
  end
11
13
  end
@@ -1,4 +1,4 @@
1
- class CreateProxyDepositRequests < ActiveRecord::Migration[4.2]
1
+ class CreateProxyDepositRequests < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :proxy_deposit_requests do |t|
4
4
  t.string :generic_file_id, null: false
@@ -10,7 +10,9 @@ class CreateProxyDepositRequests < ActiveRecord::Migration[4.2]
10
10
  t.text :receiver_comment
11
11
  t.timestamps null: false
12
12
  end
13
+ <% if migration_version.to_s < '5.1' %>
13
14
  add_index :proxy_deposit_requests, :receiving_user_id
14
15
  add_index :proxy_deposit_requests, :sending_user_id
16
+ <% end %>
15
17
  end
16
18
  end
@@ -1,4 +1,4 @@
1
- class CreateFileViewStats < ActiveRecord::Migration[4.2]
1
+ class CreateFileViewStats < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :file_view_stats do |t|
4
4
  t.datetime :date
@@ -1,4 +1,4 @@
1
- class CreateFileDownloadStats < ActiveRecord::Migration[4.2]
1
+ class CreateFileDownloadStats < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :file_download_stats do |t|
4
4
  t.datetime :date
@@ -0,0 +1,5 @@
1
+ class AddOrcidToUsers < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ add_column :users, :orcid, :string
4
+ end
5
+ end
@@ -1,4 +1,4 @@
1
- class CreateUserStats < ActiveRecord::Migration[4.2]
1
+ class CreateUserStats < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :user_stats do |t|
4
4
  t.integer :user_id
@@ -1,4 +1,4 @@
1
- class CreateWorkViewStats < ActiveRecord::Migration[4.2]
1
+ class CreateWorkViewStats < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :work_view_stats do |t|
4
4
  t.datetime :date
@@ -1,4 +1,4 @@
1
- class AddWorksToUserStats < ActiveRecord::Migration[4.2]
1
+ class AddWorksToUserStats < ActiveRecord::Migration<%= migration_version %>
2
2
  def self.up
3
3
  add_column :user_stats, :work_views, :integer
4
4
  add_column :work_view_stats, :user_id, :integer
@@ -1,4 +1,4 @@
1
- class ChangeTrophyGenericFileIdToWorkId < ActiveRecord::Migration[4.2]
1
+ class ChangeTrophyGenericFileIdToWorkId < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  rename_column :trophies, :generic_file_id, :work_id
4
4
  end
@@ -1,4 +1,4 @@
1
- class ChangeProxyDepositGenericFileIdToWorkId < ActiveRecord::Migration[4.2]
1
+ class ChangeProxyDepositGenericFileIdToWorkId < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  rename_column :proxy_deposit_requests, :generic_file_id, :work_id
4
4
  end
@@ -1,4 +1,4 @@
1
- class ChangeAuditLogGenericFileIdToFileSetId < ActiveRecord::Migration[4.2]
1
+ class ChangeAuditLogGenericFileIdToFileSetId < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  rename_column :checksum_audit_logs, :generic_file_id, :file_set_id unless ChecksumAuditLog.column_names.include?('file_set_id')
4
4
  end
@@ -1,4 +1,4 @@
1
- class ChangeProxyDepositRequestGenericFileIdToWorkId < ActiveRecord::Migration[4.2]
1
+ class ChangeProxyDepositRequestGenericFileIdToWorkId < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  rename_column :proxy_deposit_requests, :generic_file_id, :generic_id if ProxyDepositRequest.column_names.include?('generic_file_id')
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateUploadedFiles < ActiveRecord::Migration[4.2]
1
+ class CreateUploadedFiles < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :uploaded_files do |t|
4
4
  t.string :file
@@ -1,4 +1,4 @@
1
- class CreateFeatures < ActiveRecord::Migration[4.2]
1
+ class CreateFeatures < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :hyrax_features do |t|
4
4
  t.string :key, null: false
@@ -1,4 +1,4 @@
1
- class CreateOperations < ActiveRecord::Migration[4.2]
1
+ class CreateOperations < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :curation_concerns_operations do |t|
4
4
  t.string :status
@@ -1,4 +1,4 @@
1
- class ChangeFeaturedWorkGenericFileIdToWorkId < ActiveRecord::Migration[4.2]
1
+ class ChangeFeaturedWorkGenericFileIdToWorkId < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  return unless column_exists?(:featured_works, :generic_file_id)
4
4
  rename_column :featured_works, :generic_file_id, :work_id
@@ -1,4 +1,4 @@
1
- class AddArkivoToUsers < ActiveRecord::Migration[4.2]
1
+ class AddArkivoToUsers < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  add_column :users, :arkivo_token, :string
4
4
  add_column :users, :arkivo_subscription, :string
@@ -1,4 +1,4 @@
1
- class CreateSipity < ActiveRecord::Migration[4.2]
1
+ class CreateSipity < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table "sipity_notification_recipients" do |t|
4
4
  t.integer "notification_id", null: false
@@ -1,4 +1,4 @@
1
- class CreateSipityWorkflowMethods < ActiveRecord::Migration[4.2]
1
+ class CreateSipityWorkflowMethods < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :sipity_workflow_methods do |t|
4
4
  t.string "service_name", null: false
@@ -1,4 +1,4 @@
1
- class CreatePermissionTemplate < ActiveRecord::Migration[4.2]
1
+ class CreatePermissionTemplate < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :permission_templates do |t|
4
4
  t.belongs_to :workflow
@@ -1,4 +1,4 @@
1
- class CreatePermissionTemplateAccess < ActiveRecord::Migration[4.2]
1
+ class CreatePermissionTemplateAccess < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :permission_template_accesses do |t|
4
4
  t.references :permission_template, foreign_key: true
@@ -1,4 +1,4 @@
1
- class AddReleaseToPermissionTemplates < ActiveRecord::Migration[4.2]
1
+ class AddReleaseToPermissionTemplates < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  add_column :permission_templates, :release_date, :date
4
4
  add_column :permission_templates, :release_period, :string
@@ -1,4 +1,4 @@
1
- class AddPermissionTemplateToSipityWorkflow < ActiveRecord::Migration[4.2]
1
+ class AddPermissionTemplateToSipityWorkflow < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  add_column :sipity_workflows, :permission_template_id, :integer, index: true
4
4
  remove_index :sipity_workflows, :name
@@ -1,4 +1,4 @@
1
- class TidyUpBecauseOfBadException < ActiveRecord::Migration[4.2]
1
+ class TidyUpBecauseOfBadException < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  if column_exists?(Hyrax::PermissionTemplate.table_name, :workflow_id)
4
4
  Hyrax::PermissionTemplate.all.each do |permission_template|
@@ -1,4 +1,4 @@
1
- class AddAllowsAccessGrantToWorkflow < ActiveRecord::Migration[4.2]
1
+ class AddAllowsAccessGrantToWorkflow < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  add_column :sipity_workflows, :allows_access_grant, :boolean
4
4
  end
@@ -1,4 +1,4 @@
1
- class ChangeChecksumAuditLog < ActiveRecord::Migration[5.0]
1
+ class ChangeChecksumAuditLog < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  rename_column :checksum_audit_logs, :version, :checked_uri
4
4
  add_column :checksum_audit_logs, :passed, :boolean
@@ -1,4 +1,4 @@
1
- class CreateJobIoWrappers < ActiveRecord::Migration[5.0]
1
+ class CreateJobIoWrappers < ActiveRecord::Migration<%= migration_version %>
2
2
  def change
3
3
  create_table :job_io_wrappers do |t|
4
4
  t.references :user
@@ -0,0 +1,5 @@
1
+ class AddPreferredLocaleToUsers < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ add_column :users, :preferred_locale, :string
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class AddUniqueConstraintToPermissionTemplateAccesses < ActiveRecord::Migration<%= migration_version %>
2
+ def change
3
+ add_index :permission_template_accesses,
4
+ [:permission_template_id, :agent_id, :agent_type, :access],
5
+ unique: true,
6
+ name: 'uk_permission_template_accesses'
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Hyrax
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
@@ -0,0 +1,8 @@
1
+ namespace :hyrax do
2
+ namespace :install do
3
+ desc 'Copy migrations from Hyrax to application'
4
+ task migrations: :environment do
5
+ Hyrax::DatabaseMigrator.copy
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,20 @@
1
+ RSpec.describe Hyrax::DatabaseMigrator do
2
+ describe '.copy' do
3
+ let(:mock_migrator) { double }
4
+
5
+ it 'creates an instance and calls #copy' do
6
+ expect(described_class).to receive(:new).once.and_return(mock_migrator)
7
+ expect(mock_migrator).to receive(:copy).once
8
+ described_class.copy
9
+ end
10
+ end
11
+
12
+ describe '#copy' do
13
+ let(:migrations_count) { subject.send(:migrations).count }
14
+
15
+ it 'uses #migration_template to copy all migrations to app' do
16
+ expect(subject).to receive(:migration_template).exactly(migrations_count).times
17
+ subject.copy
18
+ end
19
+ end
20
+ end
@@ -1,4 +1,4 @@
1
- gem 'hyrax', '2.0.0'
1
+ gem 'hyrax', '2.0.1'
2
2
  run 'bundle install'
3
3
  generate 'hyrax:install', '-f'
4
4
  rails_command 'db:migrate'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2017-11-09 00:00:00.000000000 Z
17
+ date: 2017-12-13 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rails
@@ -1466,6 +1466,7 @@ files:
1466
1466
  - app/services/hyrax/collections_service.rb
1467
1467
  - app/services/hyrax/contextual_path.rb
1468
1468
  - app/services/hyrax/curation_concern.rb
1469
+ - app/services/hyrax/database_migrator.rb
1469
1470
  - app/services/hyrax/default_middleware_stack.rb
1470
1471
  - app/services/hyrax/derivative_path.rb
1471
1472
  - app/services/hyrax/derivative_service.rb
@@ -1912,46 +1913,6 @@ files:
1912
1913
  - config/locales/simple_form.zh.yml
1913
1914
  - config/routes.rb
1914
1915
  - config/schema_org.yml
1915
- - db/migrate/20160328222152_create_version_committers.rb
1916
- - db/migrate/20160328222153_create_checksum_audit_logs.rb
1917
- - db/migrate/20160328222154_create_single_use_links.rb
1918
- - db/migrate/20160328222156_add_social_to_users.rb
1919
- - db/migrate/20160328222157_add_ldap_attrs_to_user.rb
1920
- - db/migrate/20160328222158_add_avatars_to_users.rb
1921
- - db/migrate/20160328222161_create_trophies.rb
1922
- - db/migrate/20160328222162_add_linkedin_to_users.rb
1923
- - db/migrate/20160328222163_create_tinymce_assets.rb
1924
- - db/migrate/20160328222164_create_content_blocks.rb
1925
- - db/migrate/20160328222165_create_featured_works.rb
1926
- - db/migrate/20160328222166_add_external_key_to_content_blocks.rb
1927
- - db/migrate/20160328222226_create_proxy_deposit_rights.rb
1928
- - db/migrate/20160328222227_create_proxy_deposit_requests.rb
1929
- - db/migrate/20160328222228_create_file_view_stats.rb
1930
- - db/migrate/20160328222229_create_file_download_stats.rb
1931
- - db/migrate/20160328222230_add_orcid_to_users.rb
1932
- - db/migrate/20160328222231_create_user_stats.rb
1933
- - db/migrate/20160328222232_create_work_view_stats.rb
1934
- - db/migrate/20160328222233_add_works_to_user_stats.rb
1935
- - db/migrate/20160328222236_change_trophy_generic_file_id_to_work_id.rb
1936
- - db/migrate/20160328222237_change_proxy_deposit_generic_file_id_to_work_id.rb
1937
- - db/migrate/20160328222238_change_audit_log_generic_file_id_to_file_set_id.rb
1938
- - db/migrate/20160328222239_change_proxy_deposit_request_generic_file_id_to_work_id.rb
1939
- - db/migrate/20160401142419_create_uploaded_files.rb
1940
- - db/migrate/20160415212015_create_features.rb
1941
- - db/migrate/20160427155928_create_operations.rb
1942
- - db/migrate/20160510000007_change_featured_work_generic_file_id_to_work_id.rb
1943
- - db/migrate/20160516190435_add_arkivo_to_users.rb
1944
- - db/migrate/20160919151348_create_sipity.rb
1945
- - db/migrate/20161012182404_create_sipity_workflow_methods.rb
1946
- - db/migrate/20161021175854_create_permission_template.rb
1947
- - db/migrate/20161021180154_create_permission_template_access.rb
1948
- - db/migrate/20161116222307_add_release_to_permission_templates.rb
1949
- - db/migrate/20170131142607_add_permission_template_to_sipity_workflow.rb
1950
- - db/migrate/20170307142607_tidy_up_because_of_bad_exception.rb
1951
- - db/migrate/20170308175556_add_allows_access_grant_to_workflow.rb
1952
- - db/migrate/20170504192714_change_checksum_audit_log.rb
1953
- - db/migrate/20170621201939_create_job_io_wrappers.rb
1954
- - db/migrate/20170905135339_add_preferred_locale_to_users.rb
1955
1916
  - hyrax.gemspec
1956
1917
  - lib/generators/hyrax/arkivo_api_generator.rb
1957
1918
  - lib/generators/hyrax/assets_generator.rb
@@ -1988,6 +1949,47 @@ files:
1988
1949
  - lib/generators/hyrax/templates/config/redis.yml
1989
1950
  - lib/generators/hyrax/templates/config/tinymce.yml
1990
1951
  - lib/generators/hyrax/templates/config/zotero.yml
1952
+ - lib/generators/hyrax/templates/db/migrate/20160328222152_create_version_committers.rb.erb
1953
+ - lib/generators/hyrax/templates/db/migrate/20160328222153_create_checksum_audit_logs.rb.erb
1954
+ - lib/generators/hyrax/templates/db/migrate/20160328222154_create_single_use_links.rb.erb
1955
+ - lib/generators/hyrax/templates/db/migrate/20160328222156_add_social_to_users.rb.erb
1956
+ - lib/generators/hyrax/templates/db/migrate/20160328222157_add_ldap_attrs_to_user.rb.erb
1957
+ - lib/generators/hyrax/templates/db/migrate/20160328222158_add_avatars_to_users.rb.erb
1958
+ - lib/generators/hyrax/templates/db/migrate/20160328222161_create_trophies.rb.erb
1959
+ - lib/generators/hyrax/templates/db/migrate/20160328222162_add_linkedin_to_users.rb.erb
1960
+ - lib/generators/hyrax/templates/db/migrate/20160328222163_create_tinymce_assets.rb.erb
1961
+ - lib/generators/hyrax/templates/db/migrate/20160328222164_create_content_blocks.rb.erb
1962
+ - lib/generators/hyrax/templates/db/migrate/20160328222165_create_featured_works.rb.erb
1963
+ - lib/generators/hyrax/templates/db/migrate/20160328222166_add_external_key_to_content_blocks.rb.erb
1964
+ - lib/generators/hyrax/templates/db/migrate/20160328222226_create_proxy_deposit_rights.rb.erb
1965
+ - lib/generators/hyrax/templates/db/migrate/20160328222227_create_proxy_deposit_requests.rb.erb
1966
+ - lib/generators/hyrax/templates/db/migrate/20160328222228_create_file_view_stats.rb.erb
1967
+ - lib/generators/hyrax/templates/db/migrate/20160328222229_create_file_download_stats.rb.erb
1968
+ - lib/generators/hyrax/templates/db/migrate/20160328222230_add_orcid_to_users.rb.erb
1969
+ - lib/generators/hyrax/templates/db/migrate/20160328222231_create_user_stats.rb.erb
1970
+ - lib/generators/hyrax/templates/db/migrate/20160328222232_create_work_view_stats.rb.erb
1971
+ - lib/generators/hyrax/templates/db/migrate/20160328222233_add_works_to_user_stats.rb.erb
1972
+ - lib/generators/hyrax/templates/db/migrate/20160328222236_change_trophy_generic_file_id_to_work_id.rb.erb
1973
+ - lib/generators/hyrax/templates/db/migrate/20160328222237_change_proxy_deposit_generic_file_id_to_work_id.rb.erb
1974
+ - lib/generators/hyrax/templates/db/migrate/20160328222238_change_audit_log_generic_file_id_to_file_set_id.rb.erb
1975
+ - lib/generators/hyrax/templates/db/migrate/20160328222239_change_proxy_deposit_request_generic_file_id_to_work_id.rb.erb
1976
+ - lib/generators/hyrax/templates/db/migrate/20160401142419_create_uploaded_files.rb.erb
1977
+ - lib/generators/hyrax/templates/db/migrate/20160415212015_create_features.rb.erb
1978
+ - lib/generators/hyrax/templates/db/migrate/20160427155928_create_operations.rb.erb
1979
+ - lib/generators/hyrax/templates/db/migrate/20160510000007_change_featured_work_generic_file_id_to_work_id.rb.erb
1980
+ - lib/generators/hyrax/templates/db/migrate/20160516190435_add_arkivo_to_users.rb.erb
1981
+ - lib/generators/hyrax/templates/db/migrate/20160919151348_create_sipity.rb.erb
1982
+ - lib/generators/hyrax/templates/db/migrate/20161012182404_create_sipity_workflow_methods.rb.erb
1983
+ - lib/generators/hyrax/templates/db/migrate/20161021175854_create_permission_template.rb.erb
1984
+ - lib/generators/hyrax/templates/db/migrate/20161021180154_create_permission_template_access.rb.erb
1985
+ - lib/generators/hyrax/templates/db/migrate/20161116222307_add_release_to_permission_templates.rb.erb
1986
+ - lib/generators/hyrax/templates/db/migrate/20170131142607_add_permission_template_to_sipity_workflow.rb.erb
1987
+ - lib/generators/hyrax/templates/db/migrate/20170307142607_tidy_up_because_of_bad_exception.rb.erb
1988
+ - lib/generators/hyrax/templates/db/migrate/20170308175556_add_allows_access_grant_to_workflow.rb.erb
1989
+ - lib/generators/hyrax/templates/db/migrate/20170504192714_change_checksum_audit_log.rb.erb
1990
+ - lib/generators/hyrax/templates/db/migrate/20170621201939_create_job_io_wrappers.rb.erb
1991
+ - lib/generators/hyrax/templates/db/migrate/20170905135339_add_preferred_locale_to_users.rb.erb
1992
+ - lib/generators/hyrax/templates/db/migrate/20171117153051_add_unique_constraint_to_permission_template_accesses.rb.erb
1991
1993
  - lib/generators/hyrax/templates/db/seeds.rb
1992
1994
  - lib/generators/hyrax/templates/hyrax.scss
1993
1995
  - lib/generators/hyrax/templates/hyrax_helper.rb
@@ -2056,6 +2058,7 @@ files:
2056
2058
  - lib/tasks/default_admin_set.rake
2057
2059
  - lib/tasks/hyrax.rake
2058
2060
  - lib/tasks/hyrax_user.rake
2061
+ - lib/tasks/install.rake
2059
2062
  - lib/tasks/migrate.rake
2060
2063
  - lib/tasks/reindex.rake
2061
2064
  - lib/tasks/stats_tasks.rake
@@ -2481,6 +2484,7 @@ files:
2481
2484
  - spec/services/hyrax/collection_size_service_spec.rb
2482
2485
  - spec/services/hyrax/collections_service_spec.rb
2483
2486
  - spec/services/hyrax/curation_concern_spec.rb
2487
+ - spec/services/hyrax/database_migrator_spec.rb
2484
2488
  - spec/services/hyrax/default_middleware_stack_spec.rb
2485
2489
  - spec/services/hyrax/derivative_path_spec.rb
2486
2490
  - spec/services/hyrax/derivative_service_spec.rb
@@ -3117,6 +3121,7 @@ test_files:
3117
3121
  - spec/services/hyrax/collection_size_service_spec.rb
3118
3122
  - spec/services/hyrax/collections_service_spec.rb
3119
3123
  - spec/services/hyrax/curation_concern_spec.rb
3124
+ - spec/services/hyrax/database_migrator_spec.rb
3120
3125
  - spec/services/hyrax/default_middleware_stack_spec.rb
3121
3126
  - spec/services/hyrax/derivative_path_spec.rb
3122
3127
  - spec/services/hyrax/derivative_service_spec.rb
@@ -1,5 +0,0 @@
1
- class AddLinkedinToUsers < ActiveRecord::Migration[4.2]
2
- def change
3
- add_column :users, :linkedin_handle, :string
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddOrcidToUsers < ActiveRecord::Migration[4.2]
2
- def change
3
- add_column :users, :orcid, :string
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddPreferredLocaleToUsers < ActiveRecord::Migration[4.2]
2
- def change
3
- add_column :users, :preferred_locale, :string
4
- end
5
- end