curation_concerns-models 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -0
  3. data/Rakefile +1 -1
  4. data/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +11 -19
  5. data/app/actors/curation_concerns/base_actor.rb +41 -45
  6. data/app/actors/curation_concerns/embargo_actor.rb +19 -0
  7. data/app/actors/curation_concerns/file_set_actor.rb +200 -0
  8. data/app/actors/curation_concerns/lease_actor.rb +19 -0
  9. data/app/actors/curation_concerns/work_actor_behavior.rb +55 -58
  10. data/app/indexers/curation_concerns/collection_indexer.rb +10 -0
  11. data/app/indexers/curation_concerns/file_set_indexing_service.rb +24 -0
  12. data/app/{services/curation_concerns/generic_work_indexing_service.rb → indexers/curation_concerns/work_indexing_service.rb} +6 -6
  13. data/app/jobs/active_fedora_id_based_job.rb +5 -12
  14. data/app/jobs/audit_job.rb +11 -17
  15. data/app/jobs/characterize_job.rb +8 -7
  16. data/app/jobs/create_derivatives_job.rb +8 -11
  17. data/app/jobs/import_url_job.rb +12 -25
  18. data/app/jobs/ingest_file_job.rb +16 -0
  19. data/app/jobs/ingest_local_file_job.rb +14 -35
  20. data/app/jobs/resolrize_job.rb +3 -5
  21. data/app/jobs/upload_set_update_job.rb +68 -0
  22. data/app/models/checksum_audit_log.rb +2 -3
  23. data/app/models/concerns/curation_concerns/ability.rb +18 -10
  24. data/app/models/concerns/curation_concerns/basic_metadata.rb +1 -3
  25. data/app/models/concerns/curation_concerns/collection_behavior.rb +13 -14
  26. data/app/models/concerns/curation_concerns/file_set/belongs_to_upload_sets.rb +15 -0
  27. data/app/models/concerns/curation_concerns/{generic_file → file_set}/belongs_to_works.rb +8 -14
  28. data/app/models/concerns/curation_concerns/file_set/derivatives.rb +54 -0
  29. data/app/models/concerns/curation_concerns/{generic_file → file_set}/full_text_indexing.rb +1 -2
  30. data/app/models/concerns/curation_concerns/{generic_file → file_set}/indexing.rb +2 -2
  31. data/app/models/concerns/curation_concerns/{generic_file → file_set}/versions.rb +2 -3
  32. data/app/models/concerns/curation_concerns/file_set_behavior.rb +36 -0
  33. data/app/models/concerns/curation_concerns/generic_file.rb +1 -1
  34. data/app/models/concerns/curation_concerns/has_representative.rb +6 -7
  35. data/app/models/concerns/curation_concerns/human_readable_type.rb +5 -7
  36. data/app/models/concerns/curation_concerns/permissions.rb +2 -2
  37. data/app/models/concerns/curation_concerns/permissions/readable.rb +0 -1
  38. data/app/models/concerns/curation_concerns/permissions/writable.rb +10 -51
  39. data/app/models/concerns/curation_concerns/serializers.rb +3 -5
  40. data/app/models/concerns/curation_concerns/solr_document_behavior.rb +37 -40
  41. data/app/models/concerns/curation_concerns/upload_set_behavior.rb +38 -0
  42. data/app/models/concerns/curation_concerns/user.rb +4 -51
  43. data/app/models/concerns/curation_concerns/with_file_sets.rb +28 -0
  44. data/app/models/concerns/curation_concerns/{generic_work_behavior.rb → work_behavior.rb} +12 -6
  45. data/app/models/curation_concerns/classify_concern.rb +7 -7
  46. data/app/models/curation_concerns/quick_classification_query.rb +6 -7
  47. data/app/models/single_use_link.rb +34 -0
  48. data/app/models/upload_set.rb +3 -0
  49. data/app/services/curation_concerns/derivative_path.rb +32 -0
  50. data/app/services/curation_concerns/{generic_file_audit_service.rb → file_set_audit_service.rb} +17 -18
  51. data/app/services/curation_concerns/indexes_thumbnails.rb +14 -0
  52. data/app/services/curation_concerns/local_file_service.rb +10 -0
  53. data/app/services/curation_concerns/lock_manager.rb +40 -0
  54. data/app/services/curation_concerns/noid.rb +1 -1
  55. data/app/services/curation_concerns/persist_derivatives.rb +33 -0
  56. data/app/services/curation_concerns/persist_directly_contained_output_file_service.rb +26 -0
  57. data/app/services/curation_concerns/repository_audit_service.rb +1 -3
  58. data/app/services/curation_concerns/thumbnail_path_service.rb +46 -0
  59. data/app/services/curation_concerns/time_service.rb +7 -0
  60. data/app/services/curation_concerns/versioning_service.rb +11 -12
  61. data/curation_concerns-models.gemspec +6 -6
  62. data/lib/curation_concerns/configuration.rb +154 -0
  63. data/lib/curation_concerns/messages.rb +26 -26
  64. data/lib/curation_concerns/models.rb +5 -14
  65. data/lib/curation_concerns/models/engine.rb +0 -30
  66. data/lib/curation_concerns/models/utils.rb +4 -4
  67. data/lib/curation_concerns/models/version.rb +1 -1
  68. data/lib/generators/curation_concerns/models/abstract_migration_generator.rb +8 -7
  69. data/lib/generators/curation_concerns/models/clamav_generator.rb +3 -3
  70. data/lib/generators/curation_concerns/models/install_generator.rb +13 -20
  71. data/lib/generators/curation_concerns/models/templates/app/models/file_set.rb +4 -0
  72. data/lib/generators/curation_concerns/models/templates/config/clamav.rb +1 -1
  73. data/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +52 -65
  74. data/lib/generators/curation_concerns/models/templates/config/redis_config.rb +13 -17
  75. data/lib/generators/curation_concerns/models/templates/config/resque_config.rb +2 -1
  76. data/lib/generators/curation_concerns/models/templates/migrations/create_checksum_audit_logs.rb +3 -3
  77. data/lib/generators/curation_concerns/models/templates/migrations/create_single_use_links.rb +12 -0
  78. data/lib/tasks/curation_concerns-models_tasks.rake +4 -62
  79. data/lib/tasks/migrate.rake +1 -1
  80. data/lib/tasks/resque.rake +1 -0
  81. data/lib/tasks/solr_reindex.rake +1 -1
  82. metadata +59 -52
  83. data/app/actors/curation_concerns/generic_file_actor.rb +0 -150
  84. data/app/jobs/active_fedora_pid_based_job.rb +0 -6
  85. data/app/jobs/copy_permissions_job.rb +0 -24
  86. data/app/models/concerns/curation_concerns/generic_file/characterization.rb +0 -89
  87. data/app/models/concerns/curation_concerns/generic_file/content.rb +0 -8
  88. data/app/models/concerns/curation_concerns/generic_file/export.rb +0 -343
  89. data/app/models/concerns/curation_concerns/generic_file_behavior.rb +0 -44
  90. data/app/models/concerns/curation_concerns/with_basic_metadata.rb +0 -98
  91. data/app/models/concerns/curation_concerns/with_generic_files.rb +0 -29
  92. data/app/models/datastreams/fits_datastream.rb +0 -148
  93. data/app/services/curation_concerns/characterization_service.rb +0 -71
  94. data/app/services/curation_concerns/full_text_extraction_service.rb +0 -38
  95. data/app/services/curation_concerns/generic_file_indexing_service.rb +0 -14
  96. data/lib/curation_concerns/models/resque.rb +0 -36
  97. data/lib/generators/curation_concerns/models/fulltext_generator.rb +0 -28
  98. data/lib/generators/curation_concerns/models/templates/app/models/generic_file.rb +0 -4
  99. data/lib/generators/curation_concerns/models/templates/config/resque_admin.rb +0 -10
