├── log └── .keep ├── app ├── mailers │ └── .keep ├── models │ ├── .keep │ └── concerns │ │ └── .keep ├── assets │ ├── images │ │ ├── .keep │ │ ├── favicon.ico │ │ ├── licenses │ │ │ ├── cc0.gif │ │ │ ├── cc0.png │ │ │ ├── cc-by.gif │ │ │ └── cc-by.png │ │ └── tenants │ │ │ ├── logo_lbnl.png │ │ │ ├── logo_ocdp.png │ │ │ ├── logo_ucd.jpg │ │ │ ├── logo_ucm.png │ │ │ ├── logo_ucsb.png │ │ │ ├── logo_ucsf.png │ │ │ ├── logo_dataone.jpg │ │ │ ├── logo_dataone.psd │ │ │ ├── logo_ocdp_wide.png │ │ │ ├── logo_ucd_department.png │ │ │ ├── logo_uci.svg │ │ │ ├── logo_ucla.svg │ │ │ ├── logo_ucr.svg │ │ │ └── logo_ucsd.svg │ ├── stylesheets │ │ ├── host_pages.scss │ │ └── unused.css │ └── javascripts │ │ ├── host_pages.js │ │ └── application.js ├── controllers │ ├── concerns │ │ └── .keep │ └── application_controller.rb ├── helpers │ └── application_helper.rb └── views │ ├── tenants │ ├── ucb │ │ ├── _help.html.md │ │ └── _about.html.md │ ├── ucd │ │ ├── _help.html.md │ │ ├── _about.html.md │ │ └── _dda.html.erb │ ├── uci │ │ ├── _help.html.md │ │ └── _about.html.md │ ├── ucm │ │ ├── _help.html.md │ │ └── _about.html.md │ ├── ucr │ │ ├── _help.html.md │ │ └── _about.html.md │ ├── ocdp │ │ ├── _about.html.md │ │ └── _help.html.md │ ├── ucop │ │ ├── _about.html.md │ │ └── _help.html.md │ ├── ucsb │ │ ├── _about.html.md │ │ ├── _help.html.md │ │ └── _dda.html.erb │ ├── ucsc │ │ ├── _about.html.md │ │ └── _help.html.md │ ├── ucsf │ │ ├── _about.html.md │ │ └── _help.html.md │ ├── dataone │ │ ├── _about.html.md │ │ └── _help.html.md │ ├── index.html.erb │ └── test.html.erb │ └── layouts │ ├── application.html.erb │ └── _help.html.md ├── lib ├── assets │ └── .keep ├── tasks │ ├── .keep │ ├── app_data.rake │ └── dev_ops.rake └── bundler_help.rb ├── .ruby-version ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── public ├── favicon.ico ├── images │ ├── logo_lbnl.png │ ├── logo_ucm.png │ ├── logo_ucsf.png │ ├── logo_dataone.jpg │ ├── logo_uci.svg │ ├── logo_ucla.svg │ ├── logo_ucr.svg │ └── logo_ucsd.svg ├── dash_architecture_diagram.png ├── 500.html ├── 422.html └── 404.html ├── .config-travis ├── blacklight.yml ├── secrets.yml ├── database.yml ├── app_config.yml ├── licenses.yml ├── tenants │ └── localhost.yml └── settings.yml ├── config ├── initializers │ ├── stash_metadata_engine.rb │ ├── cookies_serializer.rb │ ├── session_store.rb │ ├── mime_types.rb │ ├── filter_parameter_logging.rb │ ├── stash_engine.rb │ ├── 00_tenants.rb │ ├── app_config.rb │ ├── backtrace_silencers.rb │ ├── assets.rb │ ├── wrap_parameters.rb │ ├── inflections.rb │ └── 01_hash_to_ostruct.rb ├── boot.rb ├── environment.rb ├── database.yml.example ├── locales │ └── en.yml ├── application.rb ├── environments │ ├── test.rb │ ├── development.rb │ ├── development.rb.stagelike │ ├── stage.rb │ ├── production.rb │ └── demo.rb ├── deploy │ ├── production.rb │ ├── demo.rb │ ├── stage.rb │ └── development.rb └── routes.rb ├── documentation ├── images │ ├── solr1.png │ ├── solr2.png │ ├── solr3.png │ ├── solr4.png │ ├── solr5.png │ ├── solr6.png │ ├── dash_home.png │ ├── explore1.png │ ├── explore2.png │ ├── explore3.png │ ├── structure.png │ ├── dev_login1.png │ ├── dev_login2.png │ ├── Screenshot from 2017-01-12 14-05-55.png │ ├── Screenshot from 2017-01-12 14-06-35.png │ ├── Screenshot from 2017-01-12 14-07-26.png │ └── Screenshot from 2017-01-12 14-12-32.png ├── other_files │ ├── er_stash.mwb │ └── dash_er_2018-06.pdf ├── submission_flow.md ├── how_to_contribute.md ├── documentation_dump.md └── local_testing_setup.md ├── bin ├── rake ├── bundle ├── rails ├── delayed_job └── setup ├── spec ├── config │ └── solr │ │ └── conf │ │ ├── TODO.md │ │ ├── stopwords_en.txt │ │ ├── protwords.txt │ │ └── synonyms.txt ├── fixtures │ ├── stash_engine_resource_usages.yml │ ├── dcs_geo_location_place.yml │ ├── dcs_affiliations.yml │ ├── dcs_contributors.yml │ ├── dcs_subjects.yml │ ├── dcs_related_identifiers.yml │ ├── stash_engine_identifiers.yml │ ├── dcs_geo_location_boxes.yml │ ├── dcs_publication_years.yml │ ├── dcs_affiliations_authors.yml │ ├── dcs_publishers.yml │ ├── dcs_geo_location_point.yml │ ├── dcs_subjects_stash_engine_resources.yml │ ├── stash_engine_resource_states.yml │ ├── stash_engine_edit_histories.yml │ ├── dcs_datecite_dates.yml │ ├── dcs_resource_types.yml │ ├── stash_engine_versions.yml │ ├── dcs_geolocation.yml │ ├── dcs_rights.yml │ ├── stash_engine_authors.yml │ ├── stash_engine_submission_logs.yml │ ├── stash_engine_users.yml │ ├── stash_engine_resources.yml │ ├── stash_engine_file_uploads.yml │ └── dcs_descriptions.yml ├── mocks │ └── mock_repository.rb ├── .rubocop.yml ├── features │ ├── home_spec.rb │ ├── login_spec.rb │ ├── timed_publication_spec.rb │ ├── delete_everything_hhjk_spec.rb │ ├── review_spec.rb │ ├── admin_spec.rb │ ├── add_geolocation_spec.rb │ └── new_dataset_spec.rb ├── spec_helper.rb ├── rails_helper.rb └── solr_helper.rb ├── release_notes.md ├── config.ru ├── copy_logos.sh ├── db ├── seeds.rb └── migrate │ └── 20170803225617_fix_publishers.rb ├── .travis.yml ├── symlink_config.sh ├── Rakefile ├── .simplecov ├── Capfile ├── LICENSE.md ├── .generators ├── script ├── clear_data.rb └── import_file_list.rb ├── travis-prep.sh ├── .rubocop.yml ├── Gemfile ├── README.md └── .gitignore /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.4.1 2 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /app/views/tenants/ucb/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucd/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/uci/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucm/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucr/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ocdp/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ocdp/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucb/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucd/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/uci/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucm/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucop/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucop/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucr/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucsb/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucsb/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucsc/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucsc/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucsf/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/ucsf/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/dataone/_about.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/about", language: :markdown %> -------------------------------------------------------------------------------- /app/views/tenants/dataone/_help.html.md: -------------------------------------------------------------------------------- 1 | <%= render partial: "layouts/help", language: :markdown %> 2 | -------------------------------------------------------------------------------- /public/images/logo_lbnl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/public/images/logo_lbnl.png -------------------------------------------------------------------------------- /public/images/logo_ucm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/public/images/logo_ucm.png -------------------------------------------------------------------------------- /public/images/logo_ucsf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/public/images/logo_ucsf.png -------------------------------------------------------------------------------- /app/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/favicon.ico -------------------------------------------------------------------------------- /.config-travis/blacklight.yml: -------------------------------------------------------------------------------- 1 | test: 2 | adapter: solr 3 | url: http://127.0.0.1:8983/solr/geoblacklight 4 | -------------------------------------------------------------------------------- /config/initializers/stash_metadata_engine.rb: -------------------------------------------------------------------------------- 1 | APP_CONFIG.metadata_engine.constantize.config_resource_patch 2 | -------------------------------------------------------------------------------- /documentation/images/solr1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/solr1.png -------------------------------------------------------------------------------- /documentation/images/solr2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/solr2.png -------------------------------------------------------------------------------- /documentation/images/solr3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/solr3.png -------------------------------------------------------------------------------- /documentation/images/solr4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/solr4.png -------------------------------------------------------------------------------- /documentation/images/solr5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/solr5.png -------------------------------------------------------------------------------- /documentation/images/solr6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/solr6.png -------------------------------------------------------------------------------- /public/images/logo_dataone.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/public/images/logo_dataone.jpg -------------------------------------------------------------------------------- /app/assets/images/licenses/cc0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/licenses/cc0.gif -------------------------------------------------------------------------------- /app/assets/images/licenses/cc0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/licenses/cc0.png -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /documentation/images/dash_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/dash_home.png -------------------------------------------------------------------------------- /documentation/images/explore1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/explore1.png -------------------------------------------------------------------------------- /documentation/images/explore2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/explore2.png -------------------------------------------------------------------------------- /documentation/images/explore3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/explore3.png -------------------------------------------------------------------------------- /documentation/images/structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/structure.png -------------------------------------------------------------------------------- /app/assets/images/licenses/cc-by.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/licenses/cc-by.gif -------------------------------------------------------------------------------- /app/assets/images/licenses/cc-by.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/licenses/cc-by.png -------------------------------------------------------------------------------- /documentation/images/dev_login1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/dev_login1.png -------------------------------------------------------------------------------- /documentation/images/dev_login2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/dev_login2.png -------------------------------------------------------------------------------- /public/dash_architecture_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/public/dash_architecture_diagram.png -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_lbnl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_lbnl.png -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ocdp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_ocdp.png -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ucd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_ucd.jpg -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ucm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_ucm.png -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ucsb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_ucsb.png -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ucsf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_ucsf.png -------------------------------------------------------------------------------- /documentation/other_files/er_stash.mwb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/other_files/er_stash.mwb -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_dataone.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_dataone.jpg -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_dataone.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_dataone.psd -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ocdp_wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_ocdp_wide.png -------------------------------------------------------------------------------- /documentation/other_files/dash_er_2018-06.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/other_files/dash_er_2018-06.pdf -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ucd_department.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/app/assets/images/tenants/logo_ucd_department.png -------------------------------------------------------------------------------- /app/views/tenants/index.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome to our Dash2 home

2 | 3 |

This is a page for the host application when no tenant is chosen.

-------------------------------------------------------------------------------- /spec/config/solr/conf/TODO.md: -------------------------------------------------------------------------------- 1 | # TO DO 2 | 3 | - Move this to [stash_discovery](https://github.com/CDLUC3/stash/tree/master/stash_discovery) 4 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /app/views/tenants/test.html.erb: -------------------------------------------------------------------------------- 1 |

@auth_hash: <%= @auth_hash %>

2 | 3 |

params: <%= params.inspect %>

4 | 5 |

request.env: <%= request.env.inspect %>

