sufia 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -5
- data/CONTRIBUTING.md +4 -4
- data/Gemfile +2 -1
- data/History.md +69 -0
- data/README.md +84 -4
- data/SUFIA_VERSION +1 -1
- data/app/assets/images/zotero.png +0 -0
- data/app/assets/javascripts/sufia/featured_works.js +20 -3
- data/app/assets/stylesheets/generic_files.css.erb +2 -2
- data/app/assets/stylesheets/sufia.css.scss +2 -2
- data/app/assets/stylesheets/sufia/_buttons.scss +2 -2
- data/app/assets/stylesheets/sufia/_collections.scss +4 -4
- data/app/assets/stylesheets/sufia/_dashboard.scss +1 -1
- data/app/assets/stylesheets/sufia/_file-listing.scss +3 -0
- data/app/assets/stylesheets/sufia/_modal.scss +4 -0
- data/app/assets/stylesheets/sufia/_settings.scss +4 -3
- data/app/assets/stylesheets/sufia/_styles.scss +4 -0
- data/app/controllers/admin/stats_controller.rb +68 -0
- data/app/controllers/api/items_controller.rb +78 -0
- data/app/controllers/api/zotero_controller.rb +70 -0
- data/app/controllers/authorities_controller.rb +6 -5
- data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +2 -1
- data/app/controllers/concerns/sufia/breadcrumbs.rb +1 -1
- data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +11 -0
- data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +1 -1
- data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +1 -1
- data/app/controllers/concerns/sufia/files_controller_behavior.rb +23 -11
- data/app/controllers/concerns/sufia/my_controller_behavior.rb +1 -7
- data/app/controllers/concerns/sufia/users_controller_behavior.rb +1 -2
- data/app/controllers/my/collections_controller.rb +1 -0
- data/app/controllers/my/files_controller.rb +1 -1
- data/app/helpers/sufia/sufia_helper_behavior.rb +28 -16
- data/app/models/my_search_builder.rb +4 -0
- data/app/search_builders/sufia/my_search_builder_behavior.rb +20 -0
- data/app/search_builders/sufia/search_builder.rb +1 -1
- data/app/views/admin/stats/index.html.erb +68 -0
- data/app/views/collections/_action_menu.html.erb +22 -20
- data/app/views/collections/_collection.html.erb +1 -1
- data/app/views/collections/_form_for_select_collection.html.erb +5 -3
- data/app/views/generic_files/_show_actions.html.erb +4 -2
- data/app/views/generic_files/show.html.erb +1 -1
- data/app/views/layouts/sufia-dashboard.html.erb +5 -4
- data/app/views/layouts/sufia-one-column.html.erb +2 -0
- data/app/views/layouts/sufia-two-column.html.erb +6 -4
- data/app/views/my/_facet_layout.html.erb +2 -2
- data/app/views/my/_facets.html.erb +4 -6
- data/app/views/my/index.html.erb +4 -3
- data/app/views/users/_edit_primary.html.erb +18 -17
- data/app/views/users/_follower_modal.html.erb +5 -1
- data/app/views/users/_following_modal.html.erb +5 -1
- data/app/views/users/_user_info.html.erb +6 -1
- data/app/views/users/_zotero.html.erb +12 -0
- data/config/locales/sufia.en.yml +10 -1
- data/config/routes.rb +23 -1
- data/lib/generators/sufia/admin_stat_generator.rb +17 -0
- data/lib/generators/sufia/install_generator.rb +8 -3
- data/{sufia-models/lib/generators/sufia/models/templates/config/resque_admin.rb → lib/generators/sufia/templates/sufia/stats_admin.rb} +3 -3
- data/lib/generators/sufia/upgrade400_generator.rb +2 -2
- data/lib/sufia.rb +3 -0
- data/lib/sufia/arkivo.rb +11 -0
- data/lib/sufia/arkivo/actor.rb +95 -0
- data/lib/sufia/arkivo/config.rb +11 -0
- data/lib/sufia/arkivo/create_subscription_job.rb +67 -0
- data/lib/sufia/arkivo/metadata_munger.rb +51 -0
- data/lib/sufia/arkivo/schema_validator.rb +55 -0
- data/lib/sufia/form_builder.rb +1 -1
- data/lib/sufia/inflections.rb +3 -0
- data/lib/sufia/version.rb +1 -1
- data/lib/sufia/zotero.rb +6 -0
- data/lib/sufia/zotero/config.rb +15 -0
- data/solr_conf/conf/solrconfig.xml +11 -0
- data/spec/controllers/admin_stats_controller_spec.rb +73 -0
- data/spec/controllers/api/items_controller_spec.rb +476 -0
- data/spec/controllers/api/zotero_controller_spec.rb +178 -0
- data/spec/controllers/batch_edits_controller_spec.rb +7 -0
- data/spec/controllers/collections_controller_spec.rb +1 -1
- data/spec/controllers/dashboard_controller_spec.rb +1 -1
- data/spec/controllers/depositors_controller_spec.rb +9 -5
- data/spec/controllers/generic_files_controller_spec.rb +5 -4
- data/spec/controllers/mailbox_controller_spec.rb +2 -2
- data/spec/controllers/my/collections_controller_spec.rb +1 -2
- data/spec/controllers/my/files_controller_spec.rb +5 -5
- data/spec/controllers/my/shares_controller_spec.rb +15 -3
- data/spec/controllers/pages_controller_spec.rb +1 -1
- data/spec/controllers/users_controller_spec.rb +10 -9
- data/spec/factories/api_items.rb +91 -0
- data/spec/factories/generic_files.rb +4 -0
- data/spec/factories/users.rb +4 -4
- data/spec/features/featured_item_spec.rb +26 -0
- data/spec/features/ingest_upload_files_spec.rb +2 -3
- data/spec/features/proxy_spec.rb +0 -1
- data/spec/helpers/permissions_helper_spec.rb +2 -2
- data/spec/helpers/sufia_helper_spec.rb +11 -5
- data/spec/inputs/select_with_help_input_spec.rb +2 -2
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/helpers/jasmine-jquery.js +832 -0
- data/spec/javascripts/jasmine_spec.rb +31 -0
- data/spec/javascripts/notify_update_link_spec.js +8 -0
- data/spec/javascripts/single_use_link_spec.js.coffee +23 -0
- data/spec/javascripts/support/jasmine.yml +124 -0
- data/spec/javascripts/support/jasmine_helper.rb +15 -0
- data/spec/javascripts/terms_of_service_spec.js.coffee +32 -0
- data/spec/javascripts/toggle_icon_spec.js +11 -0
- data/spec/jobs/active_fedora_id_based_job_spec.rb +3 -3
- data/spec/jobs/import_url_job_spec.rb +0 -2
- data/spec/lib/sufia/arkivo/actor_spec.rb +139 -0
- data/spec/lib/sufia/arkivo/create_subscription_job_spec.rb +54 -0
- data/spec/lib/sufia/arkivo/metadata_munger_spec.rb +48 -0
- data/spec/lib/sufia/arkivo/schema_validator_spec.rb +65 -0
- data/spec/lib/sufia/upload_complete_behavior_spec.rb +1 -1
- data/spec/lib/sufia/user_stat_importer_spec.rb +60 -0
- data/spec/lib/sufia/zotero/config_spec.rb +30 -0
- data/spec/models/collection_spec.rb +36 -7
- data/spec/models/file_download_stat_spec.rb +5 -5
- data/spec/models/file_usage_spec.rb +23 -0
- data/spec/models/file_view_stat_spec.rb +6 -6
- data/spec/models/fits_datastream_spec.rb +0 -5
- data/spec/models/generic_file_spec.rb +49 -14
- data/spec/models/local_authority_spec.rb +1 -1
- data/spec/models/proxy_deposit_request_spec.rb +1 -1
- data/spec/models/trophy_spec.rb +8 -8
- data/spec/models/user_spec.rb +33 -0
- data/spec/presenters/sufia/collection_presenter_spec.rb +1 -1
- data/spec/routing/api_route_spec.rb +91 -0
- data/spec/routing/route_spec.rb +1 -1
- data/spec/services/generic_file_audit_service_spec.rb +44 -8
- data/spec/spec_helper.rb +18 -3
- data/spec/support/features.rb +0 -2
- data/spec/support/locations.rb +0 -21
- data/spec/support/rake.rb +41 -0
- data/spec/support/selectors.rb +0 -50
- data/spec/tasks/rake_spec.rb +33 -12
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -0
- data/spec/views/admin/stats/index.html.erb_spec.rb +45 -0
- data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +0 -1
- data/spec/views/dashboard/index_spec.rb +1 -1
- data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
- data/spec/views/generic_file/show.html.erb_spec.rb +1 -3
- data/spec/views/users/_follower_modal.html.erb_spec.rb +44 -7
- data/spec/views/users/_following_modal.html.erb_spec.rb +49 -7
- data/spec/views/users/edit.html.erb_spec.rb +72 -0
- data/spec/views/users/show.html.erb_spec.rb +1 -1
- data/sufia.gemspec +6 -2
- data/tasks/sufia-user.rake +14 -0
- metadata +130 -156
- data/spec/lib/sufia/id_service_spec.rb +0 -32
- data/spec/services/noid_spec.rb +0 -9
- data/spec/support/poltergeist.rb +0 -11
- data/spec/support/rake_output.rb +0 -20
- data/sufia-models/.gitignore +0 -17
- data/sufia-models/Gemfile +0 -4
- data/sufia-models/LICENSE.md +0 -177
- data/sufia-models/README.md +0 -39
- data/sufia-models/Rakefile +0 -1
- data/sufia-models/app/actors/sufia/generic_file/actor.rb +0 -137
- data/sufia-models/app/jobs/active_fedora_id_based_job.rb +0 -22
- data/sufia-models/app/jobs/active_fedora_pid_based_job.rb +0 -7
- data/sufia-models/app/jobs/audit_job.rb +0 -62
- data/sufia-models/app/jobs/batch_update_job.rb +0 -72
- data/sufia-models/app/jobs/characterize_job.rb +0 -10
- data/sufia-models/app/jobs/create_derivatives_job.rb +0 -14
- data/sufia-models/app/jobs/import_url_job.rb +0 -52
- data/sufia-models/app/jobs/ingest_local_file_job.rb +0 -46
- data/sufia-models/app/jobs/resolrize_job.rb +0 -9
- data/sufia-models/app/models/batch.rb +0 -36
- data/sufia-models/app/models/checksum_audit_log.rb +0 -21
- data/sufia-models/app/models/concerns/sufia/ability.rb +0 -61
- data/sufia-models/app/models/concerns/sufia/collection_behavior.rb +0 -24
- data/sufia-models/app/models/concerns/sufia/file_stat_utils.rb +0 -35
- data/sufia-models/app/models/concerns/sufia/generic_file.rb +0 -25
- data/sufia-models/app/models/concerns/sufia/generic_file/batches.rb +0 -28
- data/sufia-models/app/models/concerns/sufia/generic_file/characterization.rb +0 -89
- data/sufia-models/app/models/concerns/sufia/generic_file/content.rb +0 -13
- data/sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb +0 -26
- data/sufia-models/app/models/concerns/sufia/generic_file/export.rb +0 -343
- data/sufia-models/app/models/concerns/sufia/generic_file/featured.rb +0 -11
- data/sufia-models/app/models/concerns/sufia/generic_file/full_text_indexing.rb +0 -43
- data/sufia-models/app/models/concerns/sufia/generic_file/indexing.rb +0 -14
- data/sufia-models/app/models/concerns/sufia/generic_file/metadata.rb +0 -98
- data/sufia-models/app/models/concerns/sufia/generic_file/mime_types.rb +0 -69
- data/sufia-models/app/models/concerns/sufia/generic_file/permissions.rb +0 -11
- data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +0 -31
- data/sufia-models/app/models/concerns/sufia/generic_file/trophies.rb +0 -14
- data/sufia-models/app/models/concerns/sufia/generic_file/versions.rb +0 -16
- data/sufia-models/app/models/concerns/sufia/generic_file/virus_check.rb +0 -37
- data/sufia-models/app/models/concerns/sufia/model_methods.rb +0 -20
- data/sufia-models/app/models/concerns/sufia/user.rb +0 -137
- data/sufia-models/app/models/concerns/sufia/user_usage_stats.rb +0 -15
- data/sufia-models/app/models/datastreams/file_content_datastream.rb +0 -4
- data/sufia-models/app/models/datastreams/fits_datastream.rb +0 -152
- data/sufia-models/app/models/domain_term.rb +0 -5
- data/sufia-models/app/models/featured_work.rb +0 -22
- data/sufia-models/app/models/file_download_stat.rb +0 -18
- data/sufia-models/app/models/file_usage.rb +0 -34
- data/sufia-models/app/models/file_view_stat.rb +0 -18
- data/sufia-models/app/models/follow.rb +0 -12
- data/sufia-models/app/models/generic_file.rb +0 -3
- data/sufia-models/app/models/geo_names_resource.rb +0 -18
- data/sufia-models/app/models/group.rb +0 -8
- data/sufia-models/app/models/local_authority.rb +0 -86
- data/sufia-models/app/models/local_authority_entry.rb +0 -3
- data/sufia-models/app/models/proxy_deposit_request.rb +0 -85
- data/sufia-models/app/models/proxy_deposit_rights.rb +0 -4
- data/sufia-models/app/models/single_use_link.rb +0 -42
- data/sufia-models/app/models/subject_local_authority_entry.rb +0 -2
- data/sufia-models/app/models/sufia/avatar_uploader.rb +0 -20
- data/sufia-models/app/models/sufia/avatar_validator.rb +0 -8
- data/sufia-models/app/models/sufia/collection.rb +0 -5
- data/sufia-models/app/models/sufia/download.rb +0 -9
- data/sufia-models/app/models/sufia/orcid_validator.rb +0 -12
- data/sufia-models/app/models/sufia/pageview.rb +0 -9
- data/sufia-models/app/models/trophy.rb +0 -10
- data/sufia-models/app/models/user_stat.rb +0 -2
- data/sufia-models/app/models/version_committer.rb +0 -2
- data/sufia-models/app/services/sufia/analytics.rb +0 -50
- data/sufia-models/app/services/sufia/generic_file_audit_service.rb +0 -83
- data/sufia-models/app/services/sufia/generic_file_indexing_service.rb +0 -12
- data/sufia-models/app/services/sufia/id_service.rb +0 -45
- data/sufia-models/app/services/sufia/noid.rb +0 -22
- data/sufia-models/app/services/sufia/repository_audit_service.rb +0 -9
- data/sufia-models/config/locales/sufia.en.yml +0 -6
- data/sufia-models/lib/generators/sufia/models/abstract_migration_generator.rb +0 -30
- data/sufia-models/lib/generators/sufia/models/cached_stats_generator.rb +0 -24
- data/sufia-models/lib/generators/sufia/models/fulltext_generator.rb +0 -27
- data/sufia-models/lib/generators/sufia/models/install_generator.rb +0 -106
- data/sufia-models/lib/generators/sufia/models/orcid_field_generator.rb +0 -19
- data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +0 -24
- data/sufia-models/lib/generators/sufia/models/templates/app/models/collection.rb +0 -2
- data/sufia-models/lib/generators/sufia/models/templates/config/analytics.yml +0 -9
- data/sufia-models/lib/generators/sufia/models/templates/config/clamav.rb +0 -1
- data/sufia-models/lib/generators/sufia/models/templates/config/mailboxer.rb +0 -17
- data/sufia-models/lib/generators/sufia/models/templates/config/mime_types.rb +0 -6
- data/sufia-models/lib/generators/sufia/models/templates/config/redis.yml +0 -9
- data/sufia-models/lib/generators/sufia/models/templates/config/redis_config.rb +0 -32
- data/sufia-models/lib/generators/sufia/models/templates/config/resque-pool.yml +0 -1
- data/sufia-models/lib/generators/sufia/models/templates/config/resque_config.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/config/setup_mail.rb +0 -3
- data/sufia-models/lib/generators/sufia/models/templates/config/solrconfig.xml +0 -223
- data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +0 -144
- data/sufia-models/lib/generators/sufia/models/templates/migrations/acts_as_follower_migration.rb +0 -17
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_avatars_to_users.rb +0 -15
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_external_key_to_content_blocks.rb +0 -6
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_groups_to_users.rb +0 -11
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_ldap_attrs_to_user.rb +0 -27
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_linkedin_to_users.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_orcid_to_users.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/migrations/add_social_to_users.rb +0 -13
- data/sufia-models/lib/generators/sufia/models/templates/migrations/change_audit_log_pid_to_generic_file_id.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/migrations/change_proxy_deposit_request_pid_to_generic_file_id.rb +0 -5
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_checksum_audit_logs.rb +0 -19
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_content_blocks.rb +0 -10
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_featured_works.rb +0 -12
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_file_download_stats.rb +0 -12
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_file_view_stats.rb +0 -12
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_local_authorities.rb +0 -50
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_requests.rb +0 -16
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_rights.rb +0 -11
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_single_use_links.rb +0 -12
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_tinymce_assets.rb +0 -8
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_trophies.rb +0 -10
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_user_stats.rb +0 -19
- data/sufia-models/lib/generators/sufia/models/templates/migrations/create_version_committers.rb +0 -15
- data/sufia-models/lib/generators/sufia/models/update_content_blocks_generator.rb +0 -18
- data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +0 -54
- data/sufia-models/lib/generators/sufia/models/upgrade600_generator.rb +0 -21
- data/sufia-models/lib/generators/sufia/models/usagestats_generator.rb +0 -19
- data/sufia-models/lib/generators/sufia/models/user_stats_generator.rb +0 -31
- data/sufia-models/lib/sufia/messages.rb +0 -66
- data/sufia-models/lib/sufia/models.rb +0 -34
- data/sufia-models/lib/sufia/models/active_fedora/redis.rb +0 -43
- data/sufia-models/lib/sufia/models/active_record/redis.rb +0 -56
- data/sufia-models/lib/sufia/models/engine.rb +0 -79
- data/sufia-models/lib/sufia/models/file_content.rb +0 -6
- data/sufia-models/lib/sufia/models/file_content/versions.rb +0 -21
- data/sufia-models/lib/sufia/models/resque.rb +0 -36
- data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +0 -108
- data/sufia-models/lib/sufia/models/user_local_directory_behavior.rb +0 -29
- data/sufia-models/lib/sufia/models/utils.rb +0 -22
- data/sufia-models/lib/sufia/models/version.rb +0 -5
- data/sufia-models/lib/sufia/models/virus_found_error.rb +0 -4
- data/sufia-models/lib/sufia/permissions.rb +0 -9
- data/sufia-models/lib/sufia/permissions/readable.rb +0 -20
- data/sufia-models/lib/sufia/permissions/writable.rb +0 -74
- data/sufia-models/lib/tasks/batch_cleanup.rake +0 -19
- data/sufia-models/lib/tasks/migrate.rake +0 -21
- data/sufia-models/lib/tasks/resque.rake +0 -13
- data/sufia-models/lib/tasks/stats_tasks.rake +0 -12
- data/sufia-models/lib/tasks/sufia-models_tasks.rake +0 -80
- data/sufia-models/sufia-models.gemspec +0 -52
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
class CreateUserStats < ActiveRecord::Migration
|
|
2
|
-
def change
|
|
3
|
-
create_table :user_stats do |t|
|
|
4
|
-
t.integer :user_id
|
|
5
|
-
t.datetime :date
|
|
6
|
-
t.integer :file_views
|
|
7
|
-
t.integer :file_downloads
|
|
8
|
-
|
|
9
|
-
t.timestamps
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
add_column :file_view_stats, :user_id, :integer
|
|
13
|
-
add_column :file_download_stats, :user_id, :integer
|
|
14
|
-
|
|
15
|
-
add_index :user_stats, :user_id
|
|
16
|
-
add_index :file_view_stats, :user_id
|
|
17
|
-
add_index :file_download_stats, :user_id
|
|
18
|
-
end
|
|
19
|
-
end
|
data/sufia-models/lib/generators/sufia/models/templates/migrations/create_version_committers.rb
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
class CreateVersionCommitters < ActiveRecord::Migration
|
|
2
|
-
def self.up
|
|
3
|
-
create_table :version_committers do |t|
|
|
4
|
-
t.string :obj_id
|
|
5
|
-
t.string :datastream_id
|
|
6
|
-
t.string :version_id
|
|
7
|
-
t.string :committer_login
|
|
8
|
-
t.timestamps
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def self.down
|
|
13
|
-
drop_table :version_committers
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require_relative 'abstract_migration_generator'
|
|
2
|
-
|
|
3
|
-
class Sufia::Models::UpdateContentBlocksGenerator < Sufia::Models::AbstractMigrationGenerator
|
|
4
|
-
source_root File.expand_path('../templates', __FILE__)
|
|
5
|
-
|
|
6
|
-
desc """
|
|
7
|
-
This generator creates a database migration to add an external_key column to the content_blocks table (if the migration doesn't already exist). This allows you to associate a user_key with a featured_researcher entry.
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
def banner
|
|
11
|
-
say_status("warning", "CREATING MIGRATION FILE", :yellow)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def copy_migrations
|
|
15
|
-
better_migration_template 'add_external_key_to_content_blocks.rb'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
end
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
require_relative 'abstract_migration_generator'
|
|
2
|
-
|
|
3
|
-
class Sufia::Models::Upgrade400Generator < Sufia::Models::AbstractMigrationGenerator
|
|
4
|
-
source_root File.expand_path('../templates', __FILE__)
|
|
5
|
-
|
|
6
|
-
desc """
|
|
7
|
-
This generator for upgrading sufia-models from 3.7.2 to 4.0 makes the following changes to your application:
|
|
8
|
-
1. Creates several database migrations if they do not exist in /db/migrate
|
|
9
|
-
2. Runs the mailboxer upgrade generator
|
|
10
|
-
3. Adds analytics to the sufia.rb configuration file
|
|
11
|
-
4. Runs full-text generator
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
def banner
|
|
15
|
-
say_status("warning", "UPGRADING SUFIA MODELS", :yellow)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Setup the database migrations
|
|
19
|
-
def copy_migrations
|
|
20
|
-
[
|
|
21
|
-
'create_tinymce_assets.rb',
|
|
22
|
-
'create_content_blocks.rb',
|
|
23
|
-
'create_featured_works.rb'
|
|
24
|
-
].each do |file|
|
|
25
|
-
better_migration_template file
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Upgrade mailboxer
|
|
30
|
-
def install_mailboxer
|
|
31
|
-
generate "mailboxer:namespacing_compatibility"
|
|
32
|
-
generate "mailboxer:install -s"
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Add config file for Google Analytics
|
|
36
|
-
def add_analytics_config
|
|
37
|
-
copy_file 'config/analytics.yml', 'config/analytics.yml'
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Add Google Analytics option to Sufia config
|
|
41
|
-
def inject_analytics_initializer
|
|
42
|
-
inject_into_file 'config/initializers/sufia.rb', after: /^Sufia\.config do.*$/ do
|
|
43
|
-
"\n # Enable displaying usage statistics in the UI\n" +
|
|
44
|
-
" # Defaults to FALSE\n" +
|
|
45
|
-
" # Requires a Google Analytics id and OAuth2 keyfile. See README for more info\n" +
|
|
46
|
-
" #config.analytics = false\n"
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# Sets up full-text indexing (Solr config + jars)
|
|
51
|
-
def full_text_indexing
|
|
52
|
-
generate "sufia:models:fulltext"
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require_relative 'abstract_migration_generator'
|
|
2
|
-
|
|
3
|
-
class Sufia::Models::Upgrade600Generator < Sufia::Models::AbstractMigrationGenerator
|
|
4
|
-
source_root File.expand_path('../templates', __FILE__)
|
|
5
|
-
|
|
6
|
-
desc """
|
|
7
|
-
This generator for upgrading sufia-models to 6.0 makes the following changes to your application:
|
|
8
|
-
1. Creates several database migrations if they do not exist in /db/migrate
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
# Setup the database migrations
|
|
12
|
-
def copy_migrations
|
|
13
|
-
[
|
|
14
|
-
'change_audit_log_pid_to_generic_file_id.rb',
|
|
15
|
-
'change_proxy_deposit_request_pid_to_generic_file_id.rb'
|
|
16
|
-
].each do |file|
|
|
17
|
-
better_migration_template file
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
|
2
|
-
require 'rails/generators'
|
|
3
|
-
|
|
4
|
-
class Sufia::Models::UsagestatsGenerator < Rails::Generators::Base
|
|
5
|
-
source_root File.expand_path('../templates', __FILE__)
|
|
6
|
-
|
|
7
|
-
desc """
|
|
8
|
-
This generator makes the following changes to your application:
|
|
9
|
-
1. Generates usage stats config
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
def banner
|
|
13
|
-
say_status("warning", "GENERATING SUFIA USAGE STATS", :yellow)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def create_configuration_file
|
|
17
|
-
copy_file 'config/analytics.yml', 'config/analytics.yml'
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
require_relative 'abstract_migration_generator'
|
|
2
|
-
|
|
3
|
-
class Sufia::Models::UserStatsGenerator < Sufia::Models::AbstractMigrationGenerator
|
|
4
|
-
source_root File.expand_path('../templates', __FILE__)
|
|
5
|
-
argument :model_name, type: :string , default: "user"
|
|
6
|
-
|
|
7
|
-
desc """
|
|
8
|
-
This generator adds usage stats methods to the user model in your application:
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
def banner
|
|
12
|
-
say_status("warning", "ADDING USER STATS-RELATED ABILITIES TO SUFIA MODELS", :yellow)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# Setup the database migrations
|
|
16
|
-
def copy_migrations
|
|
17
|
-
better_migration_template 'create_user_stats.rb'
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def add_stats_mixin_to_user_model
|
|
21
|
-
file_path = "app/models/#{model_name.underscore}.rb"
|
|
22
|
-
|
|
23
|
-
if File.exists?(file_path)
|
|
24
|
-
inject_into_file file_path, after: /include Sufia\:\:User.*$/ do
|
|
25
|
-
"\n include Sufia::UserUsageStats"
|
|
26
|
-
end
|
|
27
|
-
else
|
|
28
|
-
puts " \e[31mFailure\e[0m Sufia requires a user object. This generator assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \b rails g sufia:models:user_stats client"
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
module Sufia
|
|
2
|
-
module Messages
|
|
3
|
-
extend ActiveSupport::Concern
|
|
4
|
-
|
|
5
|
-
# Borrowed from AbstractController so we can render html content tags
|
|
6
|
-
attr_accessor :output_buffer
|
|
7
|
-
include ActionView::Helpers::TagHelper
|
|
8
|
-
include ActionView::Helpers::UrlHelper
|
|
9
|
-
|
|
10
|
-
def success_subject
|
|
11
|
-
I18n.t("sufia.messages.success.subject")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def failure_subject
|
|
15
|
-
I18n.t("sufia.messages.failure.subject")
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def single_success id, file
|
|
19
|
-
content_tag :span, id: "ss-"+id do
|
|
20
|
-
[link_to_file(file), I18n.t("sufia.messages.success.single")].join(" ").html_safe
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def multiple_success id, files
|
|
25
|
-
content_tag :span, id: "ss-"+id do
|
|
26
|
-
[success_link(files), I18n.t("sufia.messages.success.multiple.tag")].join(" ").html_safe
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def single_failure id, file
|
|
31
|
-
content_tag :span, id: "ss-"+id do
|
|
32
|
-
[link_to_file(file), I18n.t("sufia.messages.failure.single")].join(" ").html_safe
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def multiple_failure id, files
|
|
37
|
-
content_tag :span, id: "ss-"+id do
|
|
38
|
-
[failure_link(files), I18n.t("sufia.messages.failure.multiple.tag")].join(" ").html_safe
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# Double-quotes are replaced with single ones so this list can be included in a data block. Ex:
|
|
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(/"/, "'")
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def link_to_file file
|
|
49
|
-
link_to(file.to_s, Sufia::Engine.routes.url_helpers.generic_file_path(file))
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
private
|
|
53
|
-
|
|
54
|
-
def success_link files
|
|
55
|
-
link_to I18n.t("sufia.messages.success.multiple.link"), "#",
|
|
56
|
-
rel: "popover",
|
|
57
|
-
data: { content: file_list(files).html_safe, title: I18n.t("sufia.messages.success.title") }
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def failure_link files
|
|
61
|
-
link_to I18n.t("sufia.messages.failure.multiple.link"), "#",
|
|
62
|
-
rel: "popover",
|
|
63
|
-
data: { content: file_list(files).html_safe, title: I18n.t("sufia.messages.failure.title") }
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require "sufia/models/version"
|
|
2
|
-
require "sufia/models/engine"
|
|
3
|
-
require 'hydra/head'
|
|
4
|
-
require 'nest'
|
|
5
|
-
require 'mailboxer'
|
|
6
|
-
require 'acts_as_follower'
|
|
7
|
-
require 'carrierwave'
|
|
8
|
-
require "active_resource" # used by GenericFile to catch errors & by GeoNamesResource
|
|
9
|
-
require 'resque/server'
|
|
10
|
-
|
|
11
|
-
module Sufia
|
|
12
|
-
extend ActiveSupport::Autoload
|
|
13
|
-
|
|
14
|
-
module Models
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
autoload :Utils, 'sufia/models/utils'
|
|
18
|
-
autoload :Permissions
|
|
19
|
-
autoload :Messages
|
|
20
|
-
|
|
21
|
-
attr_writer :queue
|
|
22
|
-
|
|
23
|
-
def self.queue
|
|
24
|
-
@queue ||= config.queue.new('sufia')
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def self.config(&block)
|
|
28
|
-
@@config ||= Sufia::Models::Engine::Configuration.new
|
|
29
|
-
|
|
30
|
-
yield @@config if block
|
|
31
|
-
|
|
32
|
-
return @@config
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
module ActiveFedora
|
|
2
|
-
class Base
|
|
3
|
-
def stream
|
|
4
|
-
Nest.new(self.class.name, $redis)[to_param]
|
|
5
|
-
rescue
|
|
6
|
-
nil
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def self.stream
|
|
10
|
-
Nest.new(name, $redis)
|
|
11
|
-
rescue
|
|
12
|
-
nil
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def events(size=-1)
|
|
16
|
-
stream[:event].lrange(0, size).map do |event_id|
|
|
17
|
-
{
|
|
18
|
-
action: $redis.hget("events:#{event_id}", "action"),
|
|
19
|
-
timestamp: $redis.hget("events:#{event_id}", "timestamp")
|
|
20
|
-
}
|
|
21
|
-
end
|
|
22
|
-
rescue
|
|
23
|
-
[]
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def create_event(action, timestamp)
|
|
27
|
-
event_id = $redis.incr("events:latest_id")
|
|
28
|
-
$redis.hmset("events:#{event_id}", "action", action, "timestamp", timestamp)
|
|
29
|
-
event_id
|
|
30
|
-
rescue
|
|
31
|
-
nil
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def log_event(event_id)
|
|
35
|
-
stream[:event].lpush(event_id)
|
|
36
|
-
rescue
|
|
37
|
-
nil
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
ActiveRecord::Base.class_eval do
|
|
2
|
-
def stream
|
|
3
|
-
Nest.new(self.class.name, $redis)[to_param]
|
|
4
|
-
rescue
|
|
5
|
-
nil
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def self.stream
|
|
9
|
-
Nest.new(name, $redis)
|
|
10
|
-
rescue
|
|
11
|
-
nil
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def events(size=-1)
|
|
15
|
-
stream[:event].lrange(0, size).map do |event_id|
|
|
16
|
-
{
|
|
17
|
-
action: $redis.hget("events:#{event_id}", "action"),
|
|
18
|
-
timestamp: $redis.hget("events:#{event_id}", "timestamp")
|
|
19
|
-
}
|
|
20
|
-
end
|
|
21
|
-
rescue
|
|
22
|
-
[]
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def profile_events(size=-1)
|
|
26
|
-
stream[:event][:profile].lrange(0, size).map do |event_id|
|
|
27
|
-
{
|
|
28
|
-
action: $redis.hget("events:#{event_id}", "action"),
|
|
29
|
-
timestamp: $redis.hget("events:#{event_id}", "timestamp")
|
|
30
|
-
}
|
|
31
|
-
end
|
|
32
|
-
rescue
|
|
33
|
-
[]
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def create_event(action, timestamp)
|
|
37
|
-
event_id = $redis.incr("events:latest_id")
|
|
38
|
-
$redis.hmset("events:#{event_id}", "action", action, "timestamp", timestamp)
|
|
39
|
-
event_id
|
|
40
|
-
rescue
|
|
41
|
-
nil
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def log_event(event_id)
|
|
45
|
-
stream[:event].lpush(event_id)
|
|
46
|
-
rescue
|
|
47
|
-
nil
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def log_profile_event(event_id)
|
|
51
|
-
stream[:event][:profile].lpush(event_id)
|
|
52
|
-
rescue
|
|
53
|
-
nil
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
module Sufia
|
|
2
|
-
module Models
|
|
3
|
-
def self.config(&block)
|
|
4
|
-
@@config ||= Engine::Configuration.new
|
|
5
|
-
|
|
6
|
-
yield @@config if block
|
|
7
|
-
|
|
8
|
-
return @@config
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
class Engine < ::Rails::Engine
|
|
12
|
-
require 'sufia/models/resque'
|
|
13
|
-
|
|
14
|
-
# Set some configuration defaults
|
|
15
|
-
config.persistent_hostpath = "http://localhost/files/"
|
|
16
|
-
config.enable_ffmpeg = false
|
|
17
|
-
config.noid_template = '.reeddeeddk'
|
|
18
|
-
config.ffmpeg_path = 'ffmpeg'
|
|
19
|
-
config.fits_message_length = 5
|
|
20
|
-
config.temp_file_base = nil
|
|
21
|
-
config.enable_noids = true
|
|
22
|
-
config.minter_statefile = '/tmp/minter-state'
|
|
23
|
-
config.redis_namespace = "sufia"
|
|
24
|
-
config.fits_path = "fits.sh"
|
|
25
|
-
config.enable_contact_form_delivery = false
|
|
26
|
-
config.browse_everything = nil
|
|
27
|
-
config.enable_local_ingest = nil
|
|
28
|
-
config.analytics = false
|
|
29
|
-
config.queue = Sufia::Resque::Queue
|
|
30
|
-
config.max_notifications_for_dashboard = 5
|
|
31
|
-
config.activity_to_show_default_seconds_since_now = 24*60*60
|
|
32
|
-
|
|
33
|
-
# Defaulting analytic start date to when ever the file was uploaded by leaving it blank
|
|
34
|
-
config.analytic_start_date = nil
|
|
35
|
-
|
|
36
|
-
config.translate_uri_to_id = lambda { |uri| uri.to_s.split('/')[-1] }
|
|
37
|
-
config.translate_id_to_uri = lambda { |id|
|
|
38
|
-
"#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/#{Sufia::Noid.treeify(id)}" }
|
|
39
|
-
|
|
40
|
-
config.autoload_paths += %W(
|
|
41
|
-
#{config.root}/app/models/datastreams
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
rake_tasks do
|
|
45
|
-
load File.expand_path('../../../tasks/sufia-models_tasks.rake', __FILE__)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
initializer "patches" do
|
|
49
|
-
require 'sufia/models/active_fedora/redis'
|
|
50
|
-
require 'sufia/models/active_record/redis'
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
initializer 'requires' do
|
|
54
|
-
require 'activerecord-import'
|
|
55
|
-
require 'hydra/derivatives'
|
|
56
|
-
require 'sufia/models/file_content'
|
|
57
|
-
require 'sufia/models/file_content/versions'
|
|
58
|
-
require 'sufia/models/user_local_directory_behavior'
|
|
59
|
-
require 'sufia/noid'
|
|
60
|
-
require 'sufia/id_service'
|
|
61
|
-
require 'sufia/analytics'
|
|
62
|
-
require 'sufia/pageview'
|
|
63
|
-
require 'sufia/download'
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
initializer 'configure' do
|
|
67
|
-
Sufia.config.tap do |c|
|
|
68
|
-
Hydra::Derivatives.ffmpeg_path = c.ffmpeg_path
|
|
69
|
-
Hydra::Derivatives.temp_file_base = c.temp_file_base
|
|
70
|
-
Hydra::Derivatives.fits_path = c.fits_path
|
|
71
|
-
Hydra::Derivatives.enable_ffmpeg = c.enable_ffmpeg
|
|
72
|
-
|
|
73
|
-
ActiveFedora::Base.translate_uri_to_id = c.translate_uri_to_id
|
|
74
|
-
ActiveFedora::Base.translate_id_to_uri = c.translate_id_to_uri
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|