@@ -20,14 +20,14 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_dependency 'active_attr'
23
- spec.add_dependency 'nest', '~> 1.1'
24
- spec.add_dependency 'hydra-collections', '~> 6.0.0.alpha'
25
- spec.add_dependency 'hydra-head', '~> 9.2.2'
26
- spec.add_dependency 'hydra-works', '~> 0.1'
27
- spec.add_dependency 'active-fedora', '~> 9.3.0'
28
- spec.add_dependency 'active_fedora-noid', '~> 1.0.2'
23
+ spec.add_dependency 'hydra-collections', '~> 6.0.0.rc1'
24
+ spec.add_dependency 'hydra-head', '~> 9.3'
25
+ spec.add_dependency 'hydra-works', '~> 0.3'
26
+ spec.add_dependency 'active_fedora-noid', '~> 1.0'
29
27
  spec.add_dependency 'resque', '~> 1.23'
30
28
  spec.add_dependency 'resque-pool', '~> 0.3'
29
+ spec.add_dependency 'qa', '~> 0.5'
30
+ spec.add_dependency 'redlock', '~> 0.1.2'
31
31
 
32
32
  spec.add_development_dependency 'bundler', '~> 1.6'
33
33
  spec.add_development_dependency 'rake'
@@ -0,0 +1,154 @@
1
+ require 'curation_concerns/callbacks'
2
+
3
+ module CurationConcerns
4
+ extend Deprecation
5
+ class << self
6
+ attr_accessor :config
7
+ end
8
+
9
+ def self.configure
10
+ self.config ||= Configuration.new
11
+ yield(config)
12
+ end
13
+
14
+ # Keep this deprecated class here so that anyone that references it in their config gets a deprecation rather than uninitialized constant.
15
+ # Remove when Configuration#queue= is removed
16
+ module Resque
17
+ class Queue
18
+ end
19
+ end
20
+
21
+ class Configuration
22
+ include Callbacks
23
+
24
+ # An anonymous function that receives a path to a file
25
+ # and returns AntiVirusScanner::NO_VIRUS_FOUND_RETURN_VALUE if no
26
+ # virus is found; Any other returned value means a virus was found
27
+ attr_writer :default_antivirus_instance
28
+ def default_antivirus_instance
29
+ @default_antivirus_instance ||= lambda do|_file_path|
30
+ AntiVirusScanner::NO_VIRUS_FOUND_RETURN_VALUE
31
+ end
32
+ end
33
+
34
+ # Path on the local file system where derivatives will be stored
35
+ attr_writer :derivatives_path
36
+ def derivatives_path
37
+ @derivatives_path ||= File.join(Rails.root, 'tmp', 'derivatives')
38
+ end
39
+
40
+ # Path on the local file system where originals will be staged before being ingested into Fedora.
41
+ attr_writer :working_path
42
+ def working_path
43
+ @working_path ||= File.join(Rails.root, 'tmp', 'uploads')
44
+ end
45
+
46
+ attr_writer :enable_ffmpeg
47
+ def enable_ffmpeg
48
+ return @enable_ffmpeg unless @enable_ffmpeg.nil?
49
+ @enable_ffmpeg = false
50
+ end
51
+
52
+ attr_writer :ffmpeg_path
53
+ def ffmpeg_path
54
+ @ffmpeg_path ||= 'ffmpeg'
55
+ end
56
+
57
+ attr_writer :fits_message_length
58
+ def fits_message_length
59
+ @fits_message_length ||= 5
60
+ end
61
+
62
+ attr_accessor :temp_file_base, :enable_local_ingest, :analytic_start_date,
63
+ :fits_to_desc_mapping, :max_days_between_audits,
64
+ :resource_types, :resource_types_to_schema,
65
+ :permission_levels, :owner_permission_levels, :analytics
66
+
67
+ attr_writer :enable_noids
68
+ def enable_noids
69
+ return @enable_noids unless @enable_noids.nil?
70
+ @enable_noids = true
71
+ end
72
+
73
+ attr_writer :noid_template
74
+ def noid_template
75
+ @noid_template ||= '.reeddeeddk'
76
+ end
77
+
78
+ attr_writer :minter_statefile
79
+ def minter_statefile
80
+ @minter_statefile ||= '/tmp/minter-state'
81
+ end
82
+
83
+ attr_writer :redis_namespace
84
+ def redis_namespace
85
+ @redis_namespace ||= 'curation_concerns'
86
+ end
87
+
88
+ attr_writer :queue
89
+ deprecation_deprecate :queue=
90
+
91
+ attr_writer :fits_path
92
+ def fits_path
93
+ @fits_path ||= 'fits.sh'
94
+ end
95
+
96
+ # Override characterization runner
97
+ attr_accessor :characterization_runner
98
+
99
+ # Attributes for the lock manager which ensures a single process/thread is mutating a ore:Aggregation at once.
100
+ # @!attribute [w] lock_retry_count
101
+ # How many times to retry to acquire the lock before raising UnableToAcquireLockError
102
+ attr_writer :lock_retry_count
103
+ def lock_retry_count
104
+ @lock_retry_count ||= 600 # Up to 2 minutes of trying at intervals up to 200ms
105
+ end
106
+
107
+ # @!attribute [w] lock_time_to_live
108
+ # How long to hold the lock in milliseconds
109
+ attr_writer :lock_time_to_live
110
+ def lock_time_to_live
111
+ @lock_time_to_live ||= 60_000 # milliseconds
112
+ end
113
+
114
+ # @!attribute [w] lock_retry_delay
115
+ # Maximum wait time in milliseconds before retrying. Wait time is a random value between 0 and retry_delay.
116
+ attr_writer :lock_retry_delay
117
+ def lock_retry_delay
118
+ @lock_retry_delay ||= 200 # milliseconds
119
+ end
120
+
121
+ callback.enable :after_create_content, :after_update_content,
122
+ :after_revert_content, :after_update_metadata,
123
+ :after_import_local_file_success,
124
+ :after_import_local_file_failure, :after_audit_failure,
125
+ :after_destroy, :after_import_url_success, :after_import_url_failure
126
+
127
+ def register_curation_concern(*curation_concern_types)
128
+ Array(curation_concern_types).flatten.compact.each do |cc_type|
129
+ class_name = normalize_concern_name(cc_type)
130
+ unless registered_curation_concern_types.include?(class_name)
131
+ registered_curation_concern_types << class_name
132
+ end
133
+ end
134
+ end
135
+
136
+ # Returns the class names (strings) of the registered curation concerns
137
+ def registered_curation_concern_types
138
+ @registered_curation_concern_types ||= []
139
+ end
140
+
141
+ # Returns the classes of the registered curation concerns
142
+ def curation_concerns
143
+ registered_curation_concern_types.map(&:constantize)
144
+ end
145
+
146
+ private
147
+
148
+ def normalize_concern_name(c)
149
+ c.to_s.camelize
150
+ end
151
+ end
152
+
153
+ configure {}
154
+ end
@@ -8,59 +8,59 @@ module CurationConcerns
8
8
  include ActionView::Helpers::UrlHelper