-------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /documentation/images/Screenshot from 2017-01-12 14-05-55.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/Screenshot from 2017-01-12 14-05-55.png -------------------------------------------------------------------------------- /documentation/images/Screenshot from 2017-01-12 14-06-35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/Screenshot from 2017-01-12 14-06-35.png -------------------------------------------------------------------------------- /documentation/images/Screenshot from 2017-01-12 14-07-26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/Screenshot from 2017-01-12 14-07-26.png -------------------------------------------------------------------------------- /documentation/images/Screenshot from 2017-01-12 14-12-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDLUC3/dashv2/HEAD/documentation/images/Screenshot from 2017-01-12 14-12-32.png -------------------------------------------------------------------------------- /release_notes.md: -------------------------------------------------------------------------------- 1 | # Release notes 2 | 3 | Please see the [releases](https://github.com/CDLUC3/dashv2/releases) from the main page of the repository for release notes. 4 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /.config-travis/secrets.yml: -------------------------------------------------------------------------------- 1 | test: 2 | secret_key_base: bd820531f815ecc5ed5849d4b545fdafc2430a2c8ef5b5d3b0c4011d7d8e700df3cadb09bdb15005d9a6dbb06e469f3d45564a0d8f24aaf17ff9507fbddc0ecd 3 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_dash2_session' 4 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /bin/delayed_job: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) 4 | require 'delayed/command' 5 | Delayed::Command.new(ARGV).daemonize 6 | -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_resource_usages.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | resource_id: 1 4 | downloads: 1 5 | views: 1 6 | 7 | id: 2 8 | resource_id: 4 9 | downloads: 1 10 | views: 1 -------------------------------------------------------------------------------- /spec/mocks/mock_repository.rb: -------------------------------------------------------------------------------- 1 | require 'stash/repo' 2 | 3 | module Stash 4 | # configured in stash_engine_specs/config/app_config.yml 5 | class MockRepository < Stash::Repo::Repository 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: ../.rubocop.yml 2 | 3 | Metrics/MethodLength: 4 | Enabled: false 5 | 6 | Metrics/ModuleLength: 7 | Enabled: false 8 | 9 | Metrics/BlockLength: 10 | Enabled: false 11 | -------------------------------------------------------------------------------- /app/assets/stylesheets/host_pages.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the HostPages controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /.config-travis/database.yml: -------------------------------------------------------------------------------- 1 | default: &default 2 | host: localhost 3 | adapter: mysql2 4 | database: dashv2_test 5 | username: travis 6 | encoding: utf8mb4 7 | 8 | development: 9 | <<: *default 10 | 11 | test: 12 | <<: *default 13 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /app/assets/javascripts/host_pages.js: -------------------------------------------------------------------------------- 1 | // Place all the behaviors and hooks related to the matching controller here. 2 | // All this logic will automatically be available in application.js. 3 | // You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /.config-travis/app_config.yml: -------------------------------------------------------------------------------- 1 | test: 2 | metadata_engine: StashDatacite 3 | shared_resource_model: StashEngine::Resource 4 | # dashv2/spec/mocks/mock_repository.rb 5 | repository: Stash::MockRepository 6 | stash_mount: /stash 7 | max_review_days: 180 8 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | 6 | end 7 | -------------------------------------------------------------------------------- /config/initializers/stash_engine.rb: -------------------------------------------------------------------------------- 1 | # See the StashEngine lib/stash_engine/engine.rb file for default values 2 | # until this is more completed and better documented 3 | 4 | StashEngine.setup do |config| 5 | config.tenants = TENANT_CONFIG 6 | config.app = APP_CONFIG 7 | end -------------------------------------------------------------------------------- /config/initializers/00_tenants.rb: -------------------------------------------------------------------------------- 1 | hsh = HashWithIndifferentAccess.new 2 | 3 | Dir.glob(File.join(Rails.root, 'config', 'tenants', '**.yml')).each do |fn| 4 | h = HashWithIndifferentAccess.new(YAML.load_file(fn)[Rails.env]) 5 | hsh[h[:tenant_id]] = h 6 | end 7 | 8 | TENANT_CONFIG = hsh -------------------------------------------------------------------------------- /copy_logos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # originally going to symlink images, but causes problems so, doing this as a copy instead :-) Why the script is odd 4 | 5 | find 'app/assets/images/tenants' -name '*.png' -o -name '*.jpg' -o -name '*.svg' | while read -r line 6 | do 7 | publicfn=public/images/$(basename $line) 8 | cp "$line" "$publicfn" 9 | done -------------------------------------------------------------------------------- /config/initializers/app_config.rb: -------------------------------------------------------------------------------- 1 | require 'ostruct' 2 | require 'yaml' 3 | ac = YAML.load_file(File.join(Rails.root, 'config', 'app_config.yml'))[Rails.env] 4 | 5 | # this will make the config available under the APP_CONFIG constant and methods like APP_CONFIG.metadata_engines 6 | APP_CONFIG = ac.to_ostruct 7 | 8 | ENV['SSL_CERT_FILE'] = APP_CONFIG.ssl_cert_file if APP_CONFIG.ssl_cert_file -------------------------------------------------------------------------------- /spec/config/solr/conf/stopwords_en.txt: -------------------------------------------------------------------------------- 1 | # Standard english stop words taken from Lucene's StopAnalyzer 2 | a 3 | an 4 | and 5 | are 6 | as 7 | at 8 | be 9 | but 10 | by 11 | for 12 | if 13 | in 14 | into 15 | is 16 | it 17 | no 18 | not 19 | of 20 | on 21 | or 22 | such 23 | that 24 | the 25 | their 26 | then 27 | there 28 | these 29 | they 30 | this 31 | to 32 | was 33 | will 34 | with 35 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dash 2 5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/features/home_spec.rb: -------------------------------------------------------------------------------- 1 | require 'features_helper' 2 | 3 | # TODO: switch to Capybara scenario style 4 | describe 'home' do 5 | before(:each) do 6 | visit('/') 7 | end 8 | 9 | it 'redirects to /stash' do 10 | expect(page).to have_current_path('/stash') 11 | end 12 | 13 | it 'is the home page' do 14 | expect(page).to have_title(home_page_title) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | 9 | StashDatacite::Engine.load_seed -------------------------------------------------------------------------------- /spec/fixtures/dcs_geo_location_place.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | geo_location_place: City of Hampton, VA, USA 4 | created_at: &2 2017-08-24 21:03:57.000000000 Z 5 | updated_at: &3 2017-08-24 21:03:57.000000000 Z 6 | 7 | id: 2 8 | geo_location_place: City of Hampton, VA, USA 9 | created_at: &2 2017-08-24 21:10:18.000000000 Z 10 | updated_at: &3 2017-08-24 21:10:18.000000000 Z 11 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_affiliations.yml: -------------------------------------------------------------------------------- 1 | affil1: 2 | id: 1 3 | short_name: 4 | long_name: UC Berkeley 5 | abbreviation: 6 | created_at: &3 2017-08-24 21:01:21.000000000 Z 7 | updated_at: &4 2017-08-24 21:01:21.000000000 Z 8 | 9 | affil2: 10 | id: 2 11 | short_name: 12 | long_name: UC Office of the President 13 | abbreviation: 14 | created_at: &3 2017-08-24 21:16:26.000000000 Z 15 | updated_at: &4 2017-08-24 21:16:26.000000000 Z -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /lib/tasks/app_data.rake: -------------------------------------------------------------------------------- 1 | require_relative '../../script/clear_data' 2 | namespace :app_data do 3 | desc 'Clear data from database (stash and datacite) and solr for environment' 4 | task clear: :environment do 5 | puts "Are you sure you want to clear the data in the environment #{Rails.env}? (Type 'yes' to proceed.)" 6 | response = STDIN.gets 7 | ClearData.clear if response.strip.casecmp('YES').zero? && Rails.env != 'production' 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /lib/bundler_help.rb: -------------------------------------------------------------------------------- 1 | module BundlerHelp 2 | 3 | def self.find_path(dir_name) 4 | paths = [File.expand_path('.'), File.expand_path('..')] 5 | paths.each do |path| 6 | path_arr = path.split(File::SEPARATOR).map { |x| x == '' ? File::SEPARATOR : x } 7 | until path_arr.empty? 8 | test = File.join(path_arr, dir_name) 9 | return test if Dir.exist?(test) 10 | path_arr.pop 11 | end 12 | end 13 | false 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | dist: trusty 4 | 5 | addons: 6 | chrome: stable 7 | 8 | language: ruby 9 | 10 | rvm: 11 | - 2.4.1 12 | 13 | services: 14 | - mysql 15 | 16 | before_install: 17 | - sudo apt-get update 18 | - sudo apt-get install mutt 19 | - gem update --system 20 | - gem install bundler 21 | - ./travis-prep.sh 22 | 23 | before_script: 24 | - "export DISPLAY=:99.0" 25 | - "sh -e /etc/init.d/xvfb start" 26 | # give xvfb some time to start 27 | - "while [ ! -e /tmp/.X11-unix/X99 ]; do sleep 1; done" 28 | -------------------------------------------------------------------------------- /config/database.yml.example: -------------------------------------------------------------------------------- 1 | default: &default 2 | adapter: mysql2 3 | database: dash 4 | username: 5 | password: blank 6 | port: 3306 7 | encoding: utf8 8 | 9 | development: 10 | <<: *default 11 | host: examplehost 12 | password: examplepass 13 | 14 | test: 15 | host: localhost 16 | adapter: mysql2 17 | database: dashv2_test 18 | username: travis 19 | encoding: utf8mb4 20 | 21 | stage: 22 | <<: *default 23 | host: stage 24 | password: stage 25 | 26 | production: 27 | <<: *default 28 | host: prod 29 | password: prod 30 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | Rails.application.config.assets.precompile += %w( geobl_application.js ) 12 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_contributors.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | contributor_name: Or Yarok Association 4 | contributor_type: funder 5 | name_identifier_id: 6 | resource_id: 1 7 | created_at: &4 2017-08-24 21:02:09.000000000 Z 8 | updated_at: &5 2017-08-24 21:02:19.000000000 Z 9 | award_number: yarok298 10 | 11 | id: 2 12 | contributor_name: Or Yarok Association 13 | contributor_type: funder 14 | name_identifier_id: 15 | resource_id: 2 16 | created_at: &4 2017-08-24 21:10:18.000000000 Z 17 | updated_at: &5 2017-08-24 21:10:18.000000000 Z 18 | award_number: yarok298 -------------------------------------------------------------------------------- /spec/fixtures/dcs_subjects.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | subject: Noggin 4 | subject_scheme: 5 | scheme_URI: 6 | created_at: &3 2017-08-24 21:02:29.000000000 Z 7 | updated_at: &4 2017-08-24 21:02:29.000000000 Z 8 | 9 | id: 2 10 | subject: Produce 11 | subject_scheme: 12 | scheme_URI: 13 | created_at: &3 2017-08-24 21:02:35.000000000 Z 14 | updated_at: &4 2017-08-24 21:02:35.000000000 Z 15 | 16 | id: 3 17 | subject: Ogre 18 | subject_scheme: 19 | scheme_URI: 20 | created_at: &3 2017-08-24 21:02:42.000000000 Z 21 | updated_at: &4 2017-08-24 21:02:42.000000000 Z -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /symlink_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mydir="../dash2-config" 4 | len=$((${#mydir} + 1)) 5 | CURRENTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 | 7 | cd $CURRENTDIR 8 | 9 | echo $CURRENTDIR 10 | 11 | mkdir -p config/tenants 12 | 13 | 14 | find "$mydir" -name '*.yml' | while read -r line 15 | do 16 | shortfn=${line:len} 17 | fullfn="$CURRENTDIR/$line" 18 | if [ -h $shortfn ]; then 19 | echo "file $shortfn is already symlinked" 20 | else 21 | echo "symlinking $shortfn" 22 | ln -s "$fullfn" "$shortfn" 23 | fi 24 | done 25 | 26 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_related_identifiers.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | related_identifier: http://example.com 4 | related_identifier_type: url 5 | relation_type: cites 6 | related_metadata_scheme: 7 | scheme_URI: 8 | scheme_type: 9 | resource_id: 1 10 | created_at: &4 2017-08-24 21:03:36.000000000 Z 11 | updated_at: &5 2017-08-24 21:03:36.000000000 Z 12 | 13 | id: 2 14 | related_identifier: http://example.com 15 | related_identifier_type: url 16 | relation_type: cites 17 | related_metadata_scheme: 18 | scheme_URI: 19 | scheme_type: 20 | resource_id: 2 21 | created_at: &4 2017-08-24 21:10:18.000000000 Z 22 | updated_at: &5 2017-08-24 21:10:18.000000000 Z -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_identifiers.yml: -------------------------------------------------------------------------------- 1 | ident1: 2 | id: 1 3 | identifier: 10.5072/FK2WW7F97Z 4 | identifier_type: DOI 5 | storage_size: 234553 6 | created_at: 2017-08-24 21:06:24.000000000 Z 7 | updated_at: 2017-08-24 21:06:24.000000000 Z 8 | 9 | ident2: 10 | id: 2 11 | identifier: 10.5072/FK2S46QH43 12 | identifier_type: DOI 13 | storage_size: 2114553 14 | created_at: 2017-08-24 21:13:40.000000000 Z 15 | updated_at: 2017-08-24 21:13:40.000000000 Z 16 | 17 | ident3: 18 | id: 3 19 | identifier: 10.5072/FK2NC60Q0S 20 | identifier_type: DOI 21 | storage_size: 2345533 22 | created_at: 2017-08-24 21:18:32.000000000 Z 23 | updated_at: 2017-08-24 21:18:32.000000000 Z 24 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /.config-travis/licenses.yml: -------------------------------------------------------------------------------- 1 | # this file has license information starting with an identifier for the license 2 | # and then uri and name 3 | 4 | cc0: 5 | uri: https://creativecommons.org/publicdomain/zero/1.0/ 6 | name: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication 7 | explanation: > 8 | This releases your work to the public domain for any use. 9 | badge: icon_cc-zero.svg 10 | 11 | 12 | cc_by: 13 | uri: https://creativecommons.org/licenses/by/4.0/ 14 | name: Creative Commons Attribution 4.0 International (CC BY 4.0) 15 | explanation: > 16 | This license lets others distribute, modify, and build upon your work, even commercially, as 17 | long as they credit you for the original creation. 18 | badge: icon_cc-by.svg -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_geo_location_boxes.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | sw_latitude: !ruby/object:BigDecimal 18:0.37040928e2 4 | ne_latitude: !ruby/object:BigDecimal 18:0.37058465e2 5 | sw_longitude: !ruby/object:BigDecimal 18:-0.76340303e2 6 | ne_longitude: !ruby/object:BigDecimal 18:-0.76315756e2 7 | created_at: &3 2017-08-24 21:04:29.000000000 Z 8 | updated_at: &4 2017-08-24 21:04:29.000000000 Z 9 | 10 | id: 2 11 | sw_latitude: !ruby/object:BigDecimal 18:0.37040928e2 12 | ne_latitude: !ruby/object:BigDecimal 18:0.37058465e2 13 | sw_longitude: !ruby/object:BigDecimal 18:-0.76340303e2 14 | ne_longitude: !ruby/object:BigDecimal 18:-0.76315756e2 15 | created_at: &3 2017-08-24 21:10:18.000000000 Z 16 | updated_at: &4 2017-08-24 21:10:18.000000000 Z -------------------------------------------------------------------------------- /app/assets/stylesheets/unused.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /spec/features/login_spec.rb: -------------------------------------------------------------------------------- 1 | require 'features_helper' 2 | require 'byebug' 3 | 4 | describe 'login/logout' do 5 | before(:each) do 6 | visit('/') 7 | login = first(:link_or_button, 'Login') 8 | expect(login).not_to be_nil 9 | login.click 10 | select('Localhost', from: 'tenant_id') 11 | first(:link_or_button, 'Submit').click 12 | end 13 | 14 | describe 'Login' do 15 | it 'goes to My Datasets page when no datasets exist' do 16 | expect(page).to have_content('My Datasets') 17 | end 18 | end 19 | 20 | describe 'Logout' do 21 | it 'returns to the home page' do 22 | logout = first(:link_or_button, 'Logout') 23 | expect(logout).not_to be_nil 24 | logout.click 25 | expect(page).to have_title(home_page_title) 26 | end 27 | end 28 | 29 | end 30 | -------------------------------------------------------------------------------- /.config-travis/tenants/localhost.yml: -------------------------------------------------------------------------------- 1 | default: &default 2 | enabled: true 3 | repository: 4 | domain: localhost 5 | endpoint: "http://localhost:39001/sword/collection/stash" 6 | username: "stash_submitter" 7 | password: "correct​horse​battery​staple" 8 | contact_email: ["contact1@example.edu", "contact2@example.edu"] 9 | abbreviation: "LH" 10 | short_name: "Localhost" 11 | long_name: "Localhost" 12 | full_domain: "localhost:33000" 13 | domain_regex: "localhost$" 14 | tenant_id: localhost 15 | identifier_service: 16 | shoulder: "doi:10.555/5555" 17 | account: stash 18 | password: stash 19 | id_scheme: doi 20 | owner: null 21 | authentication: 22 | strategy: google 23 | default_license: cc_by 24 | stash_logo_after_tenant: false 25 | 26 | development: 27 | <<: *default 28 | 29 | test: 30 | <<: *default 31 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------ 2 | # SimpleCov 3 | 4 | if ENV['COVERAGE'] 5 | require 'simplecov' 6 | SimpleCov.start 'rails' 7 | end 8 | 9 | # ------------------------------------------------------------ 10 | # Rspec configuration 11 | 12 | RSpec.configure do |config| 13 | config.color = true 14 | config.tty = true 15 | config.formatter = :documentation 16 | config.raise_errors_for_deprecations! 17 | config.mock_with :rspec 18 | end 19 | 20 | # ------------------------------------------------------------ 21 | # Stash 22 | 23 | STASH_ENGINE_PATH = Gem::Specification.find_by_name('stash_engine').gem_dir 24 | STASH_DATACITE_PATH = Gem::Specification.find_by_name('stash_datacite').gem_dir 25 | STASH_DISCOVERY_PATH = Gem::Specification.find_by_name('stash_discovery').gem_dir 26 | 27 | require 'mocks/mock_repository.rb' 28 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------ 2 | # Rails defaults 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | Rails.application.load_tasks 6 | 7 | # ------------------------------------------------------------ 8 | # Coverage 9 | 10 | desc 'Run all unit tests with coverage' 11 | task :coverage do 12 | ENV['COVERAGE'] = 'true' 13 | Rake::Task['spec'].execute 14 | end 15 | 16 | # ------------------------------------------------------------ 17 | # RuboCop 18 | 19 | require 'rubocop/rake_task' 20 | RuboCop::RakeTask.new 21 | 22 | # ------------------------------------------------------------ 23 | # Defaults 24 | 25 | # clear rspec/rails default :spec task in favor of :coverage 26 | Rake::Task[:default].clear if Rake::Task.task_defined?(:default) 27 | 28 | desc 'Run unit tests, check code style' 29 | task default: %i[spec rubocop] 30 | -------------------------------------------------------------------------------- /.simplecov: -------------------------------------------------------------------------------- 1 | require 'simplecov-console' 2 | 3 | # Up one level to include stash 4 | COVERAGE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) 5 | 6 | # Hack for SimpleCov #5 https://github.com/chetan/simplecov-console/issues/5 7 | SimpleCov::Formatter::Console::ROOT = COVERAGE_ROOT 8 | Module::ROOT = COVERAGE_ROOT 9 | 10 | # Filter out third-party code 11 | class VendorFilter < SimpleCov::Filter 12 | def matches?(source_file) 13 | path = source_file.filename 14 | path =~ %r{vendor/bundle/ruby} || 15 | path =~ %r{rvm/gems/ruby} || 16 | path =~ %r{rvm/rubies} 17 | end 18 | end 19 | 20 | SimpleCov.configure do 21 | filters.clear 22 | add_filter '/spec/' 23 | add_filter VendorFilter.new(COVERAGE_ROOT) 24 | SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [ 25 | SimpleCov::Formatter::HTMLFormatter, 26 | SimpleCov::Formatter::Console 27 | ] 28 | end 29 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | 14 | // This is renamed "papplication.js" because otherwise it clobbers the one needed by 15 | // geoblacklight to load it's junk and then nothing works. 16 | 17 | //= require jquery 18 | //= require jquery_ujs 19 | //= require turbolinks 20 | //= require_tree . 21 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_publication_years.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | publication_year: '2017' 4 | resource_id: 1 5 | created_at: &3 2017-08-24 21:06:24.000000000 Z 6 | updated_at: &4 2017-08-24 21:06:24.000000000 Z 7 | 8 | id: 2 9 | publication_year: '2017' 10 | resource_id: 2 11 | created_at: &3 2017-08-24 21:10:18.000000000 Z 12 | updated_at: &4 2017-08-24 21:10:18.000000000 Z 13 | 14 | id: 3 15 | publication_year: '2017' 16 | resource_id: 3 17 | created_at: &3 2017-08-24 21:13:40.000000000 Z 18 | updated_at: &4 2017-08-24 21:13:40.000000000 Z 19 | 20 | id: 4 21 | publication_year: '2017' 22 | resource_id: 4 23 | created_at: &3 2017-08-24 21:18:32.000000000 Z 24 | updated_at: &4 2017-08-24 21:18:32.000000000 Z 25 | 26 | id: 5 27 | publication_year: '2017' 28 | resource_id: 5 29 | created_at: &3 2017-08-24 21:29:13.000000000 Z 30 | updated_at: &4 2017-08-24 21:29:13.000000000 Z -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | 4 | # path to your application root. 5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 6 | 7 | Dir.chdir APP_ROOT do 8 | # This script is a starting point to setup your application. 9 | # Add necessary setup steps to this file: 10 | 11 | puts "== Installing dependencies ==" 12 | system "gem install bundler --conservative" 13 | system "bundle check || bundle install" 14 | 15 | # puts "\n== Copying sample files ==" 16 | # unless File.exist?("config/database.yml") 17 | # system "cp config/database.yml.sample config/database.yml" 18 | # end 19 | 20 | puts "\n== Preparing database ==" 21 | system "bin/rake db:setup" 22 | 23 | puts "\n== Removing old logs and tempfiles ==" 24 | system "rm -f log/*" 25 | system "rm -rf tmp/cache" 26 | 27 | puts "\n== Restarting application server ==" 28 | system "touch tmp/restart.txt" 29 | end 30 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_affiliations_authors.yml: -------------------------------------------------------------------------------- 1 | affil_auth1: 2 | id: 2 3 | affiliation_id: 1 4 | author_id: 1 5 | created_at: 2017-08-24 21:01:45.000000000 Z 6 | updated_at: 2017-08-24 21:01:45.000000000 Z 7 | 8 | affil_auth2: 9 | id: 3 10 | affiliation_id: 1 11 | author_id: 2 12 | created_at: 2017-08-24 21:01:45.000000000 Z 13 | updated_at: 2017-08-24 21:01:45.000000000 Z 14 | 15 | affil_auth7: 16 | id: 7 17 | affiliation_id: 1 18 | author_id: 3 19 | created_at: 2017-08-24 21:01:45.000000000 Z 20 | updated_at: 2017-08-24 21:01:45.000000000 Z 21 | 22 | affil_auth9: 23 | id: 9 24 | affiliation_id: 2 25 | author_id: 4 26 | created_at: 2017-08-24 21:01:45.000000000 Z 27 | updated_at: 2017-08-24 21:01:45.000000000 Z 28 | 29 | affil_auth10: 30 | id: 10 31 | affiliation_id: 2 32 | author_id: 5 33 | created_at: 2017-08-24 21:01:45.000000000 Z 34 | updated_at: 2017-08-24 21:01:45.000000000 Z 35 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_publishers.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | publisher: UC Berkeley 4 | resource_id: 1 5 | created_at: &3 2017-08-24 21:00:44.000000000 Z 6 | updated_at: &4 2017-08-24 21:00:44.000000000 Z 7 | 8 | id: 2 9 | publisher: UC Berkeley 10 | resource_id: 2 11 | created_at: &3 2017-08-24 21:10:18.000000000 Z 12 | updated_at: &4 2017-08-24 21:10:18.000000000 Z 13 | 14 | id: 3 15 | publisher: UC Berkeley 16 | resource_id: 3 17 | created_at: &3 2017-08-24 21:12:10.000000000 Z 18 | updated_at: &4 2017-08-24 21:12:10.000000000 Z 19 | 20 | id: 4 21 | publisher: UC Office of the President 22 | resource_id: 4 23 | created_at: &3 2017-08-24 21:15:49.000000000 Z 24 | updated_at: &4 2017-08-24 21:15:49.000000000 Z 25 | 26 | id: 5 27 | publisher: UC Office of the President 28 | resource_id: 5 29 | created_at: &3 2017-08-24 21:29:13.000000000 Z 30 | updated_at: &4 2017-08-24 21:29:13.000000000 Z -------------------------------------------------------------------------------- /Capfile: -------------------------------------------------------------------------------- 1 | # Load DSL and set up stages 2 | require 'capistrano/setup' 3 | 4 | # Include default deployment tasks 5 | require 'capistrano/deploy' 6 | 7 | # Include tasks from other gems included in your Gemfile 8 | # 9 | # For documentation on these, see for example: 10 | # 11 | # https://github.com/capistrano/rvm 12 | # https://github.com/capistrano/rbenv 13 | # https://github.com/capistrano/chruby 14 | # https://github.com/capistrano/bundler 15 | # https://github.com/capistrano/rails 16 | # https://github.com/capistrano/passenger 17 | # 18 | # require 'capistrano/rvm' 19 | # require 'capistrano/rbenv' 20 | # require 'capistrano/chruby' 21 | require 'capistrano/bundler' 22 | require 'capistrano/rails/assets' 23 | require 'capistrano/rails/migrations' 24 | require 'capistrano/passenger' 25 | 26 | # Load custom tasks from `lib/capistrano/tasks` if you have any defined 27 | Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } 28 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_geo_location_point.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | latitude: !ruby/object:BigDecimal 18:0.3706265e2 4 | longitude: !ruby/object:BigDecimal 18:-0.76333e2 5 | created_at: &3 2017-08-24 21:03:57.000000000 Z 6 | updated_at: &4 2017-08-24 21:03:57.000000000 Z 7 | 8 | id: 2 9 | latitude: !ruby/object:BigDecimal 18:0.37057917e2 10 | longitude: !ruby/object:BigDecimal 18:-0.7634717e2 11 | created_at: &3 2017-08-24 21:04:21.000000000 Z 12 | updated_at: &4 2017-08-24 21:04:21.000000000 Z 13 | 14 | id: 3 15 | latitude: !ruby/object:BigDecimal 18:0.3706265e2 16 | longitude: !ruby/object:BigDecimal 18:-0.76333e2 17 | created_at: &3 2017-08-24 21:10:18.000000000 Z 18 | updated_at: &4 2017-08-24 21:10:18.000000000 Z 19 | 20 | id: 4 21 | latitude: !ruby/object:BigDecimal 18:0.37057917e2 22 | longitude: !ruby/object:BigDecimal 18:-0.7634717e2 23 | created_at: &3 2017-08-24 21:10:18.000000000 Z 24 | updated_at: &4 2017-08-24 21:10:18.000000000 Z -------------------------------------------------------------------------------- /spec/config/solr/conf/protwords.txt: -------------------------------------------------------------------------------- 1 | # The ASF licenses this file to You under the Apache License, Version 2.0 2 | # (the "License"); you may not use this file except in compliance with 3 | # the License. You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | #----------------------------------------------------------------------- 14 | # Use a protected word file to protect against the stemmer reducing two 15 | # unrelated words to the same base word. 16 | 17 | # Some non-words that normally won't be encountered, 18 | # just to test that they won't be stemmed. 19 | dontstems 20 | zwhacky 21 | 22 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_subjects_stash_engine_resources.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | resource_id: 1 4 | subject_id: 1 5 | created_at: 2017-08-24 21:02:29.000000000 Z 6 | updated_at: 2017-08-24 21:02:29.000000000 Z 7 | 8 | id: 2 9 | resource_id: 1 10 | subject_id: 2 11 | created_at: 2017-08-24 21:02:29.000000000 Z 12 | updated_at: 2017-08-24 21:02:29.000000000 Z 13 | 14 | id: 3 15 | resource_id: 1 16 | subject_id: 3 17 | created_at: 2017-08-24 21:02:29.000000000 Z 18 | updated_at: 2017-08-24 21:02:29.000000000 Z 19 | 20 | id: 4 21 | resource_id: 2 22 | subject_id: 1 23 | created_at: 2017-08-24 21:02:29.000000000 Z 24 | updated_at: 2017-08-24 21:02:29.000000000 Z 25 | 26 | id: 5 27 | resource_id: 2 28 | subject_id: 2 29 | created_at: 2017-08-24 21:02:29.000000000 Z 30 | updated_at: 2017-08-24 21:02:29.000000000 Z 31 | 32 | id: 6 33 | resource_id: 2 34 | subject_id: 3 35 | created_at: 2017-08-24 21:02:29.000000000 Z 36 | updated_at: 2017-08-24 21:02:29.000000000 Z -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_resource_states.yml: -------------------------------------------------------------------------------- 1 | state1: 2 | id: 1 3 | user_id: 1 4 | resource_state: submitted 5 | created_at: 2017-08-24 21:00:44.000000000 Z 6 | updated_at: 2017-08-24 21:06:21.000000000 Z 7 | resource_id: 1 8 | 9 | state2: 10 | id: 2 11 | user_id: 1 12 | resource_state: submitted 13 | created_at: 2017-08-24 21:10:18.000000000 Z 14 | updated_at: 2017-08-24 21:11:20.000000000 Z 15 | resource_id: 2 16 | 17 | state3: 18 | id: 3 19 | user_id: 1 20 | resource_state: submitted 21 | created_at: 2017-08-24 21:12:10.000000000 Z 22 | updated_at: 2017-08-24 21:13:40.000000000 Z 23 | resource_id: 3 24 | 25 | state4: 26 | id: 4 27 | user_id: 2 28 | resource_state: submitted 29 | created_at: 2017-08-24 21:15:49.000000000 Z 30 | updated_at: 2017-08-24 21:23:13.000000000 Z 31 | resource_id: 4 32 | 33 | state5: 34 | id: 5 35 | user_id: 2 36 | resource_state: in_progress 37 | created_at: 2017-08-24 21:29:13.000000000 Z 38 | updated_at: 2017-08-24 21:29:13.000000000 Z 39 | resource_id: 5 -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_edit_histories.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | resource_id: 1 4 | user_comment: 5 | created_at: &3 2017-08-24 21:06:21.000000000 Z 6 | updated_at: &4 2017-08-24 21:06:21.000000000 Z 7 | 8 | id: 2 9 | resource_id: 2 10 | user_comment: 11 | created_at: &3 2017-08-24 21:11:20.000000000 Z 12 | updated_at: &4 2017-08-24 21:11:20.000000000 Z 13 | 14 | id: 3 15 | resource_id: 3 16 | user_comment: 17 | created_at: &3 2017-08-24 21:13:40.000000000 Z 18 | updated_at: &4 2017-08-24 21:13:40.000000000 Z 19 | 20 | id: 4 21 | resource_id: 4 22 | user_comment: 23 | created_at: &3 2017-08-24 21:18:30.000000000 Z 24 | updated_at: &4 2017-08-24 21:18:30.000000000 Z 25 | 26 | id: 5 27 | resource_id: 4 28 | user_comment: 29 | created_at: &3 2017-08-24 21:20:41.000000000 Z 30 | updated_at: &4 2017-08-24 21:20:41.000000000 Z 31 | 32 | id: 6 33 | resource_id: 4 34 | user_comment: 35 | created_at: &3 2017-08-24 21:23:13.000000000 Z 36 | updated_at: &4 2017-08-24 21:23:13.000000000 Z -------------------------------------------------------------------------------- /spec/fixtures/dcs_datecite_dates.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | date: '2017-08-24T21:06:21Z' 4 | date_type: available 5 | resource_id: 1 6 | created_at: &3 2017-08-24 21:06:21.000000000 Z 7 | updated_at: &4 2017-08-24 21:06:21.000000000 Z 8 | 9 | id: 2 10 | date: '2017-08-24T21:06:21Z' 11 | date_type: available 12 | resource_id: 2 13 | created_at: &3 2017-08-24 21:10:18.000000000 Z 14 | updated_at: &4 2017-08-24 21:10:18.000000000 Z 15 | 16 | id: 3 17 | date: '2017-08-24T21:13:40Z' 18 | date_type: available 19 | resource_id: 3 20 | created_at: &3 2017-08-24 21:13:40.000000000 Z 21 | updated_at: &4 2017-08-24 21:13:40.000000000 Z 22 | 23 | id: 4 24 | date: '2017-08-24T21:18:30Z' 25 | date_type: available 26 | resource_id: 4 27 | created_at: &3 2017-08-24 21:18:30.000000000 Z 28 | updated_at: &4 2017-08-24 21:18:30.000000000 Z 29 | 30 | id: 5 31 | date: '2017-08-24T21:18:30Z' 32 | date_type: available 33 | resource_id: 5 34 | created_at: &3 2017-08-24 21:29:13.000000000 Z 35 | updated_at: &4 2017-08-24 21:29:13.000000000 Z -------------------------------------------------------------------------------- /spec/features/timed_publication_spec.rb: -------------------------------------------------------------------------------- 1 | require 'features_helper' 2 | 3 | describe 'timed publication' do 4 | 5 | before(:each) do 6 | start_new_dataset! 7 | fill_required_fields! 8 | navigate_to_review! 9 | end 10 | 11 | it 'sets the embargo end date' do 12 | expect(page).to have_content('Choose Publication Date') 13 | 14 | today_button = find_by_id('today_button') 15 | expect(today_button).to be_checked 16 | 17 | future_button = find_by_id('future_button') 18 | expect(future_button).not_to be_checked 19 | 20 | future_button.click 21 | 22 | end_date = Date.today + 3.months 23 | 24 | fill_in_future_pub_date(end_date) 25 | 26 | # force focus change 27 | find_by_id('agree_to_license').click 28 | 29 | wait_for_ajax! 30 | 31 | resource = current_resource 32 | pub_date = resource.notional_publication_date.to_date 33 | expect(pub_date).to eq(end_date) 34 | 35 | embargo = resource.embargo 36 | embargo_end_date = embargo.end_date.to_date 37 | expect(embargo_end_date).to eq(end_date) 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_resource_types.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | resource_type_general: dataset 4 | resource_type: dataset 5 | resource_id: 1 6 | created_at: &3 2017-08-24 21:00:44.000000000 Z 7 | updated_at: &4 2017-08-24 21:00:44.000000000 Z 8 | 9 | id: 2 10 | resource_type_general: dataset 11 | resource_type: dataset 12 | resource_id: 2 13 | created_at: &3 2017-08-24 21:10:18.000000000 Z 14 | updated_at: &4 2017-08-24 21:10:18.000000000 Z 15 | 16 | id: 3 17 | resource_type_general: dataset 18 | resource_type: dataset 19 | resource_id: 3 20 | created_at: &3 2017-08-24 21:12:10.000000000 Z 21 | updated_at: &4 2017-08-24 21:12:10.000000000 Z 22 | 23 | id: 4 24 | resource_type_general: dataset 25 | resource_type: dataset 26 | resource_id: 4 27 | created_at: &3 2017-08-24 21:15:49.000000000 Z 28 | updated_at: &4 2017-08-24 21:15:49.000000000 Z 29 | 30 | id: 5 31 | resource_type_general: dataset 32 | resource_type: dataset 33 | resource_id: 5 34 | created_at: &3 2017-08-24 21:29:13.000000000 Z 35 | updated_at: &4 2017-08-24 21:29:13.000000000 Z 36 | -------------------------------------------------------------------------------- /spec/features/delete_everything_hhjk_spec.rb: -------------------------------------------------------------------------------- 1 | require 'features_helper' 2 | require 'rsolr' 3 | 4 | describe 'solr sanitization' do 5 | 6 | def uuid 7 | @uuid ||= '12345' 8 | end 9 | 10 | def solr_url 11 | @solr_url ||= YAML.safe_load(File.read(SolrHelper::BLACKLIGHT_YML))['test']['url'] 12 | end 13 | 14 | def solr 15 | @solr ||= RSolr.connect(url: solr_url) 16 | end 17 | 18 | def record_count 19 | response = solr.get('select', params: { q: '*:*' })['response'] 20 | response['numFound'] 21 | end 22 | 23 | before(:each) do 24 | solr.add(uuid: uuid) 25 | solr.commit 26 | expect(record_count).to eq(1) 27 | end 28 | 29 | after(:each) do 30 | solr.delete_by_query("uuid:#{uuid}") 31 | solr.commit 32 | expect(record_count).to eq(0) 33 | end 34 | 35 | it 'doesn\'t let you delete everything by hacking the discovery URL' do 36 | expect(record_count).to eq(1) 37 | 38 | # TODO: see http://mail-archives.apache.org/mod_mbox/lucene-dev/201710.mbox/%3CCAJEmKoC%2BeQdP-E6BKBVDaR_43fRs1A-hOLO3JYuemmUcr1R%2BTA%40mail.gmail.com%3E 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_versions.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | version: 1 4 | zip_filename: 1_archive.zip 5 | resource_id: 1 6 | created_at: 2017-08-24 21:00:44.000000000 Z 7 | updated_at: 2017-08-24 21:06:42.000000000 Z 8 | merritt_version: 1 9 | 10 | id: 2 11 | version: 2 12 | zip_filename: 2_archive.zip 13 | resource_id: 2 14 | created_at: 2017-08-24 21:10:18.000000000 Z 15 | updated_at: 2017-08-24 21:11:30.000000000 Z 16 | merritt_version: 2 17 | 18 | id: 3 19 | version: 1 20 | zip_filename: 3_archive.zip 21 | resource_id: 3 22 | created_at: 2017-08-24 21:12:10.000000000 Z 23 | updated_at: 2017-08-24 21:13:53.000000000 Z 24 | merritt_version: 1 25 | 26 | id: 4 27 | version: 1 28 | zip_filename: 4_archive.zip 29 | resource_id: 4 30 | created_at: 2017-08-24 21:15:49.000000000 Z 31 | updated_at: 2017-08-24 21:23:22.000000000 Z 32 | merritt_version: 1 33 | 34 | id: 5 35 | version: 2 36 | zip_filename: 37 | resource_id: 5 38 | created_at: 2017-08-24 21:29:13.000000000 Z 39 | updated_at: 2017-08-24 21:29:13.000000000 Z 40 | merritt_version: 2 -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2016 The Regents of the University of California 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /spec/fixtures/dcs_geolocation.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | place_id: 1 4 | point_id: 1 5 | box_id: 6 | created_at: &3 2017-08-24 21:03:57.000000000 Z 7 | updated_at: &4 2017-08-24 21:03:57.000000000 Z 8 | resource_id: 1 9 | 10 | id: 2 11 | place_id: 12 | point_id: 2 13 | box_id: 14 | created_at: &3 2017-08-24 21:04:21.000000000 Z 15 | updated_at: &4 2017-08-24 21:04:21.000000000 Z 16 | resource_id: 1 17 | 18 | id: 3 19 | place_id: 20 | point_id: 21 | box_id: 1 22 | created_at: &3 2017-08-24 21:04:29.000000000 Z 23 | updated_at: &4 2017-08-24 21:04:29.000000000 Z 24 | resource_id: 1 25 | 26 | id: 4 27 | place_id: 2 28 | point_id: 3 29 | box_id: 30 | created_at: &3 2017-08-24 21:10:18.000000000 Z 31 | updated_at: &4 2017-08-24 21:10:18.000000000 Z 32 | resource_id: 2 33 | 34 | id: 5 35 | place_id: 36 | point_id: 4 37 | box_id: 38 | created_at: &3 2017-08-24 21:10:18.000000000 Z 39 | updated_at: &4 2017-08-24 21:10:18.000000000 Z 40 | resource_id: 2 41 | 42 | id: 6 43 | place_id: 44 | point_id: 45 | box_id: 2 46 | created_at: &3 2017-08-24 21:10:18.000000000 Z 47 | updated_at: &4 2017-08-24 21:10:18.000000000 Z 48 | resource_id: 2 -------------------------------------------------------------------------------- /public/images/logo_uci.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 10 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_uci.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 10 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/config/solr/conf/synonyms.txt: -------------------------------------------------------------------------------- 1 | # The ASF licenses this file to You under the Apache License, Version 2.0 2 | # (the "License"); you may not use this file except in compliance with 3 | # the License. You may obtain a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | 13 | #----------------------------------------------------------------------- 14 | #some test synonym mappings unlikely to appear in real input text 15 | aaafoo => aaabar 16 | bbbfoo => bbbfoo bbbbar 17 | cccfoo => cccbar cccbaz 18 | fooaaa,baraaa,bazaaa 19 | 20 | # Some synonym groups specific to this example 21 | GB,gib,gigabyte,gigabytes 22 | MB,mib,megabyte,megabytes 23 | Television, Televisions, TV, TVs 24 | #notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming 25 | #after us won't split it into two words. 26 | 27 | # Synonym mappings can be used for spelling correction too 28 | pixima => pixma 29 | 30 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | require 'colorize' 3 | 4 | if (env = ENV['RAILS_ENV']) 5 | abort("Can't run tests in environment #{env}") if env != 'test' 6 | else 7 | ENV['RAILS_ENV'] = 'test' 8 | end 9 | 10 | require File.expand_path('../../config/environment', __FILE__) 11 | require 'rspec/rails' 12 | require 'database_cleaner' 13 | 14 | ActiveRecord::Migration.maintain_test_schema! 15 | 16 | def check_connection_config! 17 | db_config = ActiveRecord::Base.connection_config 18 | host = db_config[:host] 19 | raise("Can't run destructive tests against non-local database #{host || 'nil'}") unless host == 'localhost' 20 | msg = "Using database #{db_config[:database]} on host #{host} with username #{db_config[:username]}" 21 | puts msg.colorize(:yellow) 22 | end 23 | 24 | RSpec.configure do |config| 25 | # allow test DB access from multiple connections 26 | config.use_transactional_fixtures = false 27 | 28 | config.fixture_path = "#{Rails.root}/spec/fixtures" 29 | 30 | # Treat specs in features/ as feature specs 31 | config.infer_spec_type_from_file_location! 32 | 33 | config.before(:suite) do 34 | DatabaseCleaner.strategy = :deletion 35 | 36 | check_connection_config! 37 | 38 | puts 'Clearing test database'.colorize(:yellow) 39 | DatabaseCleaner.clean 40 | end 41 | 42 | config.after(:each) do 43 | DatabaseCleaner.clean 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_rights.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | rights: Creative Commons Attribution 4.0 International (CC BY 4.0) 4 | rights_uri: https://creativecommons.org/licenses/by/4.0/ 5 | resource_id: 1 6 | created_at: &4 2017-08-24 21:00:44.000000000 Z 7 | updated_at: &5 2017-08-24 21:00:44.000000000 Z 8 | 9 | id: 2 10 | rights: Creative Commons Attribution 4.0 International (CC BY 4.0) 11 | rights_uri: https://creativecommons.org/licenses/by/4.0/ 12 | resource_id: 2 13 | created_at: &4 2017-08-24 21:10:18.000000000 Z 14 | updated_at: &5 2017-08-24 21:10:18.000000000 Z 15 | 16 | id: 3 17 | rights: Creative Commons Attribution 4.0 International (CC BY 4.0) 18 | rights_uri: https://creativecommons.org/licenses/by/4.0/ 19 | resource_id: 3 20 | created_at: &4 2017-08-24 21:12:10.000000000 Z 21 | updated_at: &5 2017-08-24 21:12:10.000000000 Z 22 | 23 | id: 4 24 | rights: Creative Commons Attribution 4.0 International (CC BY 4.0) 25 | rights_uri: https://creativecommons.org/licenses/by/4.0/ 26 | resource_id: 4 27 | created_at: &4 2017-08-24 21:15:49.000000000 Z 28 | updated_at: &5 2017-08-24 21:15:49.000000000 Z 29 | 30 | id: 5 31 | rights: Creative Commons Attribution 4.0 International (CC BY 4.0) 32 | rights_uri: https://creativecommons.org/licenses/by/4.0/ 33 | resource_id: 5 34 | created_at: &4 2017-08-24 21:29:13.000000000 Z 35 | updated_at: &5 2017-08-24 21:29:13.000000000 Z -------------------------------------------------------------------------------- /config/initializers/01_hash_to_ostruct.rb: -------------------------------------------------------------------------------- 1 | require 'ostruct' 2 | 3 | class OpenStruct 4 | def self_and_field_pairs 5 | each_pair.map { |field, _| [self, field] } 6 | end 7 | end 8 | 9 | class Hash 10 | # Converts a hash to an OpenStruct along with all its nested hashes. The hash 11 | # and all its sub-hashes become OpenStruct instances in the resulting 12 | # structure. 13 | 14 | # rubocop:disable all 15 | def to_ostruct 16 | top_ostruct = OpenStruct.new(self) 17 | stack = top_ostruct.self_and_field_pairs 18 | until stack.empty? 19 | ostruct, field = stack.pop 20 | case value = ostruct[field] 21 | when Hash 22 | ostruct[field] = sub_ostruct = OpenStruct.new(value) 23 | stack += sub_ostruct.self_and_field_pairs 24 | when Array 25 | # When the field is an array, iterate through all its elements 26 | # replacing all hashes with OpenStruct instances and push the new 27 | # structure's fields to the stack for nested inspection of hashes 28 | # later. 29 | value.each_with_index do |element, index| 30 | case element 31 | when Hash 32 | value[index] = sub_ostruct = OpenStruct.new(element) 33 | stack += sub_ostruct.self_and_field_pairs 34 | end 35 | end 36 | end 37 | end 38 | top_ostruct 39 | end 40 | # rubocop:enable all 41 | end -------------------------------------------------------------------------------- /public/images/logo_ucla.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 10 | 13 | 15 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ucla.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 10 | 13 | 15 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.generators: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /db/migrate/20170803225617_fix_publishers.rb: -------------------------------------------------------------------------------- 1 | class FixPublishers < ActiveRecord::Migration 2 | def change 3 | bad_to_good = { 4 | 'IFCA' => 'DataONE', 5 | 'UCLA' => 'UC Los Angeles', 6 | 'University of California-Davis' => 'UC Davis', 7 | 'University of California, Berkeley' => 'UC Berkeley', 8 | 'University of California, Los Angeles' => 'UC Los Angeles', 9 | 'University of California, Office of the President' => 'UC Office of the President', 10 | 'University of California, San Francisco' => 'UC San Francisco', 11 | 'University of California, Santa Cruz' => 'UC Santa Cruz', 12 | } 13 | 14 | query = <<-SQL 15 | SELECT * 16 | FROM dcs_publishers 17 | WHERE publisher = ? 18 | SQL 19 | 20 | update = <<-SQL 21 | UPDATE dcs_publishers 22 | SET publisher = ? 23 | WHERE publisher = ? 24 | SQL 25 | 26 | client = ActiveRecord::Base.connection.raw_connection 27 | query_stmt = client.prepare(query) 28 | update_stmt = client.prepare(update) 29 | 30 | bad_to_good.each do |bad, good| 31 | result = query_stmt.execute(bad) 32 | expected = result.count 33 | 34 | say("Updating '#{bad}' => '#{good}' (#{expected} rows)") 35 | update_stmt.execute(good, bad) # note argument order 36 | actual = update_stmt.affected_rows 37 | say("\t#{actual} rows affected") 38 | 39 | raise "Update failed; expected #{expected} rows, was #{actual}" if actual != expected 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_authors.yml: -------------------------------------------------------------------------------- 1 | author1: 2 | id: 1 3 | author_first_name: Mary 4 | author_last_name: McCormick 5 | author_email: mary.mccormick.the.great@mailinator.com 6 | author_orcid: 1234-5878-1234-5678 7 | resource_id: 1 8 | created_at: 2017-08-24 21:00:44.000000000 Z 9 | updated_at: 2017-08-24 21:01:45.000000000 Z 10 | 11 | author2: 12 | id: 2 13 | author_first_name: Mary 14 | author_last_name: McCormick 15 | author_email: mary.mccormick.the.great@mailinator.com 16 | author_orcid: 1234-5878-1234-5678 17 | resource_id: 2 18 | created_at: 2017-08-24 21:10:18.000000000 Z 19 | updated_at: 2017-08-24 21:10:18.000000000 Z 20 | 21 | author3: 22 | id: 3 23 | author_first_name: Mary 24 | author_last_name: McCormick 25 | author_email: mary.mccormick.the.great@mailinator.com 26 | author_orcid: 1234-5878-1234-5678 27 | resource_id: 3 28 | created_at: 2017-08-24 21:12:10.000000000 Z 29 | updated_at: 2017-08-24 21:13:01.000000000 Z 30 | 31 | author4: 32 | id: 4 33 | author_first_name: Leroy 34 | author_last_name: Jones 35 | author_email: leroy.jones.1234@mailinator.com 36 | author_orcid: '' 37 | resource_id: 4 38 | created_at: 2017-08-24 21:15:49.000000000 Z 39 | updated_at: 2017-08-24 21:16:40.000000000 Z 40 | 41 | author5: 42 | id: 5 43 | author_first_name: Leroy 44 | author_last_name: Jones 45 | author_email: leroy.jones.1234@mailinator.com 46 | author_orcid: '' 47 | resource_id: 5 48 | created_at: 2017-08-24 21:29:13.000000000 Z 49 | updated_at: 2017-08-24 21:29:13.000000000 Z 50 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | # Pick the frameworks you want: 4 | require "active_model/railtie" 5 | require "active_job/railtie" 6 | require "active_record/railtie" 7 | require "action_controller/railtie" 8 | require "action_mailer/railtie" 9 | require "action_view/railtie" 10 | require "sprockets/railtie" 11 | # require "rails/test_unit/railtie" 12 | 13 | # Require the gems listed in Gemfile, including any gems 14 | # you've limited to :test, :development, or :production. 15 | Bundler.require(*Rails.groups) 16 | 17 | module Dash2 18 | class Application < Rails::Application 19 | # Settings in config/environments/* take precedence over those specified here. 20 | # Application configuration should go into files in config/initializers 21 | # -- all .rb files in that directory are automatically loaded. 22 | 23 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 24 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 25 | # config.time_zone = 'Central Time (US & Canada)' 26 | 27 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 28 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 29 | # config.i18n.default_locale = :de 30 | 31 | # Do not swallow errors in after_commit/after_rollback callbacks. 32 | config.active_record.raise_in_transactional_callbacks = true 33 | config.generators.javascript_engine = :js 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /public/images/logo_ucr.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 10 | 14 | 15 | 16 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ucr.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 10 | 14 | 15 | 16 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_submission_logs.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | resource_id: 1 4 | archive_response: Success 5 | created_at: &4 2017-08-24 21:06:43.000000000 Z 6 | updated_at: &5 2017-08-24 21:06:43.000000000 Z 7 | archive_submission_request: 'Stash::Merritt::SubmissionJob for resource 1 (): posting 8 | new object to http://uc3-mrtsword-dev.cdlib.org:39001/mrtsword/collection/dash_ucb 9 | (tenant: ucb)' 10 | 11 | id: 2 12 | resource_id: 2 13 | archive_response: Success 14 | created_at: &4 2017-08-24 21:11:31.000000000 Z 15 | updated_at: &5 2017-08-24 21:11:31.000000000 Z 16 | archive_submission_request: 'Stash::Merritt::SubmissionJob for resource 2 (doi:10.5072/FK2WW7F97Z): 17 | posting update to http://sword-aws-dev.cdlib.org:39001/mrtsword/edit/dash_ucb/doi%3A10.5072%2FFK2WW7F97Z 18 | (tenant: ucb)' 19 | 20 | id: 3 21 | resource_id: 3 22 | archive_response: Success 23 | created_at: &4 2017-08-24 21:13:54.000000000 Z 24 | updated_at: &5 2017-08-24 21:13:54.000000000 Z 25 | archive_submission_request: 'Stash::Merritt::SubmissionJob for resource 3 (): posting 26 | new object to http://uc3-mrtsword-dev.cdlib.org:39001/mrtsword/collection/dash_ucb 27 | (tenant: ucb)' 28 | 29 | id: 6 30 | resource_id: 4 31 | archive_response: Success 32 | created_at: &4 2017-08-24 21:23:24.000000000 Z 33 | updated_at: &5 2017-08-24 21:23:24.000000000 Z 34 | archive_submission_request: 'Stash::Merritt::SubmissionJob for resource 4 (doi:10.5072/FK2NC60Q0S): 35 | posting new object to http://uc3-mrtsword-dev.cdlib.org:39001/mrtsword/collection/dash_cdl 36 | (tenant: ucop)' 37 | -------------------------------------------------------------------------------- /script/clear_data.rb: -------------------------------------------------------------------------------- 1 | class ClearData 2 | 3 | def self.clear 4 | to_truncate = %w(bookmarks dcs_affiliations_contributors 5 | dcs_alternate_identifiers dcs_contributors dcs_dates dcs_descriptions 6 | dcs_formats dcs_geo_location_boxes dcs_geo_location_places dcs_geo_location_points dcs_geo_locations 7 | dcs_languages dcs_name_identifiers dcs_publication_years dcs_publishers dcs_related_identifiers 8 | dcs_resource_types dcs_rights dcs_sizes dcs_subjects_stash_engine_resources 9 | dcs_versions searches stash_engine_authors stash_engine_embargoes stash_engine_file_uploads stash_engine_identifiers 10 | stash_engine_resource_states stash_engine_resource_usages stash_engine_resources stash_engine_submission_logs 11 | stash_engine_versions users) 12 | 13 | to_truncate.each do |t| 14 | query = "TRUNCATE TABLE #{t}" 15 | result = ActiveRecord::Base.connection.execute(query) 16 | puts "Truncating table #{t}" 17 | end 18 | 19 | query = "DELETE FROM dcs_affiliations WHERE abbreviation IS NULL AND short_name IS NULL" 20 | result = ActiveRecord::Base.connection.execute(query) 21 | puts "Removing extra records from affiliations" 22 | 23 | 24 | clear_solr_url = "#{Blacklight.connection_config[:url]}/update?stream.body" + 25 | '=*:*&commit=true' 26 | 27 | puts "Clearing solr" 28 | 29 | # the following, commented out, is a query test to see if SOLR blacklight is accessible 30 | #response = HTTParty.get("#{Blacklight.connection_config[:url]}/select?q=*%3A*&wt=json&indent=true") 31 | #puts response 32 | 33 | # this one will actually clear things out 34 | response = HTTParty.get(clear_solr_url) 35 | end 36 | 37 | end -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /travis-prep.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # ############################################################ 4 | # Setup 5 | 6 | # Make sure we know where we are 7 | PROJECT_ROOT=`pwd` 8 | 9 | # Fail fast 10 | set -e 11 | 12 | # ############################################################ 13 | # Local dependencies 14 | 15 | if [ ! -d ../stash ]; then 16 | BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} 17 | 18 | echo "Cloning https://github.com/CDLUC3/stash:" 19 | cd .. 20 | 21 | set -x 22 | git clone https://github.com/CDLUC3/stash 23 | 24 | echo "Checking out stash branch ${BRANCH}" 25 | 26 | cd stash 27 | git checkout ${BRANCH} 28 | { set +x; } 2>/dev/null 29 | 30 | SE_REVISION=$(git rev-parse HEAD) 31 | echo "Checked out stash branch ${BRANCH}, revision ${SE_REVISION}" 32 | 33 | cd ${PROJECT_ROOT} 34 | fi 35 | 36 | 37 | # ############################################################ 38 | # Test database 39 | 40 | echo "Initializing database:" 41 | set -x 42 | mysql -u root -e 'CREATE DATABASE IF NOT EXISTS dashv2_test' 43 | mysql -u root -e 'GRANT ALL ON dashv2_test.* TO travis@localhost' 44 | { set +x; } 2>/dev/null 45 | 46 | # ############################################################ 47 | # Configuration 48 | 49 | echo "Copying configuration files:" 50 | cd .config-travis 51 | CONFIG_FILES=$(find . -type f | sed "s|^\./||") 52 | cd ${PROJECT_ROOT} 53 | for CONFIG_FILENAME in ${CONFIG_FILES}; do 54 | SOURCE_FILE=.config-travis/${CONFIG_FILENAME} 55 | DEST_FILE=config/${CONFIG_FILENAME} 56 | if [ -L ${DEST_FILE} ]; then 57 | echo " skipping symlink ${DEST_FILE}" 58 | else 59 | set -x 60 | mkdir -p $(dirname ${DEST_FILE}) 61 | cp ${SOURCE_FILE} ${DEST_FILE} 62 | { set +x; } 2>/dev/null 63 | fi 64 | done 65 | -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_users.yml: -------------------------------------------------------------------------------- 1 | mary_mccormick: 2 | id: 1 3 | first_name: Mary 4 | last_name: McCormick 5 | email: mary.mccormick.the.great@mailinator.com 6 | uid: mary.mccormick.the.great-ucb@mailinator.com 7 | provider: developer 8 | oauth_token: 9 | created_at: 2017-08-24 21:00:08.000000000 Z 10 | updated_at: 2017-08-24 21:00:08.000000000 Z 11 | tenant_id: localhost 12 | last_login: 2017-08-24 21:00:08.000000000 Z 13 | role: user 14 | orcid: 1234-5878-1234-5678 15 | 16 | leroy_jones: 17 | id: 2 18 | first_name: Leroy 19 | last_name: Jones 20 | email: leroy.jones.1234@mailinator.com 21 | uid: leroy.jones.1234-ucop@mailinator.com 22 | provider: developer 23 | oauth_token: 24 | created_at: 2017-08-24 21:15:46.000000000 Z 25 | updated_at: 2017-08-24 21:15:46.000000000 Z 26 | tenant_id: localhost 27 | last_login: 2017-08-24 21:15:46.000000000 Z 28 | role: user 29 | orcid: '' 30 | 31 | grolinda_nagios: 32 | id: 3 33 | first_name: Grolinda 34 | last_name: Nagios 35 | email: grolinda.nagios@mailinator.com 36 | uid: grolinda.nagios-ucop@mailinator.com 37 | provider: developer 38 | oauth_token: 39 | created_at: 2017-08-24 21:32:22.000000000 Z 40 | updated_at: 2017-08-24 21:32:22.000000000 Z 41 | tenant_id: ucop 42 | last_login: 2017-08-24 21:32:22.000000000 Z 43 | role: superuser 44 | orcid: '' 45 | 46 | lolinda_myadmin: 47 | id: 4 48 | first_name: Lolinda 49 | last_name: MyAdmin 50 | email: lolinda.myadmin@mailinator.com 51 | uid: lolinda.myadmin-ucop@mailinator.com 52 | provider: developer 53 | oauth_token: 54 | created_at: 2017-08-24 21:32:22.000000000 Z 55 | updated_at: 2017-08-24 21:32:22.000000000 Z 56 | tenant_id: ucop 57 | last_login: 2017-08-24 21:32:22.000000000 Z 58 | role: admin 59 | orcid: '' 60 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | - 'bin/**/*' 4 | - 'config/**/*' 5 | - 'db/**/*' 6 | - 'script/**/*' 7 | - 'vendor/**/*' 8 | # Suppress complaints about post-2.0 syntax 9 | TargetRubyVersion: 2.2 10 | 11 | # Allow one line around block body (Layout/EmptyLines will still disallow two or more) 12 | Layout/EmptyLinesAroundBlockBody: 13 | Enabled: false 14 | 15 | # Allow one line around class body (Layout/EmptyLines will still disallow two or more) 16 | Layout/EmptyLinesAroundClassBody: 17 | Enabled: false 18 | 19 | # Allow one line around module body (Layout/EmptyLines will still disallow two or more) 20 | Layout/EmptyLinesAroundModuleBody: 21 | Enabled: false 22 | 23 | # Make indents consistent regardless of the lengths of variables and method names and whatnot 24 | Layout/MultilineMethodCallIndentation: 25 | EnforcedStyle: indented 26 | 27 | # Produces monsters 28 | Layout/MultilineOperationIndentation: 29 | Enabled: false 30 | 31 | # Reasonable line-length check; it's too easy for the cure to be worse than the disease 32 | Metrics/LineLength: 33 | Max: 150 34 | 35 | # 👎 to cultural imperialism 36 | Style/AsciiComments: 37 | Enabled: false 38 | 39 | # Disable problematic module documentation check (see https://github.com/bbatsov/rubocop/issues/947) 40 | Style/Documentation: 41 | Enabled: false 42 | 43 | # Requiring the lambda() method just makes wordy calls wordier 44 | Style/Lambda: 45 | EnforcedStyle: literal 46 | 47 | # Unclear why it's a good idea to give parameters semantically meaningless names 48 | Style/SingleLineBlockParams: 49 | Enabled: false 50 | 51 | # Confusing and weird 52 | Naming/VariableNumber: 53 | Enabled: false 54 | 55 | # Allow some special handling for engines 56 | Bundler/OrderedGems: 57 | TreatCommentsAsGroupSeparators: true 58 | -------------------------------------------------------------------------------- /script/import_file_list.rb: -------------------------------------------------------------------------------- 1 | # a manual class for importing a file list from an atom feed from Merritt. 2 | # Useful so that we can use the ActiveRecord connection for whatever environment to populate it from the atom feed. 3 | 4 | class ImportFileList 5 | 6 | def initialize(atom_url: 'https://merritt.cdlib.org/object/recent.atom?collection=ark:/13030/m5q82t8x', 7 | ark: 'ark:/b6078/d1ks3m', 8 | resource_id: 272) 9 | @atom_url = atom_url 10 | @ark = ark 11 | @resource_id = resource_id 12 | end 13 | 14 | def populate_files 15 | noko = get_atom 16 | items = filter(noko) 17 | items.each do |i| 18 | fn = i.attribute('title').value 19 | fn.gsub!(/^producer\//, '') unless fn.blank? 20 | size = i.attribute('length').value.try(:to_i) 21 | content_type = i.attribute('type').value 22 | #puts "#{fn} #{size} #{content_type}" 23 | unless StashEngine::FileUpload.where(upload_file_name: fn).where(resource_id: @resource_id).count > 0 24 | StashEngine::FileUpload.create({ 25 | upload_file_name: fn, 26 | upload_content_type: content_type, 27 | upload_file_size: size, 28 | resource_id: @resource_id, 29 | upload_updated_at: Time.new, 30 | file_state: 'created'} 31 | ) 32 | end 33 | end 34 | end 35 | 36 | # gets the atom feed as a Nokogiri XML object 37 | def get_atom 38 | response = HTTParty.get(@atom_url) 39 | doc = Nokogiri::XML(response) 40 | doc.remove_namespaces! 41 | end 42 | 43 | def filter(noko) 44 | noko.xpath("//feed//link[@rel='http://purl.org/dc/terms/hasPart']" + 45 | "[starts-with(@href, '/d/#{CGI::escape(@ark)}/')]" + 46 | "[starts-with(@title, 'producer/')]" 47 | ) 48 | end 49 | end -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 7 | 56 | 57 | 58 | 59 | 60 |
61 |
62 |