9
9
 
10
10
  def success_subject
11
- I18n.t("curation_concerns.messages.success.subject")
11
+ I18n.t('curation_concerns.messages.success.subject')
12
12
  end
13
13
 
14
14
  def failure_subject
15
- I18n.t("curation_concerns.messages.failure.subject")
15
+ I18n.t('curation_concerns.messages.failure.subject')
16
16
  end
17
17
 
18
- def single_success id, file
19
- content_tag :span, id: "ss-"+id do
20
- [link_to_file(file), I18n.t("curation_concerns.messages.success.single")].join(" ").html_safe
18
+ def single_success(id, file)
19
+ content_tag :span, id: 'ss-' + id do
20
+ [link_to_file(file), I18n.t('curation_concerns.messages.success.single')].join(' ').html_safe
21
21
  end
22
22
  end
23
23
 
24
- def multiple_success id, files
25
- content_tag :span, id: "ss-"+id do
26
- [success_link(files), I18n.t("curation_concerns.messages.success.multiple.tag")].join(" ").html_safe
24
+ def multiple_success(id, files)
25
+ content_tag :span, id: 'ss-' + id do
26
+ [success_link(files), I18n.t('curation_concerns.messages.success.multiple.tag')].join(' ').html_safe
27
27
  end
28
28
  end
29
29
 
30
- def single_failure id, file
31
- content_tag :span, id: "ss-"+id do
32
- [link_to_file(file), I18n.t("curation_concerns.messages.failure.single")].join(" ").html_safe
30
+ def single_failure(id, file)
31
+ content_tag :span, id: 'ss-' + id do
32
+ [link_to_file(file), I18n.t('curation_concerns.messages.failure.single')].join(' ').html_safe
33
33
  end
34
34
  end
35
35
 
36
- def multiple_failure id, files
37
- content_tag :span, id: "ss-"+id do
38
- [failure_link(files), I18n.t("curation_concerns.messages.failure.multiple.tag")].join(" ").html_safe
36
+ def multiple_failure(id, files)
37
+ content_tag :span, id: 'ss-' + id do
38
+ [failure_link(files), I18n.t('curation_concerns.messages.failure.multiple.tag')].join(' ').html_safe
39
39
  end
40
40
  end
41
41
 
42
42
  # Double-quotes are replaced with single ones so this list can be included in a data block. Ex:
43
43
  # <a href="#" data-content="<a href='#'>embedded link</a>" rel="popover">Click me</a>
44
- def file_list files
45
- files.map { |gf| link_to_file(gf) }.join(', ').gsub(/"/, "'")
44
+ def file_list(files)
45
+ files.map { |gf| link_to_file(gf) }.join(', ').tr("\"", "'")
46
46
  end
47
47
 
48
- def link_to_file file
49
- link_to(file.to_s, Rails.application.class.routes.url_helpers.curation_concerns_generic_file_path(file))
48
+ def link_to_file(file)
49
+ link_to(file.to_s, Rails.application.class.routes.url_helpers.curation_concerns_file_set_path(file))
50
50
  end
51
51
 
52
52
  private
53
53
 
54
- def success_link files
55
- link_to I18n.t("curation_concerns.messages.success.multiple.link"), "#",
56
- rel: "popover",
57
- data: { content: file_list(files).html_safe, title: I18n.t("curation_concerns.messages.success.title") }
54
+ def success_link(files)
55
+ link_to I18n.t('curation_concerns.messages.success.multiple.link'), '#',
56
+ rel: 'popover',
57
+ data: { content: file_list(files).html_safe, title: I18n.t('curation_concerns.messages.success.title') }
58
58
  end
59
59
 
60
- def failure_link files
61
- link_to I18n.t("curation_concerns.messages.failure.multiple.link"), "#",
62
- rel: "popover",
63
- data: { content: file_list(files).html_safe, title: I18n.t("curation_concerns.messages.failure.title") }
60
+ def failure_link(files)
61
+ link_to I18n.t('curation_concerns.messages.failure.multiple.link'), '#',
62
+ rel: 'popover',
63
+ data: { content: file_list(files).html_safe, title: I18n.t('curation_concerns.messages.failure.title') }
64
64
  end
65
65
  end
66
66
  end
@@ -1,11 +1,7 @@
1
- require "curation_concerns/models/version"
2
- require "curation_concerns/models/engine"
1
+ require 'curation_concerns/models/version'
2
+ require 'curation_concerns/models/engine'
3
3
 
4
4
  require 'hydra/head'
5
- require 'nest'
6
- # require "active_resource" # used by GenericFile to catch errors & by GeoNamesResource
7
- require 'resque/server'
8
-
9
5
  module CurationConcerns
10
6
  extend ActiveSupport::Autoload
11
7
 
@@ -15,18 +11,13 @@ module CurationConcerns
15
11
  autoload :Utils, 'curation_concerns/models/utils'
16
12
  autoload :Permissions
17
13
  autoload :Messages
14
+ eager_autoload do
15
+ autoload :Configuration
16
+ end
18
17
 
19
18
  attr_writer :queue
20
19
 
21
20
  def self.queue
22
21
  @queue ||= config.queue.new('curation_concerns')
23
22
  end
24
-
25
- def self.config(&block)
26
- @@config ||= CurationConcerns::Models::Engine::Configuration.new
27
-
28
- yield @@config if block
29
-
30
- return @@config
31
- end
32
23
  end
@@ -1,34 +1,6 @@
1
1
  module CurationConcerns
2
2
  module Models
3
-
4
- def self.config(&block)
5
- @@config ||= Engine::Configuration.new
6
- yield @@config if block
7
- return @@config
8
- end
9
-
10
-
11
3
  class Engine < ::Rails::Engine
12
-
13
- require 'curation_concerns/models/resque'
14
-
15
- # Set some configuration defaults
16
- config.persistent_hostpath = "http://localhost/files/"
17
- config.enable_ffmpeg = false
18
- config.ffmpeg_path = 'ffmpeg'
19
- config.fits_message_length = 5
20
- config.temp_file_base = nil
21
- config.enable_noids = true
22
- config.noid_template = '.reeddeeddk'
23
- config.minter_statefile = '/tmp/minter-state'
24
- config.redis_namespace = "curation_concerns"
25
- config.fits_path = "fits.sh"
26
- config.enable_local_ingest = nil
27
- config.queue = CurationConcerns::Resque::Queue
28
-
29
- # Defaulting analytic start date to whenever the file was uploaded by leaving it blank
30
- config.analytic_start_date = nil
31
-
32
4
  config.autoload_paths += %W(
33
5
  #{config.root}/app/actors/concerns
34
6
  #{config.root}/lib/curation_concerns
@@ -54,8 +26,6 @@ module CurationConcerns
54
26
  ActiveFedora::Noid.config.statefile = c.minter_statefile
55
27
  end
56
28
  end
57
-
58
29
  end
59
-
60
30
  end
61
31
  end
@@ -8,14 +8,14 @@ module CurationConcerns
8
8
 
9
9
  module ClassMethods
10
10
  def retry_unless(number_of_tries, condition, &block)
11
- raise ArgumentError, "First argument must be an enumerator" unless number_of_tries.is_a? Enumerator
12
- raise ArgumentError, "Second argument must be a lambda" unless condition.respond_to? :call
13
- raise ArgumentError, "Must pass a block of code to retry" unless block_given?
11
+ fail ArgumentError, 'First argument must be an enumerator' unless number_of_tries.is_a? Enumerator
12
+ fail ArgumentError, 'Second argument must be a lambda' unless condition.respond_to? :call
13
+ fail ArgumentError, 'Must pass a block of code to retry' unless block_given?
14
14
  number_of_tries.each do
15
15
  result = block.call
16
16
  return result unless condition.call
17
17
  end
18
- raise RuntimeError, "retry_unless could not complete successfully. Try upping the # of tries?"
18
+ fail 'retry_unless could not complete successfully. Try upping the # of tries?'
19
19
  end
20
20
  end
21
21
  end
@@ -1,5 +1,5 @@
1
1
  module CurationConcerns
2
2
  module Models
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -11,10 +11,11 @@ class CurationConcerns::Models::AbstractMigrationGenerator < Rails::Generators::
11
11
  if @prev_migration_nr
12
12
  @prev_migration_nr += 1
13
13
  else
14
- if last_migration = Dir[File.join(path, '*.rb')].sort.last
14
+ last_migration = Dir[File.join(path, '*.rb')].sort.last
15
+ if last_migration
15
16
  @prev_migration_nr = last_migration.sub(File.join(path, '/'), '').to_i + 1
16
17
  else
17
- @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
18
+ @prev_migration_nr = Time.now.utc.strftime('%Y%m%d%H%M%S').to_i
18
19
  end
19
20
  end
20
21
  @prev_migration_nr.to_s
@@ -22,9 +23,9 @@ class CurationConcerns::Models::AbstractMigrationGenerator < Rails::Generators::
22
23
 
23
24
  protected
24
25
 
25
- def better_migration_template(file)
26
- migration_template "migrations/#{file}", "db/migrate/#{file}"
27
- rescue Rails::Generators::Error => e
28
- say_status("warning", e.message, :yellow)
29
- end
26
+ def better_migration_template(file)
27
+ migration_template "migrations/#{file}", "db/migrate/#{file}"
28
+ rescue Rails::Generators::Error => e
29
+ say_status('warning', e.message, :yellow)
30
+ end
30
31
  end
@@ -4,13 +4,13 @@ require 'rails/generators'
4
4
  class CurationConcerns::Models::ClamavGenerator < Rails::Generators::Base
5
5
  source_root File.expand_path('../templates', __FILE__)
6
6
 
7
- desc """
7
+ desc ''"
8
8
  This generator makes the following changes to your application:
9
9
  1. Generates clamav initializer
10
- """
10
+ "''
11
11
 
12
12
  def banner
13
- say_status("info", "Generating clamav initializers", :blue)
13
+ say_status('info', 'Generating clamav initializers', :blue)
14
14
  end
15
15
 
16
16
  def create_initializer_file
@@ -2,23 +2,24 @@ require_relative 'abstract_migration_generator'
2
2
 
3
3
  class CurationConcerns::Models::InstallGenerator < CurationConcerns::Models::AbstractMigrationGenerator
4
4
  source_root File.expand_path('../templates', __FILE__)
5
- argument :model_name, type: :string , default: "user"
6
- desc """
5
+ argument :model_name, type: :string, default: 'user'
6
+ desc ''"
7
7
  This generator makes the following changes to your application:
8
8
  1. Creates several database migrations if they do not exist in /db/migrate
9
9
  2. Creates the curation_concerns.rb configuration file and several others
10
- 3. Creates the generic_file.rb, generic_work.rb and collection.rb models
10
+ 3. Creates the file_set.rb, generic_work.rb and collection.rb models
11
11
  4. Runs full-text generator
12
- """
12
+ "''
13
13
  def banner
14
- say_status("warning", "GENERATING CURATION_CONCERNS MODELS", :yellow)
14
+ say_status('warning', 'GENERATING CURATION_CONCERNS MODELS', :yellow)
15
15
  end
16
16
 
17
17
  # Setup the database migrations
18
18
  def copy_migrations
19
19
  [
20
- "create_version_committers.rb",
21
- "create_checksum_audit_logs.rb"#,
20
+ 'create_version_committers.rb',
21
+ 'create_checksum_audit_logs.rb',
22
+ 'create_single_use_links.rb' # ,
22
23
  ].each do |file|
23
24
  better_migration_template file
24
25
  end
@@ -27,9 +28,9 @@ This generator makes the following changes to your application:
27
28
  # Add behaviors to the user model
28
29
  def inject_curation_concerns_user_behavior
29
30
  file_path = "app/models/#{model_name.underscore}.rb"
30
- if File.exists?(file_path)
31
+ if File.exist?(file_path)
31
32
  inject_into_file file_path, after: /include Hydra\:\:User.*$/ do
32
- "\n # Connects this user object to Curation Concerns behaviors." +
33
+ "\n # Connects this user object to Curation Concerns behaviors." \
33
34
  "\n include CurationConcerns::User\n"
34
35
  end
35
36
  else
@@ -39,12 +40,11 @@ This generator makes the following changes to your application:
39
40
 
40
41
  def create_configuration_files
41
42
  append_file 'config/initializers/mime_types.rb',
42
- "\nMime::Type.register 'application/x-endnote-refer', :endnote", {verbose: false }
43
+ "\nMime::Type.register 'application/x-endnote-refer', :endnote", verbose: false
43
44
  copy_file 'config/curation_concerns.rb', 'config/initializers/curation_concerns.rb'
44
45
  copy_file 'config/redis.yml', 'config/redis.yml'
45
46
  copy_file 'config/resque-pool.yml', 'config/resque-pool.yml'
46
47
  copy_file 'config/redis_config.rb', 'config/initializers/redis_config.rb'
47
- copy_file 'config/resque_admin.rb', 'config/initializers/resque_admin.rb'
48
48
  copy_file 'config/resque_config.rb', 'config/initializers/resque_config.rb'
49
49
  end
50
50
 
@@ -52,19 +52,12 @@ This generator makes the following changes to your application:
52
52
  copy_file 'app/models/collection.rb', 'app/models/collection.rb'
53
53
  end
54
54
 
55
- def create_generic_file
56
- copy_file 'app/models/generic_file.rb', 'app/models/generic_file.rb'
57
- end
58
-
59
- # Sets up full-text indexing (Solr config + jars)
60
- def full_text_indexing
61
- generate "curation_concerns:models:fulltext"
55
+ def create_file_set
56
+ copy_file 'app/models/file_set.rb', 'app/models/file_set.rb'
62
57
  end
63
58
 
64
59
  # Adds clamav initializtion
65
60
  def clamav
66
61
  generate 'curation_concerns:models:clamav'
67
62
  end
68
-
69
-
70
63
  end