The page you were looking for doesn't exist.

63 |

You may have mistyped the address or the page may have moved.

64 |
65 |

If you are the application owner check the logs for more information.

66 |
67 | 68 | 69 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static file server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.cache_store = :null_store 18 | config.static_cache_control = 'public, max-age=3600' 19 | 20 | # Show full error reports and disable caching. 21 | config.consider_all_requests_local = true 22 | config.action_controller.perform_caching = false 23 | 24 | # Raise exceptions instead of rendering exception templates. 25 | config.action_dispatch.show_exceptions = false 26 | 27 | # Disable request forgery protection in test environment. 28 | config.action_controller.allow_forgery_protection = false 29 | 30 | # Tell Action Mailer not to deliver emails to the real world. 31 | # The :test delivery method accumulates sent emails in the 32 | # ActionMailer::Base.deliveries array. 33 | config.action_mailer.delivery_method = :test 34 | 35 | # Randomize the order test cases are executed. 36 | config.active_support.test_order = :random 37 | 38 | # Print deprecation notices to the stderr. 39 | config.active_support.deprecation = :stderr 40 | 41 | # Raises error for missing translations 42 | # config.action_view.raise_on_missing_translations = true 43 | end 44 | -------------------------------------------------------------------------------- /documentation/submission_flow.md: -------------------------------------------------------------------------------- 1 | Dash Submission Flow 2 | 3 | 1. Fill in metadata (DataCite) 4 | * Mostly AJAX in one page by way of JQuery and/or Rails Unobtrusive Javascript (UJS) 5 | * Other widgets in page include mapping (Leaflet), links out to ORCID login to validate user 6 | 2. Upload files 7 | * Upload files directly (get copied onto web server until successful submission) 8 | * Or choose URLs where files are located and can be retrieved by http(s). They are validated that they exist and a download can start. 9 | * Also some transformations of Google Drive/Box/Dropbox URLs into the download links 10 | 3. Review before submit 11 | * Missing required data shown 12 | * Review display 13 | * Private for peer review (embargo) delay can be set 14 | * Accept license 15 | 4. Submission 16 | * Update metadata with EZID/DataCite for the submitted item. 17 | * Uses SWORD to submit to Merritt in background process 18 | * SWORD submission is currently synchronous within background process 19 | * Package sent contains manifest (for URLs) or zip file with metadata files and data files 20 | * Mrt-datacite.xml, mrt-dataone-manifest.txt, mrt-embargo.txt, mrt-oaidc.xml, stash-wrapper.xml sent to merritt 21 | * If sending a manifest, these xml files are hosted on the Dash server and picked up by Merritt as part of its ingest. 22 | 5. Harvesting 23 | * When Merritt has successfully ingested the dataset, it shows up in the OAI-PMH feed it exposes. 24 | * Harvester runs every 5 minutes and checks for updates. 25 | * With new updates it adds metadata into SOLR 26 | * Notifies UI that update has finished. 27 | 6. UI finishes actions for successfully submitted dataset when notified 28 | * Sets download_uri and update_uri if needed 29 | * Changes state to ‘submitted’ 30 | * Cleans up staged, temporary files for this submission 31 | * Delivers invitations for co-authors without ORCIDs 32 | * Updates the total dataset size by querying Merritt 33 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 31 | # yet still be able to expire them through the digest params. 32 | config.assets.digest = true 33 | 34 | # Adds additional error checking when serving assets at runtime. 35 | # Checks for improperly declared sprockets dependencies. 36 | # Raises helpful error messages. 37 | config.assets.raise_runtime_errors = true 38 | 39 | # Raises error for missing translations 40 | # config.action_view.raise_on_missing_translations = true 41 | 42 | config.action_mailer.delivery_method = :sendmail 43 | config.action_mailer.perform_deliveries = true 44 | config.action_mailer.raise_delivery_errors = true 45 | config.action_mailer.default_url_options = { :host => "https://dash2-dev.ucop.edu/stash" } 46 | end 47 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | require File.join(File.dirname(__FILE__), 'lib', 'bundler_help.rb') 3 | 4 | # ############################################################ 5 | # Rails 6 | 7 | gem 'mysql2', '~> 0.4' 8 | gem 'rails', '4.2.11' 9 | 10 | # ############################################################ 11 | # Local engines 12 | 13 | path '../stash' do 14 | gem 'stash_api' 15 | gem 'stash_datacite' 16 | gem 'stash_discovery' 17 | gem 'stash_engine' 18 | # needs engines to load first 19 | gem 'stash-merritt' 20 | end 21 | 22 | # ############################################################ 23 | # Deployment 24 | 25 | gem 'capistrano', '~> 3.4.1' 26 | gem 'capistrano-passenger' 27 | gem 'capistrano-rails', '~> 1.1' 28 | gem 'passenger' 29 | gem 'rubocop', '~> 0.52.1' 30 | 31 | # ############################################################ 32 | # UI 33 | 34 | # TODO: why do we have uglifier AND yui-compressor? 35 | # asset pipeline problems with Joel's pre-minified CSS/JS caused errors with uglifier and had to revert to yui-compressor 36 | 37 | gem 'coffee-rails', '~> 4.1.0' 38 | gem 'jquery-rails' 39 | gem 'sass-rails', '~> 5.0' 40 | gem 'therubyracer', platforms: :ruby 41 | gem 'turbolinks' 42 | 43 | gem 'uglifier', '~> 3.0.4' 44 | gem 'yui-compressor' 45 | 46 | # ############################################################ 47 | # Misc 48 | 49 | gem 'exception_notification' 50 | gem 'httparty' 51 | gem 'jbuilder', '~> 2.0' 52 | 53 | # ############################################################ 54 | # Development and testing 55 | 56 | group :development do 57 | gem 'colorize', '~> 0.8' 58 | gem 'web-console', '~> 2.0' 59 | end 60 | 61 | group :test do 62 | gem 'capybara', '~> 2.16' 63 | gem 'chromedriver-helper', '~> 1.1' 64 | gem 'database_cleaner', '~> 1.5' 65 | gem 'selenium-webdriver', '~> 3.7' 66 | gem 'simplecov', '~> 0.14' 67 | gem 'simplecov-console', '~> 0.4' 68 | gem 'solr_wrapper', '~> 1.1' 69 | end 70 | 71 | group :development, :test do 72 | gem 'binding_of_caller' 73 | gem 'byebug' 74 | gem 'pry' 75 | gem 'pry-rails' 76 | gem 'pry-remote' 77 | gem 'rspec-rails', '~> 3.0' 78 | end 79 | -------------------------------------------------------------------------------- /spec/features/review_spec.rb: -------------------------------------------------------------------------------- 1 | require 'features_helper' 2 | require 'byebug' 3 | 4 | describe 'review ' do 5 | before(:each) do 6 | start_new_dataset! 7 | end 8 | 9 | describe 'publication date' do 10 | DATE_FORMAT = '%B %e, %Y'.freeze 11 | 12 | before(:each) do 13 | navigate_to_review! 14 | end 15 | 16 | it 'defaults to today' do 17 | today_str = Date.today.strftime(DATE_FORMAT) 18 | expect(page).to have_content("Publication date: #{today_str}") 19 | end 20 | 21 | it 'reflects the embargo date, if any' do 22 | future_button = find_by_id('future_button') 23 | future_button.click 24 | 25 | end_date = Date.today + 3.months 26 | fill_in_future_pub_date(end_date) 27 | 28 | page.find('body').click # maybe needed if selenium doesn't trigger blur correctly 29 | 30 | navigate_to_metadata! 31 | navigate_to_review! 32 | 33 | end_date_str = end_date.strftime(DATE_FORMAT) 34 | expect(page).to have_content("Publication date: #{end_date_str}") 35 | end 36 | end 37 | 38 | describe 'without required fields' do 39 | before(:each) do 40 | navigate_to_review! 41 | end 42 | 43 | it 'disables submit' do 44 | submit = find_button('submit_dataset', disabled: :all) 45 | expect(submit).not_to be_nil 46 | expect(submit).to be_disabled 47 | end 48 | end 49 | 50 | describe 'with required fields' do 51 | before(:each) do 52 | fill_required_fields! 53 | navigate_to_review! 54 | find_by_id('agree_to_license').click 55 | end 56 | 57 | it 'allows submit' do 58 | submit = find_button('submit_dataset', disabled: :all) 59 | expect(submit).not_to be_nil 60 | expect(submit).not_to be_disabled 61 | end 62 | 63 | it 'submits' do 64 | # get these now since they're only on the edit pages 65 | resource_id = current_resource_id 66 | resource = current_resource 67 | 68 | expect(StashEngine.repository).to receive(:submit).with(resource_id: resource_id) 69 | submit = find_button('submit_dataset', disabled: :all) 70 | submit.click 71 | 72 | expect(page).to have_content('My Datasets') 73 | expect(page).to have_content resource.title 74 | end 75 | end 76 | end 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dash 2 | 3 | [![Build Status](https://travis-ci.org/CDLUC3/dashv2.svg?branch=development)](https://travis-ci.org/CDLUC3/dashv2) 4 | 5 | ## Introduction 6 | 7 | **Dash** is the [UC Curation Center](http://www.cdlib.org/uc3/)'s 8 | implementation of the [Stash](https://github.com/CDLUC3/stash) application 9 | framework for research data publication and preservation, based on the 10 | [DataCite Metadata Schema](https://schema.datacite.org/) and the University 11 | of California’s [Merritt](https://merritt.cdlib.org/) repository service. 12 | 13 | - [About Dash](app/views/layouts/_about.html.md) 14 | 15 | ## Development 16 | 17 | ### Installation 18 | 19 | See 20 | [Dash2 Installation](https://github.com/CDLUC3/dashv2/blob/master/documentation/dash2_install.md) 21 | for installation notes. 22 | 23 | ### Quick Cheat Sheet 24 | 25 | #### Development environment setup 26 | 27 | At the same level as the `dashv2` directory: 28 | 29 | - Clone the [Stash](https://github.com/CDLUC3/stash) repository (public): 30 | 31 | ``` 32 | git clone https://github.com/CDLUC3/stash.git 33 | ``` 34 | 35 | - Clone the [dash2-config](https://github.com/cdlib/dash2-config/) repository 36 | (private to CDL developers): 37 | 38 | ``` 39 | git clone git@github.com:cdlib/dash2-config.git 40 | ``` 41 | 42 | - Symlink configuration files from `dash2-config` into the `dashv2` 43 | `config` directory: 44 | 45 | ``` 46 | ./symlink_config.sh 47 | ``` 48 | 49 | #### Running integration/feature tests locally 50 | 51 | In the `dashv2` directory: 52 | 53 | - run `travis-prep.sh` 54 | - run `bundle exec rake` 55 | 56 | #### Capistrano deployment 57 | 58 | To deploy the latest (committed) code from GitHub: 59 | 60 | ``` 61 | bundle exec cap deploy [BRANCH=""] 62 | ``` 63 | 64 | The `$BRANCH` environment variable is optional; if it’s omitted, the 65 | deploy script will prompt you. 66 | 67 | #### Miscellaneous tasks 68 | 69 | - The `rake app_data:clear` task will clear most database and SOLR data. It 70 | can be useful to run before testing data import and transformation from our 71 | previous version of the app. It will not erase data in the production 72 | environment or until it gets confirmation that you really want to erase the 73 | data. 74 | 75 | ``` 76 | bundle exec rake app_data:clear RAILS_ENV= 77 | ``` 78 | -------------------------------------------------------------------------------- /.config-travis/settings.yml: -------------------------------------------------------------------------------- 1 | # Configurable Logo Used for CartoDB export 2 | APPLICATION_LOGO_URL: 'http://geoblacklight.org/images/geoblacklight-logo.png' 3 | 4 | # Carto OneClick Service https://carto.com/engine/open-in-carto/ 5 | CARTO_ONECLICK_LINK: 'http://oneclick.cartodb.com/' 6 | 7 | # Download path can be configured using this setting 8 | #DOWNLOAD_PATH: "./tmp/cache/downloads" 9 | 10 | # DEPRECATED Main Solr geometry field used for spatial search and bounding box. Should be type 'rpt' 11 | GEOMETRY_FIELD: 'solr_geom' 12 | 13 | #Solr field mappings 14 | FIELDS: 15 | :FILE_FORMAT: 'dc_format_s' 16 | :GEOMETRY: 'solr_geom' 17 | :WXS_IDENTIFIER: 'layer_id_s' 18 | :RIGHTS: 'dc_rights_s' 19 | :PROVENANCE: 'dct_provenance_s' 20 | :GEOM_TYPE: 'layer_geom_type_s' 21 | :SPATIAL_COVERAGE: 'dct_spatial_sm' 22 | :SUBJECT: 'dc_subject_sm' 23 | :REFERENCES: 'dct_references_s' 24 | :YEAR: 'solr_year_i' 25 | :CREATOR: 'dc_creator_sm' 26 | :DESCRIPTION: 'dc_description_s' 27 | :PUBLISHER: 'dc_publisher_s' 28 | :PART_OF: 'dct_isPartOf_sm' 29 | :TEMPORAL: 'dct_temporal_sm' 30 | :TITLE: 'dc_title_s' 31 | 32 | # Institution deployed at 33 | INSTITUTION: 'Stanford' 34 | 35 | # Metadata shown in tool panel 36 | METADATA_SHOWN: 37 | - 'fgdc' 38 | - 'iso19139' 39 | - 'mods' 40 | 41 | # (For external Download) timeout and open_timeout parameters for Faraday 42 | TIMEOUT_DOWNLOAD: 16 43 | 44 | # (For WMS inspection) timeout and open_timeout parameters for Faraday 45 | TIMEOUT_WMS: 4 46 | 47 | # Web services shown in tool panel 48 | WEBSERVICES_SHOWN: 49 | - 'wms' 50 | - 'wfs' 51 | - 'iiif' 52 | - 'feature_layer' 53 | - 'tiled_map_layer' 54 | - 'dynamic_map_layer' 55 | - 'image_map_layer' 56 | 57 | # WMS Parameters 58 | WMS_PARAMS: 59 | :SERVICE: 'WMS' 60 | :VERSION: '1.1.1' 61 | :REQUEST: 'GetFeatureInfo' 62 | :STYLES: '' 63 | :SRS: 'EPSG:4326' 64 | :EXCEPTIONS: 'application/json' 65 | :INFO_FORMAT: 'text/html' 66 | 67 | # Settings for leaflet 68 | OPACITY_CONTROL: &opacity_control 69 | CONTROLS: 70 | - 'Opacity' 71 | 72 | LEAFLET: 73 | MAP: 74 | LAYERS: 75 | DETECT_RETINA: true 76 | VIEWERS: 77 | WMS: 78 | <<: *opacity_control 79 | TILEDMAPLAYER: 80 | <<: *opacity_control 81 | FEATURELAYER: 82 | <<: *opacity_control 83 | DYNAMICMAPLAYER: 84 | <<: *opacity_control 85 | IMAGEMAPLAYER: 86 | <<: *opacity_control 87 | -------------------------------------------------------------------------------- /spec/features/admin_spec.rb: -------------------------------------------------------------------------------- 1 | require 'features_helper' 2 | 3 | describe 'admin' do 4 | fixtures :stash_engine_users, :stash_engine_resources, :stash_engine_identifiers, :stash_engine_resource_states, 5 | :stash_engine_versions, :stash_engine_authors, :dcs_descriptions, :dcs_affiliations_authors, :dcs_affiliations 6 | 7 | before(:each) do 8 | log_in! 9 | user = StashEngine::User.where(email: 'test@example.edu.test-google-a.com').first 10 | user.update(role: 'admin') 11 | end 12 | 13 | it 'has admin link' do 14 | visit('/') 15 | expect(page).to have_link('Admin') 16 | end 17 | 18 | it 'shows users for institution' do 19 | visit('/stash/admin') 20 | expect(page).to have_link('Leroy Jones') 21 | end 22 | 23 | it "shows a user's activity page" do 24 | visit('/stash/admin/user_dashboard/2') 25 | expect(page).to have_text("Leroy Jones's Activity") 26 | expect(page).to have_link('Evaluating Linked Lists') 27 | end 28 | 29 | it "shows a user's version history for a dataset" do 30 | visit('/stash/edit_histories?resource_id=5') 31 | expect(page).to have_text('2 (in progress)') 32 | end 33 | 34 | it 'allows editing a dataset' do 35 | visit('/stash/admin/user_dashboard/1') 36 | expect(page).to have_css('button.c-admin-edit-icon') 37 | first('button.c-admin-edit-icon').click 38 | 39 | wait_for_ajax! 40 | expect(page).to have_text("You are editing Mary McCormick's dataset.") 41 | 42 | click_link('Review and Submit') 43 | wait_for_ajax! 44 | expect(page).to have_css('input#user_comment') 45 | end 46 | 47 | describe 'superuser' do 48 | 49 | before(:each) do 50 | user = StashEngine::User.where(email: 'test@example.edu.test-google-a.com').first 51 | user.update(role: 'superuser') 52 | user.reload 53 | end 54 | 55 | it 'allows changing user role as a superuser' do 56 | visit('/stash/admin') 57 | wait_for_ajax! 58 | 59 | expect(page).to have_link('Leroy Jones') 60 | first('button.c-admin-edit-icon').click 61 | wait_for_ajax! 62 | 63 | expect(page).to have_css('input#role_admin') 64 | first('input#role_admin').click 65 | within(:css, 'div.o-admin-dialog') do 66 | find('input[name=commit]').click 67 | end 68 | wait_for_ajax! 69 | 70 | expect(page.find('#user_role_2')).to have_text('Admin') 71 | end 72 | end 73 | 74 | end 75 | -------------------------------------------------------------------------------- /config/deploy/production.rb: -------------------------------------------------------------------------------- 1 | # server-based syntax 2 | # ====================== 3 | # Defines a single server with a list of roles and multiple properties. 4 | # You can define all roles on a single server, or split them: 5 | 6 | # server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value 7 | # server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value 8 | # server 'db.example.com', user: 'deploy', roles: %w{db} 9 | 10 | set :rails_env, 'production' 11 | 12 | set :server_host, ENV["SERVER_HOST"] || 'uc3-dash2-prd.cdlib.org' 13 | server fetch(:server_host), user: 'dash2', roles: %w{web app db} 14 | 15 | # role-based syntax 16 | # ================== 17 | 18 | # Defines a role with one or multiple servers. The primary server in each 19 | # group is considered to be the first unless any hosts have the primary 20 | # property set. Specify the username and a domain or IP for the server. 21 | # Don't use `:all`, it's a meta role. 22 | 23 | # role :app, %w{deploy@example.com}, my_property: :my_value 24 | # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value 25 | # role :db, %w{deploy@example.com} 26 | 27 | 28 | 29 | # Configuration 30 | # ============= 31 | # You can set any configuration variable like in config/deploy.rb 32 | # These variables are then only loaded and set in this stage. 33 | # For available Capistrano configuration variables see the documentation page. 34 | # http://capistranorb.com/documentation/getting-started/configuration/ 35 | # Feel free to add new variables to customise your setup. 36 | 37 | 38 | 39 | # Custom SSH Options 40 | # ================== 41 | # You may pass any option but keep in mind that net/ssh understands a 42 | # limited set of options, consult the Net::SSH documentation. 43 | # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start 44 | # 45 | # Global options 46 | # -------------- 47 | # set :ssh_options, { 48 | # keys: %w(/home/rlisowski/.ssh/id_rsa), 49 | # forward_agent: false, 50 | # auth_methods: %w(password) 51 | # } 52 | # 53 | # The server-based syntax can be used to override options: 54 | # ------------------------------------ 55 | # server 'example.com', 56 | # user: 'user_name', 57 | # roles: %w{web app}, 58 | # ssh_options: { 59 | # user: 'user_name', # overrides user setting above 60 | # keys: %w(/home/user_name/.ssh/id_rsa), 61 | # forward_agent: false, 62 | # auth_methods: %w(publickey password) 63 | # # password: 'please use keys' 64 | # } 65 | -------------------------------------------------------------------------------- /spec/solr_helper.rb: -------------------------------------------------------------------------------- 1 | require 'solr_wrapper' 2 | require 'colorize' 3 | require 'uri' 4 | 5 | # TODO: figure out how to move some of this to stash_discovery 6 | module SolrHelper 7 | SOLR_VERSION = '5.2.1'.freeze 8 | CONF_DIR = 'spec/config/solr/conf'.freeze 9 | BLACKLIGHT_YML = 'config/blacklight.yml'.freeze 10 | COLLECTION_NAME = 'geoblacklight'.freeze 11 | 12 | class << self 13 | 14 | def start 15 | return if solr_instance 16 | self.solr_instance = start_new_instance 17 | self.collection = create_collection 18 | rescue StandardError => ex 19 | warn(ex) 20 | stop 21 | raise 22 | end 23 | 24 | def stop 25 | return unless solr_instance 26 | begin 27 | info "Deleting collection #{collection}" if collection 28 | solr_instance.delete(collection) if collection 29 | self.collection = nil 30 | ensure 31 | info 'Stopping Solr' 32 | solr_instance.stop 33 | self.solr_instance = nil 34 | end 35 | end 36 | 37 | private 38 | 39 | attr_accessor :solr_instance 40 | attr_accessor :collection 41 | 42 | def solr_env 43 | # For macOS local development, run Solr under Java 8 even if Java 9 is the default 44 | @solr_env ||= begin 45 | return ENV unless ENV['JAVA_HOME'] 46 | return ENV unless ENV['JAVA_HOME'].include?('jdk-9') 47 | mac_jdk8_home ||= `[[ -f /usr/libexec/java_home && -x /usr/libexec/java_home ]] && /usr/libexec/java_home -v 1.8`.strip! 48 | return ENV unless mac_jdk8_home 49 | ENV.to_h.merge!('JAVA_HOME' => mac_jdk8_home) 50 | end 51 | end 52 | 53 | def create_collection 54 | info "Creating collection #{COLLECTION_NAME} from configuration #{CONF_DIR}" 55 | new_collection = solr_instance.create(dir: CONF_DIR, name: COLLECTION_NAME) 56 | info 'Collection created' 57 | new_collection 58 | end 59 | 60 | def start_new_instance 61 | info "Starting Solr #{SOLR_VERSION} on port #{port} with JAVA_HOME=#{solr_env['JAVA_HOME']}" 62 | instance = SolrWrapper.instance(verbose: true, port: port, version: SOLR_VERSION, env: solr_env) 63 | instance.start 64 | info 'Solr started' 65 | instance 66 | end 67 | 68 | def port 69 | config[:port] 70 | end 71 | 72 | def config 73 | @config ||= begin 74 | blacklight_config = YAML.safe_load(File.read(BLACKLIGHT_YML))['test'] 75 | solr_uri = URI.parse(blacklight_config['url']) 76 | { 77 | port: solr_uri.port, 78 | collection: solr_uri.path.split('/').last 79 | } 80 | end 81 | end 82 | 83 | def info(msg) 84 | puts msg.to_s.colorize(:blue) 85 | end 86 | 87 | def warn(msg) 88 | puts msg.to_s.colorize(:red) 89 | end 90 | end 91 | end 92 | -------------------------------------------------------------------------------- /documentation/how_to_contribute.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | The Dryad (formerly Dash) software provides a platform for depositing and managing data, working with descriptive metadata and additional services such as scholarly identifier registration or usage and citation tracking. 4 | 5 | These guidelines are an attempt to ensure that we are able to provide a reliable system, stable APIs and clear communication. 6 | 7 | 8 | ## Pull request methodology 9 | We are using the "fork and pull model" for developing Dryad. [https://help.github.com/articles/about-collaborative-development-models/](https://help.github.com/articles/about-collaborative-development-models/) 10 | 11 | The basic flow of this model would be to: 12 | 13 | - Fork repo to your account or somewhere else. 14 | - Clone your own copy of the repo to a machine to do work on. 15 | - add upstream for repo if needed and use it to get upstream changes in the future. 16 | 17 | ``` 18 | # for example 19 | git remote add upstream https://github.com/CDLUC3/dashv2.git 20 | git fetch upstream 21 | git merge upstream/master 22 | ``` 23 | 24 | - Make all needed changes and push them to your fork. 25 | - Create pull request from your fork to get them incorporated back into the main upstream repository. 26 | 27 | (Please add feedback about this process since I may have missed details.) 28 | 29 | # Testing 30 | When creating pull requests travis.ci will run tests (TODO: which seem to break now and we need to fix), but you can generally run quick tests locally for just the areas you've changed and they'll run quickly if you don't want to wait around for Travis.ci or want to run them more iteratively to correct problems. 31 | 32 | TODO: there are some areas where tests need to be added (mostly our initial version of an API), so we need to schedule work time for these tasks before long. 33 | 34 | # Code review 35 | - Tag another user to review your pull request. 36 | - Changes at the model unit test level or UI level ("feature" level) should have rspec tests. In some cases, you may need to use test doubles, aka "mocks" to simulate external services or items with complicated dependencies. 37 | 38 | ## Pull request checklists 39 | 40 | Changes to database schemas or model classes 41 | 42 | - Did you add or update any unit tests? 43 | - Did you include any database migration? 44 | - If you needed to transform data, did you include the changes in the migration (you may need to drop to raw SQL) or create a rake task? 45 | - Did you also include the automatic updates to schema.rb when you committed? 46 | 47 | Changes to views 48 | 49 | - Did you add major UI changes such as new layouts, css styles or images to the [UI library](https://github.com/CDLUC3/stash/tree/master/stash_engine/ui-library) ? 50 | - Are feature tests (browser automation) added or modified in order to test the change? 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /config/deploy/demo.rb: -------------------------------------------------------------------------------- 1 | # server-based syntax 2 | # ====================== 3 | # Defines a single server with a list of roles and multiple properties. 4 | # You can define all roles on a single server, or split them: 5 | 6 | # server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value 7 | # server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value 8 | # server 'db.example.com', user: 'deploy', roles: %w{db} 9 | 10 | set :rails_env, 'demo' 11 | 12 | #set :bundle_env_variables, { 'RAILS_ENV' => 'demo' } 13 | 14 | # To override the default host, set $SERVER_HOST, e.g. 15 | # $ SERVER_HOST='localhost' bundle exec cap development deploy 16 | set :server_host, ENV["SERVER_HOST"] || 'uc3-dashdemo-stg.cdlib.org' 17 | server fetch(:server_host), user: 'dash2', roles: %w{web app db} 18 | 19 | #on roles(:all) do |host| 20 | # puts "setting server host: #{host.hostname}" 21 | #end 22 | 23 | #set :passenger_pid, "#{deploy_to}/passenger.pid" 24 | #set :passenger_log, "#{deploy_to}/passenger.log" 25 | #set :passenger_port, "3000" 26 | 27 | # role-based syntax 28 | # ================== 29 | 30 | # Defines a role with one or multiple servers. The primary server in each 31 | # group is considered to be the first unless any hosts have the primary 32 | # property set. Specify the username and a domain or IP for the server. 33 | # Don't use `:all`, it's a meta role. 34 | 35 | # role :app, %w{deploy@example.com}, my_property: :my_value 36 | # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value 37 | # role :db, %w{deploy@example.com} 38 | 39 | 40 | 41 | # Configuration 42 | # ============= 43 | # You can set any configuration variable like in config/deploy.rb 44 | # These variables are then only loaded and set in this stage. 45 | # For available Capistrano configuration variables see the documentation page. 46 | # http://capistranorb.com/documentation/getting-started/configuration/ 47 | # Feel free to add new variables to customise your setup. 48 | 49 | 50 | 51 | # Custom SSH Options 52 | # ================== 53 | # You may pass any option but keep in mind that net/ssh understands a 54 | # limited set of options, consult the Net::SSH documentation. 55 | # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start 56 | # 57 | # Global options 58 | # -------------- 59 | # set :ssh_options, { 60 | # keys: %w(/home/rlisowski/.ssh/id_rsa), 61 | # forward_agent: false, 62 | # auth_methods: %w(password) 63 | # } 64 | # 65 | # The server-based syntax can be used to override options: 66 | # ------------------------------------ 67 | # server 'example.com', 68 | # user: 'user_name', 69 | # roles: %w{web app}, 70 | # ssh_options: { 71 | # user: 'user_name', # overrides user setting above 72 | # keys: %w(/home/user_name/.ssh/id_rsa), 73 | # forward_agent: false, 74 | # auth_methods: %w(publickey password) 75 | # # password: 'please use keys' 76 | # } -------------------------------------------------------------------------------- /config/deploy/stage.rb: -------------------------------------------------------------------------------- 1 | # server-based syntax 2 | # ====================== 3 | # Defines a single server with a list of roles and multiple properties. 4 | # You can define all roles on a single server, or split them: 5 | 6 | # server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value 7 | # server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value 8 | # server 'db.example.com', user: 'deploy', roles: %w{db} 9 | 10 | set :rails_env, 'stage' 11 | 12 | #set :bundle_env_variables, { 'RAILS_ENV' => 'stage' } 13 | 14 | # To override the default host, set $SERVER_HOST, e.g. 15 | # $ SERVER_HOST='localhost' bundle exec cap development deploy 16 | set :server_host, ENV["SERVER_HOST"] || 'uc3-dash2-stg.cdlib.org' 17 | server fetch(:server_host), user: 'dash2', roles: %w{web app db} 18 | 19 | #on roles(:all) do |host| 20 | # puts "setting server host: #{host.hostname}" 21 | #end 22 | 23 | #set :passenger_pid, "#{deploy_to}/passenger.pid" 24 | #set :passenger_log, "#{deploy_to}/passenger.log" 25 | #set :passenger_port, "3000" 26 | 27 | # role-based syntax 28 | # ================== 29 | 30 | # Defines a role with one or multiple servers. The primary server in each 31 | # group is considered to be the first unless any hosts have the primary 32 | # property set. Specify the username and a domain or IP for the server. 33 | # Don't use `:all`, it's a meta role. 34 | 35 | # role :app, %w{deploy@example.com}, my_property: :my_value 36 | # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value 37 | # role :db, %w{deploy@example.com} 38 | 39 | 40 | 41 | # Configuration 42 | # ============= 43 | # You can set any configuration variable like in config/deploy.rb 44 | # These variables are then only loaded and set in this stage. 45 | # For available Capistrano configuration variables see the documentation page. 46 | # http://capistranorb.com/documentation/getting-started/configuration/ 47 | # Feel free to add new variables to customise your setup. 48 | 49 | 50 | 51 | # Custom SSH Options 52 | # ================== 53 | # You may pass any option but keep in mind that net/ssh understands a 54 | # limited set of options, consult the Net::SSH documentation. 55 | # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start 56 | # 57 | # Global options 58 | # -------------- 59 | # set :ssh_options, { 60 | # keys: %w(/home/rlisowski/.ssh/id_rsa), 61 | # forward_agent: false, 62 | # auth_methods: %w(password) 63 | # } 64 | # 65 | # The server-based syntax can be used to override options: 66 | # ------------------------------------ 67 | # server 'example.com', 68 | # user: 'user_name', 69 | # roles: %w{web app}, 70 | # ssh_options: { 71 | # user: 'user_name', # overrides user setting above 72 | # keys: %w(/home/user_name/.ssh/id_rsa), 73 | # forward_agent: false, 74 | # auth_methods: %w(publickey password) 75 | # # password: 'please use keys' 76 | # } -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_resources.yml: -------------------------------------------------------------------------------- 1 | resource1: 2 | id: 1 3 | user_id: 1 4 | current_resource_state_id: 1 5 | created_at: 2017-08-24 21:00:44.000000000 Z 6 | updated_at: 2017-08-24 21:06:42.000000000 Z 7 | has_geolocation: 1 8 | download_uri: http://merritt-dev.cdlib.org/d/ark%3A%2Fb5072%2Ffk2ww7f97z 9 | identifier_id: 1 10 | update_uri: http://sword-aws-dev.cdlib.org:39001/mrtsword/edit/dash_ucb/doi%3A10.5072%2FFK2WW7F97Z 11 | title: Deconstructing the Lookaside Buffer 12 | current_editor_id: 1 13 | publication_date: 2017-08-24 21:06:21.000000000 Z 14 | tenant_id: localhost 15 | 16 | resource2: 17 | id: 2 18 | user_id: 1 19 | current_resource_state_id: 2 20 | created_at: 2017-08-24 21:10:18.000000000 Z 21 | updated_at: 2017-08-24 21:11:20.000000000 Z 22 | has_geolocation: 1 23 | download_uri: http://merritt-dev.cdlib.org/d/ark%3A%2Fb5072%2Ffk2ww7f97z 24 | identifier_id: 1 25 | update_uri: http://sword-aws-dev.cdlib.org:39001/mrtsword/edit/dash_ucb/doi%3A10.5072%2FFK2WW7F97Z 26 | title: Deconstructing the Lookaside Buffer 27 | current_editor_id: 1 28 | publication_date: 2017-08-24 21:06:21.000000000 Z 29 | tenant_id: localhost 30 | 31 | resource3: 32 | id: 3 33 | user_id: 1 34 | current_resource_state_id: 3 35 | created_at: 2017-08-24 21:12:10.000000000 Z 36 | updated_at: 2017-08-24 21:13:53.000000000 Z 37 | has_geolocation: 0 38 | download_uri: http://merritt-dev.cdlib.org/d/ark%3A%2Fb5072%2Ffk2s46qh43 39 | identifier_id: 2 40 | update_uri: http://sword-aws-dev.cdlib.org:39001/mrtsword/edit/dash_ucb/doi%3A10.5072%2FFK2S46QH43 41 | title: Decoupling the Producer-Consumer Problem from Byzantine Fault Tolerance in 42 | Digital-to-Analog Converters 43 | current_editor_id: 1 44 | publication_date: 2017-08-24 21:13:40.000000000 Z 45 | tenant_id: localhost 46 | 47 | resource4: 48 | id: 4 49 | user_id: 2 50 | current_resource_state_id: 4 51 | created_at: 2017-08-24 21:15:49.000000000 Z 52 | updated_at: 2017-08-24 21:23:22.000000000 Z 53 | has_geolocation: 0 54 | download_uri: http://merritt-dev.cdlib.org/d/ark%3A%2Fb5072%2Ffk2nc60q0s 55 | identifier_id: 3 56 | update_uri: http://sword-aws-dev.cdlib.org:39001/mrtsword/edit/dash_cdl/doi%3A10.5072%2FFK2NC60Q0S 57 | title: Evaluating Linked Lists and Web Services 58 | current_editor_id: 2 59 | publication_date: 2017-08-24 21:18:30.000000000 Z 60 | tenant_id: localhost 61 | 62 | resource5: 63 | id: 5 64 | user_id: 2 65 | current_resource_state_id: 5 66 | created_at: 2017-08-24 21:29:13.000000000 Z 67 | updated_at: 2017-08-24 21:29:13.000000000 Z 68 | has_geolocation: 0 69 | download_uri: http://merritt-dev.cdlib.org/d/ark%3A%2Fb5072%2Ffk2nc60q0s 70 | identifier_id: 3 71 | update_uri: http://sword-aws-dev.cdlib.org:39001/mrtsword/edit/dash_cdl/doi%3A10.5072%2FFK2NC60Q0S 72 | title: Evaluating Linked Lists and Web Services 73 | current_editor_id: 2 74 | publication_date: 2017-08-24 21:18:30.000000000 Z 75 | tenant_id: localhost 76 | -------------------------------------------------------------------------------- /spec/fixtures/stash_engine_file_uploads.yml: -------------------------------------------------------------------------------- 1 | raw_attributes: 2 | id: 1 3 | upload_file_name: 65f897b9-9d7d-4480-adb0-6e124f002c75.jpg 4 | upload_content_type: image/jpeg 5 | upload_file_size: 505168 6 | resource_id: 1 7 | upload_updated_at: &4 2017-08-24 21:05:13.000000000 Z 8 | created_at: &5 2017-08-24 21:05:13.000000000 Z 9 | updated_at: &6 2017-08-24 21:05:13.000000000 Z 10 | temp_file_path: "/Users/scottfisher/workspace/dashv2/uploads/1/65f897b9-9d7d-4480-adb0-6e124f002c75.jpg" 11 | file_state: created 12 | url: 13 | status_code: 14 | timed_out: 0 15 | original_url: 16 | cloud_service: 17 | 18 | id: 2 19 | upload_file_name: 65f897b9-9d7d-4480-adb0-6e124f002c75.jpg 20 | upload_content_type: image/jpeg 21 | upload_file_size: 505168 22 | resource_id: 2 23 | upload_updated_at: &4 2017-08-24 21:05:13.000000000 Z 24 | created_at: &5 2017-08-24 21:10:18.000000000 Z 25 | updated_at: &6 2017-08-24 21:10:18.000000000 Z 26 | temp_file_path: "/Users/scottfisher/workspace/dashv2/uploads/1/65f897b9-9d7d-4480-adb0-6e124f002c75.jpg" 27 | file_state: copied 28 | url: 29 | status_code: 30 | timed_out: 0 31 | original_url: 32 | cloud_service: 33 | 34 | id: 3 35 | upload_file_name: admin_editing1.jpg 36 | upload_content_type: image/jpeg 37 | upload_file_size: 111067 38 | resource_id: 2 39 | upload_updated_at: &4 2017-08-24 21:11:06.000000000 Z 40 | created_at: &5 2017-08-24 21:11:06.000000000 Z 41 | updated_at: &6 2017-08-24 21:11:06.000000000 Z 42 | temp_file_path: "/Users/scottfisher/workspace/dashv2/uploads/2/admin_editing1.jpg" 43 | file_state: created 44 | url: 45 | status_code: 46 | timed_out: 0 47 | original_url: 48 | cloud_service: 49 | 50 | id: 4 51 | upload_file_name: admin_editing2.jpg 52 | upload_content_type: image/jpeg 53 | upload_file_size: 185621 54 | resource_id: 3 55 | upload_updated_at: &4 2017-08-24 21:13:33.000000000 Z 56 | created_at: &5 2017-08-24 21:13:33.000000000 Z 57 | updated_at: &6 2017-08-24 21:13:33.000000000 Z 58 | temp_file_path: "/Users/scottfisher/workspace/dashv2/uploads/3/admin_editing2.jpg" 59 | file_state: created 60 | url: 61 | status_code: 62 | timed_out: 0 63 | original_url: 64 | cloud_service: 65 | 66 | id: 9 67 | upload_file_name: stash-harvester-annotated-erd.pdf 68 | upload_content_type: application/pdf 69 | upload_file_size: 177988 70 | resource_id: 4 71 | upload_updated_at: &4 2017-08-24 21:23:02.000000000 Z 72 | created_at: &5 2017-08-24 21:23:02.000000000 Z 73 | updated_at: &6 2017-08-24 21:23:02.000000000 Z 74 | temp_file_path: "/Users/scottfisher/workspace/dashv2/uploads/4/stash-harvester-annotated-erd.pdf" 75 | file_state: created 76 | url: 77 | status_code: 78 | timed_out: 0 79 | original_url: 80 | cloud_service: 81 | 82 | id: 10 83 | upload_file_name: stash-harvester-annotated-erd.pdf 84 | upload_content_type: application/pdf 85 | upload_file_size: 177988 86 | resource_id: 5 87 | upload_updated_at: &4 2017-08-24 21:23:02.000000000 Z 88 | created_at: &5 2017-08-24 21:29:13.000000000 Z 89 | updated_at: &6 2017-08-24 21:29:13.000000000 Z 90 | temp_file_path: "/Users/scottfisher/workspace/dashv2/uploads/4/stash-harvester-annotated-erd.pdf" 91 | file_state: copied 92 | url: 93 | status_code: 94 | timed_out: 0 95 | original_url: 96 | cloud_service: 97 | -------------------------------------------------------------------------------- /spec/features/add_geolocation_spec.rb: -------------------------------------------------------------------------------- 1 | require 'features_helper' 2 | require 'pry' 3 | 4 | describe 'add geolocation' do 5 | 6 | before(:each) do 7 | start_new_dataset! 8 | location_divider = find('summary', text: 'Location Information (optional)') 9 | location_divider.click 10 | wait_for_ajax! 11 | end 12 | 13 | describe 'points' do 14 | it 'adds by lat/long' do 15 | latitude = '37.8086' 16 | longitude = '-122.2674' 17 | 18 | point_latitude = find_blank_field_id('geolocation_point[latitude]') 19 | fill_in point_latitude, with: latitude 20 | 21 | point_longitude = find_blank_field_id('geolocation_point[longitude]') 22 | fill_in point_longitude, with: longitude 23 | 24 | add_geo_point_button = first(:link_or_button, 'add_geo_point') 25 | add_geo_point_button.click 26 | 27 | wait_for_ajax! 28 | 29 | locations = page.find('div .c-locations') 30 | expect(locations).to have_content(/#{latitude},\s+#{longitude}/) 31 | 32 | new_point = StashDatacite::GeolocationPoint.from_resource_id(current_resource_id).first 33 | expect(new_point).not_to be_nil 34 | expect(new_point.latitude).to eq(latitude.to_f) 35 | expect(new_point.longitude).to eq(longitude.to_f) 36 | end 37 | end 38 | 39 | describe 'boxes' do 40 | it 'adds by lat/long' do 41 | bbox_button = first(:link_or_button, 'Bounding Box') 42 | bbox_button.click 43 | 44 | s_latitude = '37.8086' 45 | w_longitude = '-122.3511' 46 | 47 | n_latitude = '47.6572' 48 | e_longitude = '-122.2674' 49 | 50 | sw_latitude = find_blank_field_id('geolocation_box[sw_latitude]') 51 | fill_in sw_latitude, with: s_latitude 52 | 53 | sw_longitude = find_blank_field_id('geolocation_box[sw_longitude]') 54 | fill_in sw_longitude, with: w_longitude 55 | 56 | ne_latitude = find_blank_field_id('geolocation_box[ne_latitude]') 57 | fill_in ne_latitude, with: n_latitude 58 | 59 | ne_longitude = find_blank_field_id('geolocation_box[ne_longitude]') 60 | fill_in ne_longitude, with: e_longitude 61 | 62 | add_geo_box_button = first(:link_or_button, 'add_geo_box') 63 | add_geo_box_button.click 64 | 65 | wait_for_ajax! 66 | 67 | locations = page.find('div .c-locations') 68 | expect(locations).to have_content(/SW\s+#{s_latitude},\s+#{w_longitude}/) 69 | expect(locations).to have_content(/NE\s+#{n_latitude},\s+#{e_longitude}/) 70 | 71 | new_box = StashDatacite::GeolocationBox.from_resource_id(current_resource_id).first 72 | expect(new_box).not_to be_nil 73 | expect(new_box.sw_latitude).to eq(s_latitude.to_f) 74 | expect(new_box.sw_longitude).to eq(w_longitude.to_f) 75 | expect(new_box.ne_latitude).to eq(n_latitude.to_f) 76 | expect(new_box.ne_longitude).to eq(e_longitude.to_f) 77 | end 78 | end 79 | 80 | describe 'google_geocoding' do 81 | xit 'adds a place by name' do 82 | item = find('div.leaflet-control-geosearch input.glass') 83 | item.set("Oakland, CA, USA\n") 84 | wait_for_ajax! 85 | # this triggers the leaflet map move and display but the 'geosearch/showlocation' event doesn't always trigger by geosearch library 86 | # binding.pry 87 | expect(find('div.geolocation_places').has_content?('Oakland, CA, USA')).to eq(true) 88 | end 89 | end 90 | end 91 | -------------------------------------------------------------------------------- /app/views/tenants/ucd/_dda.html.erb: -------------------------------------------------------------------------------- 1 |

Data Deposit Agreement

2 | 3 |

4 | UC Davis Library is pleased to provide use of the UC Davis instance of 5 | the Dash data repository (Dash), maintained by 6 | California Digital Library (CDL), as a free service for UC Davis users. 7 |

8 | 9 |

By accepting the data deposit agreement, you acknowledge and agree that:

10 | 11 |
    12 |
  1. 13 | This platform is intended for use only by UC Davis faculty, graduate students, postdocs, and professional 14 | researchers. Any deposits resulting from unauthorized use will be removed. If you do not hold an affiliation named 15 | above, but you believe you should have access to Dash based on your research contributions and needs, 16 | contact the Data Management Program. Permissions will be granted on a case-by-case basis. 17 |
  2. 18 | 19 |
  3. 20 | Any data you deposit will not contain any unlawful, private, confidential, or sensitive information. 21 |
  4. 22 | 23 |
  5. 24 | Any data you deposit will be comprised of your original work, public domain data, or data for which you have the 25 | necessary rights or permissions to deposit consistent with the terms of this agreement. 26 |
  6. 27 | 28 |
  7. 29 | UC Davis Library and CDL will have access to all content for the purposes of maintaining the system, creating backup 30 | copies, and publicly sharing the data. You grant data curators at the UC Davis Library and CDL the right to review 31 | and enhance the metadata of submitted datasets. 32 |
  8. 33 | 34 |
  9. 35 | In compliance with best practices in open data, all data deposited in the UC Davis Dash instance will be released 36 | under a CC0 public domain dedication. 37 | You may defer the release of deposited data for up to six months at the time 38 | of submission. At the end of six months, the data will be released under a CC0 dedication unless you actively 39 | request and justify a deferment. 40 |
  10. 41 | 42 |
  11. 43 | The total space allocation per UC Davis user is 200 GB. If you foresee the need to exceed this size, please contact 44 | the UC Davis Library at dataserv@ucdavis.edu. 45 |
  12. 46 | 47 |
  13. 48 | Access to the datasets through this repository is intended to last until at least 2027. In the event a decision is 49 | made to discontinue the use of Dash, CDL will transfer the existing data to an alternative repository or otherwise 50 | return them to the submitting party. 51 |
  14. 52 | 53 |
  15. 54 | Published datasets may not be removed by individual users. Data withdrawal requests and justifications should be 55 | directed to CDL. 56 |
  16. 57 | 58 |
  17. 59 | UC Davis Library and CDL retain the right to remove any material deemed, in their discretion, inappropriate or out 60 | of the scope of this repository. 61 |
  18. 62 | 63 |
  19. 64 | You agree to the terms of the CDL Terms of Use and Privacy Policy, 65 | and all applicable UC Davis Library Policies and Procedures. 66 |
  20. 67 |
68 | 69 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | 3 | use_doorkeeper 4 | # The priority is based upon order of creation: first created -> highest priority. 5 | # See how all your routes lay out with "rake routes". 6 | 7 | root :requirements => { :protocol => 'http' }, :to => redirect(path: APP_CONFIG.stash_mount ) 8 | 9 | #root :requirements => { :protocol => 'https' }, 10 | # :to => redirect(path: APP_CONFIG.stash_mount, protocol: 'https' ) 11 | 12 | #get '/', :requirements => { :protocol => 'http' }, to: redirect(path: APP_CONFIG.stash_mount, protocol: 'http' ) 13 | 14 | #get '/', :requirements => { :protocol => 'https' }, to: redirect(path: APP_CONFIG.stash_mount, protocol: 'https' ) 15 | # constraints: { protocol: 'https' } 16 | 17 | # You can have the root of your site routed with "root" 18 | #root 'host_pages#index' 19 | # map.redirect '/', controller: '/stash/pages', action: 'home' 20 | #match '/auth/:provider/callback', to: 'host_pages#test', via: [:get, :post] 21 | 22 | # Example of regular route: 23 | # get 'products/:id' => 'catalog#view' 24 | 25 | # Example of named route that can be invoked with purchase_url(id: product.id) 26 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 27 | 28 | # Example resource route (maps HTTP verbs to controller actions automatically): 29 | # resources :products 30 | 31 | # Example resource route with options: 32 | # resources :products do 33 | # member do 34 | # get 'short' 35 | # post 'toggle' 36 | # end 37 | # 38 | # collection do 39 | # get 'sold' 40 | # end 41 | # end 42 | 43 | # Example resource route with sub-resources: 44 | # resources :products do 45 | # resources :comments, :sales 46 | # resource :seller 47 | # end 48 | 49 | # Example resource route with more complex sub-resources: 50 | # resources :products do 51 | # resources :comments 52 | # resources :sales do 53 | # get 'recent', on: :collection 54 | # end 55 | # end 56 | 57 | # Example resource route with concerns: 58 | # concern :toggleable do 59 | # post 'toggle' 60 | # end 61 | # resources :posts, concerns: :toggleable 62 | # resources :photos, concerns: :toggleable 63 | 64 | # Example resource route within a namespace: 65 | # namespace :admin do 66 | # # Directs /admin/products/* to Admin::ProductsController 67 | # # (app/controllers/admin/products_controller.rb) 68 | # resources :products 69 | # end 70 | 71 | # this is a rack way of showing a 404 for some crazy old/speculative link that Google has stuck in its craw 72 | get '/search/facet/dc_creator_sm', to: proc { [410, {}, ['']] } 73 | 74 | mount StashEngine::Engine, at: APP_CONFIG.stash_mount 75 | mount StashDatacite::Engine, at: '/stash_datacite' 76 | mount StashApi::Engine, at: '/api' 77 | 78 | # we have to do this to make the geoblacklight routes come before catchall 79 | # http://blog.arkency.com/2015/02/how-to-split-routes-dot-rb-into-smaller-parts/ 80 | #instance_eval(File.read(StashDiscovery::Engine.root.join("config/routes.rb"))) 81 | 82 | # get 'xtf/search', to: 'catalog#index' 83 | 84 | get 'xtf/search', :to => redirect { |params, request| "/search?#{request.params.to_query}" } 85 | 86 | # this will route an item at the root of the site into the namespaced engine 87 | get 'sitemap.xml' => "stash_engine/pages#sitemap", :format => "xml", :as => 'sitemap' 88 | 89 | end 90 | -------------------------------------------------------------------------------- /config/deploy/development.rb: -------------------------------------------------------------------------------- 1 | # server-based syntax 2 | # ====================== 3 | # Defines a single server with a list of roles and multiple properties. 4 | # You can define all roles on a single server, or split them: 5 | 6 | # server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value 7 | # server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value 8 | # server 'db.example.com', user: 'deploy', roles: %w{db} 9 | 10 | set :rails_env, "development" 11 | 12 | # To override the default host, set $SERVER_HOST, e.g. 13 | # $ SERVER_HOST='localhost' bundle exec cap development deploy 14 | set :server_host, ENV["SERVER_HOST"] || 'uc3-dash2-dev.cdlib.org' 15 | server fetch(:server_host), user: 'dash2', roles: %w{web app db} 16 | 17 | #on roles(:all) do |host| 18 | # puts "setting server host: #{host.hostname}" 19 | #end 20 | 21 | #set :passenger_pid, "#{deploy_to}/passenger.pid" 22 | #set :passenger_log, "#{deploy_to}/passenger.log" 23 | #set :passenger_port, "3000" 24 | 25 | 26 | # role-based syntax 27 | # ================== 28 | 29 | # Defines a role with one or multiple servers. The primary server in each 30 | # group is considered to be the first unless any hosts have the primary 31 | # property set. Specify the username and a domain or IP for the server. 32 | # Don't use `:all`, it's a meta role. 33 | 34 | # role :app, %w{deploy@example.com}, my_property: :my_value 35 | # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value 36 | # role :db, %w{deploy@example.com} 37 | 38 | 39 | 40 | # Configuration 41 | # ============= 42 | # You can set any configuration variable like in config/deploy.rb 43 | # These variables are then only loaded and set in this stage. 44 | # For available Capistrano configuration variables see the documentation page. 45 | # http://capistranorb.com/documentation/getting-started/configuration/ 46 | # Feel free to add new variables to customise your setup. 47 | 48 | 49 | 50 | # Custom SSH Options 51 | # ================== 52 | # You may pass any option but keep in mind that net/ssh understands a 53 | # limited set of options, consult the Net::SSH documentation. 54 | # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start 55 | # 56 | # Global options 57 | # -------------- 58 | # set :ssh_options, { 59 | # keys: %w(/home/rlisowski/.ssh/id_rsa), 60 | # forward_agent: false, 61 | # auth_methods: %w(password) 62 | # } 63 | # 64 | # The server-based syntax can be used to override options: 65 | # ------------------------------------ 66 | # server 'example.com', 67 | # user: 'user_name', 68 | # roles: %w{web app}, 69 | # ssh_options: { 70 | # user: 'user_name', # overrides user setting above 71 | # keys: %w(/home/user_name/.ssh/id_rsa), 72 | # forward_agent: false, 73 | # auth_methods: %w(publickey password) 74 | # # password: 'please use keys' 75 | # } 76 | 77 | namespace :deploy do 78 | 79 | #desc 'update local engines to get around requiring version number changes in development' 80 | #task :update_local_engines do 81 | # on roles(:app) do 82 | # my_branch = capture("cat #{deploy_to}/current/branch_info") 83 | # 84 | # %w(stash_datacite stash_engine stash_discovery).each do |engine| 85 | # execute "cd #{deploy_to}/#{engine}; git checkout #{my_branch}; git reset --hard origin/#{my_branch}; git pull" 86 | # end 87 | 88 | # execute "cd #{deploy_to}/stash_datacite; git checkout #{my_branch}; git reset --hard origin/#{my_branch}; git pull" 89 | # execute "cd #{deploy_to}/stash_engine; git checkout #{my_branch}; git reset --hard origin/#{my_branch}; git pull" 90 | # end 91 | #end 92 | 93 | #after :published, :update_local_engines 94 | end 95 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ###################################################### 2 | # Miscellaneous 3 | 4 | # symlinked config files 5 | /config/*.yml 6 | /config/tenants/*.yml 7 | .config-secret/ 8 | 9 | # MacOS noise 10 | .DS_Store 11 | 12 | # JetBrains noise 13 | .idea 14 | .raketasks 15 | *.iml 16 | 17 | # Temporary files 18 | public/assets/ 19 | public/uploads/ 20 | uploads/ 21 | test-reports/ 22 | 23 | # ###################################################### 24 | 25 | #### joe made this: http://goel.io/joe 26 | 27 | #####=== Ruby ===##### 28 | 29 | *.gem 30 | *.rbc 31 | /.config 32 | /coverage/ 33 | /InstalledFiles 34 | /pkg/ 35 | /spec/reports/ 36 | /spec/examples.txt 37 | /test/tmp/ 38 | /test/version_tmp/ 39 | /tmp/ 40 | 41 | # Used by dotenv library to load environment variables. 42 | # .env 43 | 44 | ## Specific to RubyMotion: 45 | .dat* 46 | .repl_history 47 | build/ 48 | *.bridgesupport 49 | build-iPhoneOS/ 50 | build-iPhoneSimulator/ 51 | 52 | ## Specific to RubyMotion (use of CocoaPods): 53 | # 54 | # We recommend against adding the Pods directory to your .gitignore. However 55 | # you should judge for yourself, the pros and cons are mentioned at: 56 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 57 | # 58 | # vendor/Pods/ 59 | 60 | ## Documentation cache and generated files: 61 | /.yardoc/ 62 | /_yardoc/ 63 | /doc/ 64 | /rdoc/ 65 | 66 | ## Environment normalization: 67 | /.bundle/ 68 | /vendor/bundle 69 | /lib/bundler/man/ 70 | 71 | # for a library or gem, you might want to ignore these files since the code is 72 | # intended to run in multiple environments; otherwise, check them in: 73 | # Gemfile.lock 74 | # .ruby-version 75 | # .ruby-gemset 76 | 77 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 78 | .rvmrc 79 | 80 | #####=== Rails ===##### 81 | 82 | *.rbc 83 | capybara-*.html 84 | .rspec 85 | /log 86 | /tmp 87 | /db/*.sqlite3 88 | /db/*.sqlite3-journal 89 | /public/system 90 | /coverage/ 91 | /spec/tmp 92 | **.orig 93 | rerun.txt 94 | pickle-email-*.html 95 | 96 | # TODO Comment out this rule if you are OK with secrets being uploaded to the repo 97 | config/initializers/secret_token.rb 98 | 99 | # Only include if you have production secrets in this file, which is no longer a Rails default 100 | # config/secrets.yml 101 | 102 | # dotenv 103 | # TODO Comment out this rule if environment variables can be committed 104 | .env 105 | 106 | ## Environment normalization: 107 | /.bundle 108 | /vendor/bundle 109 | 110 | # these should all be checked in to normalize the environment: 111 | # Gemfile.lock, .ruby-version, .ruby-gemset 112 | 113 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 114 | .rvmrc 115 | 116 | # if using bower-rails ignore default bower_components path bower.json files 117 | /vendor/assets/bower_components 118 | *.bowerrc 119 | bower.json 120 | 121 | # Ignore pow environment settings 122 | .powenv 123 | 124 | # Ignore Byebug command history file. 125 | .byebug_history 126 | 127 | #####=== Emacs ===##### 128 | # -*- mode: gitignore; -*- 129 | *~ 130 | \#*\# 131 | /.emacs.desktop 132 | /.emacs.desktop.lock 133 | *.elc 134 | auto-save-list 135 | tramp 136 | .\#* 137 | 138 | # Org-mode 139 | .org-id-locations 140 | *_archive 141 | 142 | # flymake-mode 143 | *_flymake.* 144 | 145 | # eshell files 146 | /eshell/history 147 | /eshell/lastdir 148 | 149 | # elpa packages 150 | /elpa/ 151 | 152 | # reftex files 153 | *.rel 154 | 155 | # AUCTeX auto folder 156 | /auto/ 157 | 158 | # cask packages 159 | .cask/ 160 | dist/ 161 | 162 | # Flycheck 163 | flycheck_*.el 164 | 165 | # server auth directory 166 | /server/ 167 | 168 | # projectiles files 169 | .projectile 170 | 171 | # directory configuration 172 | .dir-locals.el 173 | -------------------------------------------------------------------------------- /app/views/tenants/ucsb/_dda.html.erb: -------------------------------------------------------------------------------- 1 |

Data Deposit Agreement

2 | 3 |

4 | UC Santa Barbara Library is pleased to provide use of 5 | the Dash data repository (Dash), maintained by 6 | California Digital Library (CDL), as a free service 7 | for UC Santa Barbara users. 8 |

9 | 10 |

By accepting the data deposit agreement, you acknowledge and agree to the following:

11 | 12 |

Who may use this service?

13 |
    14 |
  • UCSB faculty, staff, and graduate students.
  • 15 |
16 | 17 |

What may be deposited?

18 |
    19 |
  • Data related to the research and teaching missions of UCSB.
  • 20 |
  • 21 | Deposited data must be your original work, or in the public domain, or for which you have obtained the necessary 22 | rights or permissions to deposit. 23 |
  • 24 |
  • This repository is intended for final products, not for incomplete or in-progress works.
  • 25 |
26 | 27 |

What may not be deposited?

28 |
    29 |
  • Data containing unlawful, private, confidential, or sensitive information.
  • 30 |
31 | 32 |

Licensing and availability

33 |
    34 |
  • 35 | In compliance with best practices in open data, all deposited data will be released under a 36 | CC0 public domain dedication. 37 | (While CC0 does not require attribution, growing community and data citation norms create an expectation that users 38 | will properly cite data in the same manner they would any other form of scholarly communication.) 39 |
  • 40 |
  • 41 | You may defer the release of deposited data for up to six months at the time of submission. At the end of six months, 42 | the data will be released under a CC0 dedication unless you request and justify an additional deferment. 43 |
  • 44 |
45 | 46 |

Limits and limitations

47 |
    48 |
  • There is a limit of 100GB per data publication.
  • 49 |
  • If you anticipate uploading more than 500GB total, please contact the Data Curation Program first.
  • 50 |
  • 51 | Published datasets may not be removed by users. Data withdrawal requests and justifications should be directed 52 | to the Data Curation Program. 53 |
  • 54 |
55 | 56 |

Retention period

57 |
    58 |
  • 59 | Data deposited in this repository will be retained and made accessible (by Dash or equivalent repository) for a 60 | minimum of 10 years from the time of submission. After that time, if continued accessibility of the data is desired 61 | and justified, curators at the UCSB Library will coordinate with the original depositor to transfer the data to an 62 | alternative repository. 63 |
  • 64 |
65 | 66 |

Our rights

67 |
    68 |
  • 69 | The UCSB Library and CDL will have access to all content for the purposes of maintaining the system, creating backup 70 | copies, and publicly sharing the data. You grant data curators at the UCSB Library and CDL the right to review and 71 | enhance the metadata of submitted datasets. 72 |
  • 73 |
  • 74 | The UCSB Library and CDL retain the right to remove any material deemed, in their discretion, inappropriate or 75 | out of the scope of this repository. 76 |
  • 77 |
  • All actions taken by curators will be communicated to the depositor first.
  • 78 |
79 | 80 |

Additional information can be found at https://dash.ucsb.edu/stash/help 81 | and at https://dash.ucsb.edu/stash/faq/.

82 | 83 |

84 | For help and support, contact the Data Curation Program at 85 | datacuration@library.ucsb.edu. 86 |

87 | -------------------------------------------------------------------------------- /documentation/documentation_dump.md: -------------------------------------------------------------------------------- 1 | # Dash Technical Introductory Notes/Documentation Dump 2 | 3 | ## Demo Instance of Dash 4 | 5 | Our demo instance of Dash is available at [https://dashdemo.ucop.edu](https://dashdemo.ucop.edu) (available 7am-7pm Pacific time) and you may submit and test freely. 6 | 7 | ## Github Repositories & Similar 8 | 9 | * The main application for Dash is at [https://github.com/cdluc3/dashv2](https://github.com/cdluc3/dashv2) with minor customizations and configuration for an installation. The bulk of the code lives in the stash repository. 10 | 11 | * The repository at [https://github.com/CDLUC3/stash](https://github.com/CDLUC3/stash) holds most of our code. 12 | 13 | * The stash_engine and stash_datacite engines hold most of the code for the user interface. 14 | 15 | * The stash_api engine is where we've implemented our preliminary API. 16 | 17 | * The stash_discovery engine is a relatively thin wrapper and customization around Geoblacklight. 18 | 19 | * The repository contains some other libraries/gems for things such as sword or harvesting. 20 | 21 | * We have a repository at [https://github.com/cdlib/dash2-config](https://github.com/cdlib/dash2-config) which is private. We can re-derive some example configs from this (since our example is out of date) or give trusted others access to this repo so long as they keep any sensitive information here private. 22 | 23 | * The following repositories are used by or related to more minor aspects of the Dash service under the CDLUC3 workspace on github: dash2-harvester, datacite-mapping, resync-client, dash2-migrator 24 | 25 | * Travis.ci continuous integration builds for many of the Dash subcomponents are available at [https://travis-ci.org/CDLUC3](https://travis-ci.org/CDLUC3) . 26 | 27 | * We need to come up with contribution guidelines such as [Contribution Guidelines for DMPTool](https://github.com/DMPRoadmap/roadmap/blob/development/CONTRIBUTING.md), more to come soon. # TODO 28 | 29 | ## Documentation 30 | 31 | * We have an [installation guide](dash2_install.md) for installing the user-interface part of Dash along with some of the basic depedencies. Sorry, this is a bit out of date and probably needs to be updated but much of the information is still useful. 32 | 33 | * A basic generalized introduction to Dash is available at [https://dash.ucop.edu/stash/about](https://dash.ucop.edu/stash/about) . 34 | 35 | * Operations information (private) [https://confluence.ucop.edu/display/UC3/Stash+Operations](https://confluence.ucop.edu/display/UC3/Stash+Operations) 36 | 37 | * API documentation: [https://github.com/CDLUC3/stash/blob/master/stash_api/basic_submission.md](https://github.com/CDLUC3/stash/blob/master/stash_api/basic_submission.md) and [https://dash.ucop.edu/api/docs/](https://dash.ucop.edu/api/docs/) 38 | 39 | * A database [Entity-Relationship diagram](other_files/dash_er_2018-06.pdf). 40 | 41 | * Note most things are related to stash_engine_resources if you have trouble following all the lines. stash_engine_identifiers has many resources. 42 | 43 | * "dcs" means DataCite Schema 44 | 45 | * [Dataset submission flow](submission_flow.md), one of our longest and more complicated flows. (Login is also somewhat complicated, but people don’t spend a lot of time doing it.) 46 | 47 | * The UI Library from the UX team and how to integrate CSS and major UI changes into the Dash application. [https://github.com/CDLUC3/stash/blob/master/stash_engine/ui-library/README.md](https://github.com/CDLUC3/stash/blob/master/stash_engine/ui-library/README.md) 48 | 49 | * Please see [how to set up and run tests locally](local_testing_setup.md) so you can add tests and run current tests to be sure nothing breaks. 50 | 51 | ## Merritt 52 | 53 | * [Merritt Architecture](https://github.com/CDLUC3/mrt-doc/wiki/Architecture) 54 | 55 | * [Merritt’s low-level storage](https://github.com/CDLUC3/mrt-doc/wiki/Storage) 56 | 57 | ## Development Process 58 | 59 | * Development progress is tracked in the [GitHub CDL-Dryad Development Tracker](https://github.com/CDL-Dryad/dryad-product-roadmap/projects) 60 | 61 | -------------------------------------------------------------------------------- /lib/tasks/dev_ops.rake: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | 3 | # rubocop:disable Metrics/BlockLength 4 | namespace :dev_ops do 5 | 6 | # use like: bundle exec rake dev_ops:processing RAILS_ENV=development 7 | desc 'Shows processing submissions' 8 | task processing: :environment do 9 | unless ENV['RAILS_ENV'] 10 | puts 'RAILS_ENV must be explicitly set before running this script' 11 | next 12 | end 13 | in_process = StashEngine::Resource.joins(:current_resource_state).where("stash_engine_resource_states.resource_state = 'processing'") 14 | puts "resource_id\tuser_id\tcurrent_status\tupdated at\ttitle" if in_process.count > 0 15 | in_process.each do |i| 16 | puts "#{i.id}\t#{i.user_id}\t#{i.current_resource_state_id}\t#{i.updated_at}\t#{i.title}" 17 | end 18 | end 19 | 20 | desc 'update unfilled sizes' 21 | task fill_size: :environment do 22 | unless ENV['RAILS_ENV'] 23 | puts 'RAILS_ENV must be explicitly set before running this script' 24 | next 25 | end 26 | StashEngine::Identifier.where(storage_size: nil).each do |i| 27 | puts "Adding size to #{i}" 28 | ds_info = Stash::Repo::DatasetInfo.new(i) 29 | i.update(storage_size: ds_info.dataset_size) 30 | end 31 | end 32 | 33 | desc 'fill missing file sizes' 34 | task fill_file_size: :environment do 35 | unless ENV['RAILS_ENV'] 36 | puts 'RAILS_ENV must be explicitly set before running this script' 37 | next 38 | end 39 | fus = StashEngine::FileUpload.where(upload_file_size: [0, nil]) 40 | fus.each do |file_upload| 41 | resource = file_upload.resource 42 | next unless resource && resource.current_resource_state && resource.current_resource_state.resource_state == 'submitted' 43 | puts "updating resource #{resource.id} & #{resource.identifier}" 44 | ds_info = Stash::Repo::DatasetInfo.new(resource.identifier) 45 | file_upload.update(upload_file_size: ds_info.file_size(file_upload.upload_file_name)) 46 | end 47 | end 48 | 49 | desc 'Update the description fields to have html content (generated from text)' 50 | task htmlize: :environment do 51 | require 'script/htmlize_descriptions' 52 | 53 | puts "Are you sure you want to update desciption text to html in #{Rails.env}? (Type 'yes' to proceed, 'no' to preview.)" 54 | response = STDIN.gets 55 | if response.strip.casecmp('YES').zero? 56 | StashDatacite::Description.all.each do |desc| 57 | item = Script::HtmlizeDescriptions.new(desc.description) 58 | next if item.html? || desc.description.blank? 59 | out_html = item.text_as_html 60 | desc.update(description: out_html) 61 | puts "Updated description id: #{desc.id}" 62 | puts out_html 63 | puts '' 64 | end 65 | 66 | else 67 | StashDatacite::Description.all.each do |desc| 68 | item = Script::HtmlizeDescriptions.new(desc.description) 69 | next if item.html? || desc.description.blank? 70 | puts desc.resource.id if desc.resource 71 | puts item.text_as_html 72 | puts '' 73 | end 74 | end 75 | end 76 | 77 | desc 'manually clean up temp files for successfully submitted resources' 78 | task cleanup_staged_files: :environment do 79 | unless ENV['RAILS_ENV'] 80 | puts 'RAILS_ENV must be explicitly set before running this script' 81 | next 82 | end 83 | puts "Are you sure you want clean up staging files for #{Rails.env} on this machine? (Type 'yes' to proceed)" 84 | response = STDIN.gets 85 | next unless response.strip.casecmp('YES').zero? # they have to type yes 86 | Dir.glob(Rails.root.join('uploads', '*')).each do |path| 87 | fn = File.basename(path) 88 | next unless File.directory?(path) && fn.match(/^\d+$/) 89 | resources = StashEngine::Resource.where(id: fn) 90 | if resources.count < 1 || resources.first.current_resource_state.resource_state == 'submitted' 91 | puts "Cleaning up resource files #{fn}" 92 | FileUtils.rm_r path 93 | end 94 | end 95 | end 96 | 97 | end 98 | # rubocop:enable Metrics/BlockLength 99 | -------------------------------------------------------------------------------- /public/images/logo_ucsd.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 10 | 13 | 16 | 20 | 23 | 26 | 29 | 32 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /spec/features/new_dataset_spec.rb: -------------------------------------------------------------------------------- 1 | require 'features_helper' 2 | require 'byebug' 3 | 4 | describe 'new dataset' do 5 | attr_reader :start_new_dataset 6 | 7 | before(:each) do 8 | log_in! 9 | @start_new_dataset = first(:link_or_button, 'Start New Dataset') 10 | expect(start_new_dataset).not_to be_nil 11 | end 12 | 13 | describe 'Start New Dataset' do 14 | before(:each) do 15 | start_new_dataset.click 16 | end 17 | 18 | it 'starts a new dataset' do 19 | expect(page).to have_content('Describe Your Dataset') 20 | 21 | # ############################## 22 | # Title 23 | 24 | title = find_blank_field_id('title') 25 | fill_in title, with: 'Of a peculiar Lead-Ore of Germany, and the Use thereof' 26 | 27 | # ############################## 28 | # Author 29 | 30 | author_first_name = find_field_id('author[author_first_name]') 31 | fill_in author_first_name, with: 'Robert' 32 | author_last_name = find_field_id('author[author_last_name]') 33 | fill_in author_last_name, with: 'Boyle' 34 | author_affiliation = find_field_id('affiliation') # TODO: make consistent with other author fields 35 | fill_in author_affiliation, with: 'Hogwarts' 36 | author_email = find_field_id('author[author_email]') 37 | fill_in author_email, with: 'boyle@hogwarts.edu' 38 | 39 | # TODO: additional author(s) 40 | 41 | # ############################## 42 | # Abstract 43 | 44 | # CKEditor is made up of two parts. A hidden textarea that will contain the value of the input after changes are made 45 | # and an iFrame where the actual editing takes place (in addition to controls and other things) 46 | 47 | abstract = find_blank_ckeditor_id('description_abstract') 48 | 49 | fill_in_ckeditor abstract, with: <<-ABSTRACT 50 | There was, not long since, sent hither out of Germany from 51 | an inquisitive Physician, a List of several Minerals and Earths 52 | of that Country, and of Hungary, together with a Specimen of each 53 | of them. 54 | ABSTRACT 55 | 56 | # ############################## 57 | # Optional fields 58 | 59 | description_divider = find('summary', text: 'Data Description (optional)') 60 | description_divider.click 61 | 62 | # ############################## 63 | # Funding 64 | 65 | # TODO: stop calling this section 'contributor' 66 | 67 | granting_organization = find_blank_field_id('contributor[contributor_name]') 68 | fill_in granting_organization, with: 'Ministry of Magic' 69 | 70 | award_number = find_blank_field_id('contributor[award_number]') 71 | fill_in award_number, with: '9¾' 72 | 73 | # ############################## 74 | # Keywords 75 | 76 | keywords = find_blank_field_id('subject') # TODO: rename field 77 | fill_in keywords, with: 'Optick Glasses' 78 | 79 | # ############################## 80 | # Methods 81 | 82 | methods = find_blank_ckeditor_id('description_methods') 83 | 84 | fill_in_ckeditor methods, with: <<-METHODS 85 | The Stone, according to the Letter of Mr. David Thomas, who sent this account 86 | to Mr. Boyle, is with Doctor Haughteyn of Salisbury, to whom he also referreth 87 | for further information. 88 | METHODS 89 | 90 | # ############################## 91 | # Usage 92 | 93 | usage_notes = find_blank_ckeditor_id('description_other') 94 | 95 | fill_in_ckeditor usage_notes, with: <<-USAGE 96 | 'Tis found in the Upper Palatinate, at a place called Freyung, and there are 97 | two sorts of it, whereof one is a kind of Crystalline Stone, and almost all 98 | good Leads the other not so rich, and more farinaceous. 99 | USAGE 100 | 101 | # ############################## 102 | # Related works 103 | 104 | select 'continues', from: 'related_identifier[relation_type]' 105 | select 'DOI', from: 'related_identifier[related_identifier_type]' 106 | related_identifier = find_blank_field_id('related_identifier[related_identifier]') 107 | fill_in related_identifier, with: 'doi:10.1098/rstl.1665.0007' # TODO: is this the preferred format? 108 | 109 | end 110 | end 111 | end 112 | -------------------------------------------------------------------------------- /config/environments/development.rb.stagelike: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like 20 | # NGINX, varnish or squid. 21 | # config.action_dispatch.rack_cache = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | # config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | config.serve_static_files = true 27 | 28 | # Compress JavaScripts and CSS. 29 | config.assets.js_compressor = :uglifier 30 | config.assets.css_compressor = :yui 31 | 32 | # Do not fallback to assets pipeline if a precompiled asset is missed. 33 | config.assets.compile = false 34 | 35 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 36 | # yet still be able to expire them through the digest params. 37 | config.assets.digest = true 38 | 39 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 40 | 41 | # Specifies the header that your server uses for sending files. 42 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 43 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 44 | 45 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 46 | # config.force_ssl = true 47 | 48 | # Use the lowest log level to ensure availability of diagnostic information 49 | # when problems arise. 50 | config.log_level = :debug 51 | 52 | # Prepend all log lines with the following tags. 53 | # config.log_tags = [ :subdomain, :uuid ] 54 | 55 | # Use a different logger for distributed setups. 56 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 57 | 58 | # Use a different cache store in production. 59 | # config.cache_store = :mem_cache_store 60 | 61 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 62 | # config.action_controller.asset_host = 'http://assets.example.com' 63 | 64 | # Ignore bad email addresses and do not raise email delivery errors. 65 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 66 | # config.action_mailer.raise_delivery_errors = false 67 | 68 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 69 | # the I18n.default_locale when a translation cannot be found). 70 | config.i18n.fallbacks = true 71 | 72 | # Send deprecation notices to registered listeners. 73 | config.active_support.deprecation = :notify 74 | 75 | # Use default logging formatter so that PID and timestamp are not suppressed. 76 | config.log_formatter = ::Logger::Formatter.new 77 | 78 | # Do not dump schema after migrations. 79 | config.active_record.dump_schema_after_migration = false 80 | 81 | Rails.application.config.middleware.use ExceptionNotification::Rack, 82 | :email => { 83 | # :deliver_with => :deliver, # Rails >= 4.2.1 do not need this option since it defaults to :deliver_now 84 | :email_prefix => "[Dash2 Exception]", 85 | :sender_address => %{"Dash2 Notifier" }, 86 | :exception_recipients => %w{marisa.strong@ucop.edu scott.fisher@ucop.edu bhavi.vedula@ucop.edu} 87 | } 88 | 89 | config.action_mailer.delivery_method = :sendmail 90 | config.action_mailer.perform_deliveries = true 91 | config.action_mailer.raise_delivery_errors = true 92 | config.action_mailer.default_url_options = { :host => "https://dash2-dev.ucop.edu/stash" } 93 | 94 | end 95 | -------------------------------------------------------------------------------- /app/assets/images/tenants/logo_ucsd.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 10 | 13 | 16 | 20 | 23 | 26 | 29 | 32 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /config/environments/stage.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # force_ssl causes infinite redirects, only do in apache or rails, not both 8 | #config.force_ssl = true 9 | 10 | # Eager load code on boot. This eager loads most of Rails and 11 | # your application in memory, allowing both threaded web servers 12 | # and those relying on copy on write to perform better. 13 | # Rake tasks automatically ignore this option for performance. 14 | config.eager_load = true 15 | 16 | # Full error reports are disabled and caching is turned on. 17 | config.consider_all_requests_local = false 18 | config.action_controller.perform_caching = true 19 | 20 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 21 | # Add `rack-cache` to your Gemfile before enabling this. 22 | # For large-scale production use, consider using a caching reverse proxy like 23 | # NGINX, varnish or squid. 24 | # config.action_dispatch.rack_cache = true 25 | 26 | # Disable serving static files from the `/public` folder by default since 27 | # Apache or NGINX already handles this. 28 | # config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 29 | config.serve_static_files = true 30 | 31 | # Compress JavaScripts and CSS. 32 | config.assets.js_compressor = :uglifier 33 | config.assets.css_compressor = :yui 34 | 35 | # Do not fallback to assets pipeline if a precompiled asset is missed. 36 | config.assets.compile = false 37 | 38 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 39 | # yet still be able to expire them through the digest params. 40 | config.assets.digest = true 41 | 42 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 43 | 44 | # Specifies the header that your server uses for sending files. 45 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 46 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 47 | 48 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 49 | # config.force_ssl = true 50 | 51 | # Use the lowest log level to ensure availability of diagnostic information 52 | # when problems arise. 53 | config.log_level = :info 54 | 55 | # Prepend all log lines with the following tags. 56 | # config.log_tags = [ :subdomain, :uuid ] 57 | 58 | # Use a different logger for distributed setups. 59 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 60 | 61 | # Use a different cache store in production. 62 | # config.cache_store = :mem_cache_store 63 | 64 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 65 | # config.action_controller.asset_host = 'http://assets.example.com' 66 | 67 | # Ignore bad email addresses and do not raise email delivery errors. 68 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 69 | # config.action_mailer.raise_delivery_errors = false 70 | 71 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 72 | # the I18n.default_locale when a translation cannot be found). 73 | config.i18n.fallbacks = true 74 | 75 | # Send deprecation notices to registered listeners. 76 | config.active_support.deprecation = :notify 77 | 78 | # Use default logging formatter so that PID and timestamp are not suppressed. 79 | config.log_formatter = ::Logger::Formatter.new 80 | 81 | # Do not dump schema after migrations. 82 | config.active_record.dump_schema_after_migration = false 83 | 84 | Rails.application.config.middleware.use ExceptionNotification::Rack, 85 | :email => { 86 | # :deliver_with => :deliver, # Rails >= 4.2.1 do not need this option since it defaults to :deliver_now 87 | :email_prefix => "[Dash2 Exception]", 88 | :sender_address => %{"Dash2 Notifier" }, 89 | :exception_recipients => %w{marisa.strong@ucop.edu scott.fisher@ucop.edu bhavi.vedula@ucop.edu} 90 | }, 91 | :error_grouping => true, 92 | :error_grouping_period => 3.hours 93 | 94 | config.action_mailer.delivery_method = :sendmail 95 | config.action_mailer.perform_deliveries = true 96 | config.action_mailer.raise_delivery_errors = true 97 | config.action_mailer.default_url_options = { :host => "https://dash2-stg.ucop.edu/stash" } 98 | 99 | end 100 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # force_ssl causes infinite redirects, only do in apache or rails, not both 8 | #config.force_ssl = true 9 | 10 | # Eager load code on boot. This eager loads most of Rails and 11 | # your application in memory, allowing both threaded web servers 12 | # and those relying on copy on write to perform better. 13 | # Rake tasks automatically ignore this option for performance. 14 | config.eager_load = true 15 | 16 | # Full error reports are disabled and caching is turned on. 17 | config.consider_all_requests_local = false 18 | config.action_controller.perform_caching = true 19 | 20 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 21 | # Add `rack-cache` to your Gemfile before enabling this. 22 | # For large-scale production use, consider using a caching reverse proxy like 23 | # NGINX, varnish or squid. 24 | # config.action_dispatch.rack_cache = true 25 | 26 | # Disable serving static files from the `/public` folder by default since 27 | # Apache or NGINX already handles this. 28 | # config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 29 | config.serve_static_files = true 30 | 31 | # Compress JavaScripts and CSS. 32 | config.assets.js_compressor = :uglifier 33 | config.assets.css_compressor = :yui 34 | 35 | # Do not fallback to assets pipeline if a precompiled asset is missed. 36 | config.assets.compile = false 37 | 38 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 39 | # yet still be able to expire them through the digest params. 40 | config.assets.digest = true 41 | 42 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 43 | 44 | # Specifies the header that your server uses for sending files. 45 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 46 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 47 | 48 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 49 | # config.force_ssl = true 50 | 51 | # Use the lowest log level to ensure availability of diagnostic information 52 | # when problems arise. 53 | config.log_level = :warn 54 | 55 | # Prepend all log lines with the following tags. 56 | # config.log_tags = [ :subdomain, :uuid ] 57 | 58 | # Use a different logger for distributed setups. 59 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 60 | 61 | # Use a different cache store in production. 62 | # config.cache_store = :mem_cache_store 63 | 64 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 65 | # config.action_controller.asset_host = 'http://assets.example.com' 66 | 67 | # Ignore bad email addresses and do not raise email delivery errors. 68 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 69 | # config.action_mailer.raise_delivery_errors = false 70 | 71 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 72 | # the I18n.default_locale when a translation cannot be found). 73 | config.i18n.fallbacks = true 74 | 75 | # Send deprecation notices to registered listeners. 76 | config.active_support.deprecation = :notify 77 | 78 | # Use default logging formatter so that PID and timestamp are not suppressed. 79 | config.log_formatter = ::Logger::Formatter.new 80 | 81 | # Do not dump schema after migrations. 82 | config.active_record.dump_schema_after_migration = false 83 | 84 | #this is obnoxious because the initializers haven't run yet, so have to duplicate code to read config 85 | ac = YAML.load_file(File.join(Rails.root, 'config', 'app_config.yml'))[Rails.env] 86 | unless ac['page_error_email'].blank? 87 | Rails.application.config.middleware.use ExceptionNotification::Rack, 88 | :email => { 89 | # :deliver_with => :deliver, # Rails >= 4.2.1 do not need this option since it defaults to :deliver_now 90 | :email_prefix => "[Dash Exception]", 91 | :sender_address => %{"Dash Notifier" }, 92 | :exception_recipients => ac['page_error_email'] 93 | }, 94 | :error_grouping => true, 95 | :error_grouping_period => 3.hours 96 | end 97 | 98 | config.action_mailer.delivery_method = :sendmail 99 | config.action_mailer.perform_deliveries = true 100 | config.action_mailer.raise_delivery_errors = true 101 | 102 | end 103 | -------------------------------------------------------------------------------- /config/environments/demo.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # force_ssl causes infinite redirects, only do in apache or rails, not both 8 | #config.force_ssl = true 9 | 10 | # Eager load code on boot. This eager loads most of Rails and 11 | # your application in memory, allowing both threaded web servers 12 | # and those relying on copy on write to perform better. 13 | # Rake tasks automatically ignore this option for performance. 14 | config.eager_load = true 15 | 16 | # Full error reports are disabled and caching is turned on. 17 | config.consider_all_requests_local = false 18 | config.action_controller.perform_caching = true 19 | 20 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 21 | # Add `rack-cache` to your Gemfile before enabling this. 22 | # For large-scale production use, consider using a caching reverse proxy like 23 | # NGINX, varnish or squid. 24 | # config.action_dispatch.rack_cache = true 25 | 26 | # Disable serving static files from the `/public` folder by default since 27 | # Apache or NGINX already handles this. 28 | # config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 29 | config.serve_static_files = true 30 | 31 | # Compress JavaScripts and CSS. 32 | config.assets.js_compressor = :uglifier 33 | config.assets.css_compressor = :yui 34 | 35 | # Do not fallback to assets pipeline if a precompiled asset is missed. 36 | config.assets.compile = false 37 | 38 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 39 | # yet still be able to expire them through the digest params. 40 | config.assets.digest = true 41 | 42 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 43 | 44 | # Specifies the header that your server uses for sending files. 45 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 46 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 47 | 48 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 49 | # config.force_ssl = true 50 | 51 | # Use the lowest log level to ensure availability of diagnostic information 52 | # when problems arise. 53 | config.log_level = :info 54 | 55 | # Prepend all log lines with the following tags. 56 | # config.log_tags = [ :subdomain, :uuid ] 57 | 58 | # Use a different logger for distributed setups. 59 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 60 | 61 | # Use a different cache store in production. 62 | # config.cache_store = :mem_cache_store 63 | 64 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 65 | # config.action_controller.asset_host = 'http://assets.example.com' 66 | 67 | # Ignore bad email addresses and do not raise email delivery errors. 68 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 69 | # config.action_mailer.raise_delivery_errors = false 70 | 71 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 72 | # the I18n.default_locale when a translation cannot be found). 73 | config.i18n.fallbacks = true 74 | 75 | # Send deprecation notices to registered listeners. 76 | config.active_support.deprecation = :notify 77 | 78 | # Use default logging formatter so that PID and timestamp are not suppressed. 79 | config.log_formatter = ::Logger::Formatter.new 80 | 81 | # Do not dump schema after migrations. 82 | config.active_record.dump_schema_after_migration = false 83 | 84 | #this is obnovious because the initializers haven't run yet, so have to duplicate code to read config 85 | ac = YAML.load_file(File.join(Rails.root, 'config', 'app_config.yml'))[Rails.env] 86 | unless ac['page_error_email'].blank? 87 | Rails.application.config.middleware.use ExceptionNotification::Rack, 88 | :email => { 89 | # :deliver_with => :deliver, # Rails >= 4.2.1 do not need this option since it defaults to :deliver_now 90 | :email_prefix => "[Dash Exception]", 91 | :sender_address => %{"Dash Notifier" }, 92 | :exception_recipients => ac['page_error_email'] 93 | }, 94 | :error_grouping => true, 95 | :error_grouping_period => 3.hours 96 | end 97 | 98 | config.action_mailer.delivery_method = :sendmail 99 | config.action_mailer.perform_deliveries = true 100 | config.action_mailer.raise_delivery_errors = true 101 | config.action_mailer.default_url_options = { :host => "https://dash2-stg.ucop.edu/stash" } 102 | 103 | end 104 | -------------------------------------------------------------------------------- /documentation/local_testing_setup.md: -------------------------------------------------------------------------------- 1 | # Setting up local testing 2 | 3 | Running tests locally on a development machine means an easier time writing and developing tests, running an individual test and 4 | also not needing to wait for travis.ci to run all tests in order to get results. 5 | 6 | ## Install MySQL if not installed 7 | 8 | ``` 9 | # installing MySQL in an Ubuntu Linux distro, make note of any root password you set while installing 10 | sudo apt-get install mysql-server mysql-client libmysqlclient-dev 11 | 12 | # make sure MySQL is started 13 | sudo service mysql start 14 | 15 | # Depends how the MySQL installs, how it lets you in. If not working, try with and without sudo or with password 16 | # to be sure you can get into mysql 17 | sudo mysql -u root 18 | 19 | mysql> CREATE USER 'travis'@'%'; 20 | 21 | # If you need to use sudo to get into mysql as a root user, please see instructions at 22 | # https://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04/801950 23 | # to allow MySQL root access to the test/dev environment without having to use sudo. Note, MySQL root access should 24 | # be secured on production servers and not left open. 25 | 26 | # the travis_prep.sh script below assumes it can access MySQL root user without a password (or sudo) for setting up a testing environment. 27 | ``` 28 | 29 | ## Get Oracle JRE installed if needed 30 | 31 | The OpenJRE did not work correctly with SOLR when I tested, so you may need to install an Oracle runtime. 32 | 33 | ``` 34 | sudo add-apt-repository ppa:webupd8team/java 35 | sudo apt-get update 36 | 37 | sudo apt-get install oracle-java8-installer 38 | 39 | # this isn't for Java, but while you're in here, install the Chromium browser which gets automated for testing the UI 40 | sudo apt install -y chromium-browser 41 | ``` 42 | 43 | ## Setting up and running tests 44 | 45 | It's usually convenient to run tests just on the part of the application where you have changed code. For example 46 | within an engine or in the main app for overall testing through the UI. 47 | 48 | Each component has a *travis-prep.sh* script for setting up the database for testing that component and it only needs to be run once 49 | if you continue to use the same test database. 50 | 51 | For example, to set up and run the tests in the stash_engine: 52 | 53 | ``` 54 | cd stash/stash_engine 55 | 56 | # travis_prep only needs to be done the first time you use a database and sets it up for testing this component 57 | ./travis_prep.sh 58 | 59 | # bundle install if the bundle is not up to date 60 | bundle install 61 | 62 | # note, I had some weird errors after setting up my gems initially and had to reload my shell to get things working 63 | 64 | # this command runs the default rake task, which will run all tests for the component 65 | bundle exec rake 66 | ``` 67 | 68 | ## Notes about Rubocop, .ruby-version, Bundler and Rake 69 | 70 | One component of the test suite runs Rubocop which is a style and convention checker. It uses a configuration 71 | file to allow modifications to its generally very strict (and sometimes unintelligent) checking. It also 72 | makes changes to its software and configuration on a fairly frequent basis. Different versions 73 | of Rubocop or for different target Ruby versions 74 | will bring up different suggestions or even bring in Rubocop configuration syntax changes. We've also tried 75 | to keep rubocop versions the same across different components as there is some inheritance of settings. 76 | 77 | You will probably want to run Rubocop outside of the test suite but use the same environment settings as used 78 | by the test suite. It's very common to run *rubocop -a* which will auto-fix (mostly) clear-cut conventions such as 79 | spacing irregularities or similar items. It's also nice to be able to fix problems and re-run rubocop 80 | separately from running the tests, iterating until all style suggestions are fixed or acknowledged. 81 | 82 | By appending *bundle exec* to a Ruby command in context of an application (or gem or engine), it runs that command 83 | in the environment defined for use by that application. It uses the external gems (libraries) and versions indicated in 84 | the Gemfile, pulled in by dependencies and locked in place by the Gemfile.lock. It should keep some random problems 85 | from occuring because of version differences between a gem locally instaled on the computer and an 86 | application-specific gem. 87 | 88 | The hidden .ruby-version file in the root of an application (or engine or gem) does something a little similar to Bundler 89 | but instead of locking a known set of gems and versions in place, it tells the version of Ruby that the application 90 | expects to use. Software such as rbenv or rvm will read this file and can do things such as automatically switching 91 | to using that version of Ruby when cd-ing to that directory (or prompting to install the expected version of Ruby). 92 | Also, some IDEs will look at the file for tailoring suggestions to a specific version of Ruby. 93 | 94 | Rake is a way to define utility or other tasks that might be run (note the similar name to Make). The default task for our 95 | components is to run tests. You can define other rake tasks and specify a task when running Rake to do other things. 96 | -------------------------------------------------------------------------------- /spec/fixtures/dcs_descriptions.yml: -------------------------------------------------------------------------------- 1 | desc1: 2 | id: 1 3 | description: Recent advances in classical information and highly-available methodologies 4 | are based entirely on the assumption that erasure coding and RPCs are not in conflict 5 | with A* search. Given the current status of interactive algorithms, theorists 6 | particularly desire the investigation of erasure coding, which embodies the private 7 | principles of robotics. Such a hypothesis might seem perverse but is derived from 8 | known results. In order to achieve this purpose, we concentrate our efforts on 9 | verifying that robots and gigabit switches are continuously incompatible. 10 | description_type: abstract 11 | resource_id: 1 12 | created_at: 2017-08-24 21:00:45.000000000 Z 13 | updated_at: 2017-08-24 21:02:03.000000000 Z 14 | 15 | desc2: 16 | id: 2 17 | description: Collected with the SC121 data meter. 18 | description_type: methods 19 | resource_id: 1 20 | created_at: 2017-08-24 21:00:45.000000000 Z 21 | updated_at: 2017-08-24 21:02:57.000000000 Z 22 | 23 | desc3: 24 | id: 3 25 | description: Use correct median of 228.28 when analyzing. 26 | description_type: other 27 | resource_id: 1 28 | created_at: 2017-08-24 21:00:45.000000000 Z 29 | updated_at: 2017-08-24 21:03:23.000000000 Z 30 | 31 | desc4: 32 | id: 4 33 | description: Recent advances in classical information and highly-available methodologies 34 | are based entirely on the assumption that erasure coding and RPCs are not in conflict 35 | with A* search. Given the current status of interactive algorithms, theorists 36 | particularly desire the investigation of erasure coding, which embodies the private 37 | principles of robotics. Such a hypothesis might seem perverse but is derived from 38 | known results. In order to achieve this purpose, we concentrate our efforts on 39 | verifying that robots and gigabit switches are continuously incompatible. 40 | description_type: abstract 41 | resource_id: 2 42 | created_at: 2017-08-24 21:10:18.000000000 Z 43 | updated_at: 2017-08-24 21:10:18.000000000 Z 44 | 45 | desc5: 46 | id: 5 47 | description: Collected with the SC121 data meter. 48 | description_type: methods 49 | resource_id: 2 50 | created_at: 2017-08-24 21:10:18.000000000 Z 51 | updated_at: 2017-08-24 21:10:18.000000000 Z 52 | 53 | desc6: 54 | id: 6 55 | description: Use correct median of 228.28 when analyzing. 56 | description_type: other 57 | resource_id: 2 58 | created_at: 2017-08-24 21:10:18.000000000 Z 59 | updated_at: 2017-08-24 21:10:18.000000000 Z 60 | 61 | desc7: 62 | id: 7 63 | description: Replication must work. After years of confirmed research into simulated 64 | annealing, we confirm the analysis of reinforcement learning. Here, we propose 65 | a novel framework for the exploration of RAID (NotEmotion), disproving that the 66 | well-known psychoacoustic algorithm for the development of context-free grammar 67 | by Nehru et al. [24] is recursively enumerable. 68 | description_type: abstract 69 | resource_id: 3 70 | created_at: 2017-08-24 21:12:10.000000000 Z 71 | updated_at: 2017-08-24 21:13:14.000000000 Z 72 | 73 | desc8: 74 | id: 8 75 | description: 76 | description_type: methods 77 | resource_id: 3 78 | created_at: 2017-08-24 21:12:10.000000000 Z 79 | updated_at: 2017-08-24 21:12:10.000000000 Z 80 | 81 | desc9: 82 | id: 9 83 | description: 84 | description_type: other 85 | resource_id: 3 86 | created_at: 2017-08-24 21:12:10.000000000 Z 87 | updated_at: 2017-08-24 21:12:10.000000000 Z 88 | 89 | desc10: 90 | id: 10 91 | description: Analysts agree that pervasive algorithms are an interesting new topic 92 | in the field of steganography, and end-users concur. Given the current status 93 | of real-time modalities, futurists daringly desire the deployment of symmetric 94 | encryption. Opie, our new framework for linear-time models, is the solution to 95 | all of these issues. 96 | description_type: abstract 97 | resource_id: 4 98 | created_at: 2017-08-24 21:15:49.000000000 Z 99 | updated_at: 2017-08-24 21:16:56.000000000 Z 100 | 101 | desc11: 102 | id: 11 103 | description: 104 | description_type: methods 105 | resource_id: 4 106 | created_at: 2017-08-24 21:15:49.000000000 Z 107 | updated_at: 2017-08-24 21:15:49.000000000 Z 108 | 109 | desc12: 110 | id: 12 111 | description: 112 | description_type: other 113 | resource_id: 4 114 | created_at: 2017-08-24 21:15:49.000000000 Z 115 | updated_at: 2017-08-24 21:15:49.000000000 Z 116 | 117 | desc13: 118 | id: 13 119 | description: Analysts agree that pervasive algorithms are an interesting new topic 120 | in the field of steganography, and end-users concur. Given the current status 121 | of real-time modalities, futurists daringly desire the deployment of symmetric 122 | encryption. Opie, our new framework for linear-time models, is the solution to 123 | all of these issues. 124 | description_type: abstract 125 | resource_id: 5 126 | created_at: 2017-08-24 21:29:13.000000000 Z 127 | updated_at: 2017-08-24 21:29:13.000000000 Z 128 | 129 | desc14: 130 | id: 14 131 | description: 132 | description_type: methods 133 | resource_id: 5 134 | created_at: 2017-08-24 21:29:13.000000000 Z 135 | updated_at: 2017-08-24 21:29:13.000000000 Z 136 | 137 | desc15: 138 | id: 15 139 | description: 140 | description_type: other 141 | resource_id: 5 142 | created_at: 2017-08-24 21:29:13.000000000 Z 143 | updated_at: 2017-08-24 21:29:13.000000000 Z 144 | -------------------------------------------------------------------------------- /app/views/layouts/_help.html.md: -------------------------------------------------------------------------------- 1 | ## Submission Basics 2 | We have some general reminders and suggestions for publishing your data with Dash: 3 | 4 | - We accept all file formats, although it is good practice to share data using open formats. See the [UK Data Archive](http://www.data-archive.ac.uk/create-manage/format/formats-table) for a list of optimal file formats 5 | - Any data submitted will be under the [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/) or CC0 license. We do not currently support any other license types, nor do we allow for restrictions on data access or use 6 | - It is your responsibility to ensure your data are being shared responsibly and ethically. Please be careful of sharing sensitive data and ensure you are complying with institutional and governmental regulations 7 | - When preparing your complete version of a dataset, remember to collate all relevant explantory documents and metadata. This includes relevant documentation necessary for the re-use and replication of your dataset (e.g., readme.txt files, formal metadata records, or other critical information, etc.) 8 | 9 | Dash has a REST API that allows for download and submission of data. Check out our [documentation](https://dash.ucop.edu/api/docs/index.html) as well as our [How-To Guide](https://github.com/CDLUC3/stash/blob/master/stash_api/basic_submission.md) 10 | 11 | 12 | ## Metadata 13 | Comprehensive data documentation (i.e. metadata) is the key to future understanding of data. Without a thorough description of the context of the data file, the context in which the data were collected, the measurements that were made, and the quality of the data, it is unlikely that the data can be easily discovered, understood, or effectively used. Metadata is important not only to help people understand and make proper use of a data resource, but metadata also makes the resource discoverable (for example through internet searches or data indexing services). Read more about metadata in the [DataONE Primer on Data Management Best Practices](http://www.dataone.org/sites/all/documents/DataONE_BP_Primer_020212.pdf) 14 | (PDF). 15 | 16 | A complete list of our default metadata fields is below. Additional metadata can be uploaded alongside the dataset (e.g., as a readme.txt file). Our default metadata entry form is based on fields from the metadata schema of the DOI issuing agency, DataCite. 17 | 18 | Required Fields: 19 | 20 | - Title : Title of the dataset. Make sure to be as descriptive as possible 21 | - Author(s): Name, email address, institutional affliation of main researcher(s) involved in producing the data. If you include your [ORCID](http://orcid.org), we will request the ORCID registry auto-populate this publication on your ORCID profile 22 | - Abstract: Short description of dataset 23 | 24 | Optional Fields (the more you describe your dataset, the wider the reach): 25 | 26 | - Keyword(s) : Descriptive words that may help others discover your dataset. We recommend that you determine whether your discipline has an existing controlled vocabulary from which to choose your keywords. Please enter as many keywords as applicable 27 | - Methods : Any technical or methodological information that may help others to understand how the data were generated (i.e. equipment/tools/reagents used, or procedures followed) 28 | - Usage Notes : Any technical or methodological information that may help others determine how the data may be properly re-used, replicated, or re-analyzed 29 | - Funding Information : Name of the funding organization that supported creation of the resource, including applicable grant number(s) 30 | - Related Works : Use this field to indicate other resources that are associated with the data. Examples include publications, other datasets, code etc. 31 | - Location information : Include the geo-coordinates or name of the location where your data were generated or the location that is the focus of your research 32 | 33 | ## Upload Methods 34 | We have two different options for uploading your data. 35 | - Upload directly from your computer: by using drag and drop or the upload button. We allow for 10gb of data per DOI to be uploaded this way. 36 | - Upload from a server or the cloud: by entering the URL of the location where data are held on a server, or the sharing link for Box, Dropbox, or Google Drive. We allow for 100gb of data per DOI to be validated and uploaded this way. 37 | 38 | Please note that you may only use one of these two upload methods per version, but you may do subsequent versions of your data publication and utilize different methods of upload this way. 39 | 40 | ## Publication and Citation 41 | - We do allow for you to delay the publication of your data if for the purposes of having a related article under peer review. If you do choose to utilize this feature we allow for up to a maximum of 180 days to delay publication. 42 | - As soon as your data publication is public we recommend citing and publicizing your work with your given DOI. 43 | - If you have edits, additional data, or subsequent related work we recommend versioning your data by using the "update" link. All versions of a dataset will be accessible and kept in the Merritt Repository, but the dataset DOI will always resolve to the newest version. 44 | - For more details about publication with Dash see our [Frequently Asked Questions (FAQ)](/stash/faq/) 45 | 46 | ## Institution, Organization, and Publisher Resources 47 | 48 | - [UC Davis](https://www.library.ucdavis.edu/service/data-management/) 49 | - [UC Berkeley](http://researchdata.berkeley.edu/) 50 | - [UC San Francisco](https://www.library.ucsf.edu/data-science/data/) 51 | - [UC Merced](http://library.ucmerced.edu/digital-curation-and-scholarship/) 52 | - [UC Santa Cruz](http://guides.library.ucsc.edu/datamanagement/) 53 | - [UC Irvine](http://guides.lib.uci.edu/datamanagement/) 54 | - [UC Riverside](https://library.ucr.edu/research-services/managing-your-data/) 55 | - [UC Press: Elementa](https://www.elementascience.org/about/data-guidelines/#deposit-of-primary-data/) 56 | 57 | --------------------------------------------------------------------------------