From a0351172914fb1eeabb3d393fcffda4a6a79f885 Mon Sep 17 00:00:00 2001 From: Daniel Pierce Date: Fri, 21 Apr 2017 13:39:52 -0400 Subject: [PATCH 01/57] Apply page header css to groups admin pages. --- app/views/admin/groups/edit.html.erb | 10 ++++++---- app/views/admin/groups/index.html.erb | 10 ++++++---- app/views/admin/groups/new.html.erb | 10 ++++++---- app/views/admin/groups/remove.html.erb | 10 ++++++---- app/views/admin/groups/users.html.erb | 10 ++++++---- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/app/views/admin/groups/edit.html.erb b/app/views/admin/groups/edit.html.erb index 64899890fc..3f3cb6f852 100644 --- a/app/views/admin/groups/edit.html.erb +++ b/app/views/admin/groups/edit.html.erb @@ -1,7 +1,9 @@ <% content_for :page_title, construct_page_title(t('hyku.admin.groups.title.edit'), t('hyku.admin.title')) %> -

- - <%= t('hyku.admin.groups.title.edit') %> -

+<% content_for :page_header do %> +

+ + <%= t('hyku.admin.groups.title.edit') %> +

+<% end %> <%= render 'nav' %> <%= render 'form' %> diff --git a/app/views/admin/groups/index.html.erb b/app/views/admin/groups/index.html.erb index 715fc92894..2abd0c5aed 100644 --- a/app/views/admin/groups/index.html.erb +++ b/app/views/admin/groups/index.html.erb @@ -1,8 +1,10 @@ <% content_for :page_title, construct_page_title(t('hyku.admin.groups.title.index'), t('hyku.admin.title')) %> -

- - <%= t('hyku.admin.groups.title.index') %> -

+<% content_for :page_header do %> +

+ + <%= t('hyku.admin.groups.title.index') %> +

+<% end %>
diff --git a/app/views/admin/groups/new.html.erb b/app/views/admin/groups/new.html.erb index 23d42f39df..1db98aaf98 100644 --- a/app/views/admin/groups/new.html.erb +++ b/app/views/admin/groups/new.html.erb @@ -1,8 +1,10 @@ <% content_for :page_title, construct_page_title(t('hyku.admin.groups.title.new'), t('hyku.admin.title')) %> -

- - <%= t('hyku.admin.groups.title.new') %> -

+<% content_for :page_header do %> +

+ + <%= t('hyku.admin.groups.title.new') %> +

+<% end %>
<% end %> -
- <%= f.label :title, 'Title', class: 'col-md-2 control-label required' %> -
- <%= f.text_field :title, class: 'form-control' %> - A human-friendly title for the repository. This can be changed later. -
-
<%= f.label :name, 'Short name', class: 'col-md-2 control-label' %> diff --git a/app/views/proprietor/accounts/new.html.erb b/app/views/proprietor/accounts/new.html.erb index 3ff9fabe53..86a21fd366 100644 --- a/app/views/proprietor/accounts/new.html.erb +++ b/app/views/proprietor/accounts/new.html.erb @@ -17,14 +17,6 @@
<% end %> -
- <%= f.label :title, 'Title', class: 'col-md-2 control-label required' %> -
- <%= f.text_field :title, class: 'form-control' %> - A human-friendly title for the repository. This can be changed later. -
-
-
<%= f.label :name, 'Short name', class: 'col-md-2' %>
diff --git a/db/migrate/20170502000659_remove_title_from_accounts.rb b/db/migrate/20170502000659_remove_title_from_accounts.rb new file mode 100644 index 0000000000..e32ca38a49 --- /dev/null +++ b/db/migrate/20170502000659_remove_title_from_accounts.rb @@ -0,0 +1,5 @@ +class RemoveTitleFromAccounts < ActiveRecord::Migration[5.0] + def change + remove_column :accounts, :title, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 1fb6aa2364..20beb440b5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170427003546) do +ActiveRecord::Schema.define(version: 20170502000659) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -24,7 +24,6 @@ t.integer "fcrepo_endpoint_id" t.string "name" t.integer "redis_endpoint_id" - t.string "title" t.index ["cname", "tenant"], name: "index_accounts_on_cname_and_tenant", using: :btree t.index ["fcrepo_endpoint_id"], name: "index_accounts_on_fcrepo_endpoint_id", unique: true, using: :btree t.index ["redis_endpoint_id"], name: "index_accounts_on_redis_endpoint_id", unique: true, using: :btree diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 232db5dd20..b568fa5a26 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -156,8 +156,8 @@ end it 'prevents conflicting new object saves' do - described_class.create(name: 'example', title: 'Original Example') - account2 = described_class.new(name: 'example', title: 'Fancy Example') + described_class.create(name: 'example') + account2 = described_class.new(name: 'example') expect(account2.save).to be false expect(account2.errors).to match a_hash_including(:cname) end diff --git a/spec/services/create_account_spec.rb b/spec/services/create_account_spec.rb index e94143113d..be9e02b2c3 100644 --- a/spec/services/create_account_spec.rb +++ b/spec/services/create_account_spec.rb @@ -47,8 +47,8 @@ end describe '#save' do - let(:resource1) { Account.new(name: 'example', title: 'First') } - let(:resource2) { Account.new(name: 'example', title: 'Second') } + let(:resource1) { Account.new(name: 'example') } + let(:resource2) { Account.new(name: 'example') } let(:account1) { CreateAccount.new(resource1) } let(:account2) { CreateAccount.new(resource2) } before do diff --git a/spec/views/account_sign_up/new.html.erb_spec.rb b/spec/views/account_sign_up/new.html.erb_spec.rb index 55f56a134b..cf579e202d 100644 --- a/spec/views/account_sign_up/new.html.erb_spec.rb +++ b/spec/views/account_sign_up/new.html.erb_spec.rb @@ -9,7 +9,6 @@ render assert_select "form[action=?][method=?]", account_sign_up_path, "post" do - assert_select "input#account_title[name=?]", "account[title]" assert_select "input#account_name[name=?]", "account[name]" end end diff --git a/spec/views/proprietor/accounts/new.html.erb_spec.rb b/spec/views/proprietor/accounts/new.html.erb_spec.rb index 8e0e848232..2c9b596ddf 100644 --- a/spec/views/proprietor/accounts/new.html.erb_spec.rb +++ b/spec/views/proprietor/accounts/new.html.erb_spec.rb @@ -9,7 +9,6 @@ render assert_select "form[action=?][method=?]", proprietor_accounts_path, "post" do - assert_select "input#account_title[name=?]", "account[title]" assert_select "input#account_name[name=?]", "account[name]" end end From 248c23a5319805b42369ff7c4a36da88b9633da2 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 2 May 2017 14:01:29 -0700 Subject: [PATCH 26/57] Support SOLR_URL in all 3 modes Compare to: - solr.yml, and - https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/config/blacklight.yml --- config/blacklight.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/blacklight.yml b/config/blacklight.yml index d0ec9f4423..9ea3254447 100644 --- a/config/blacklight.yml +++ b/config/blacklight.yml @@ -3,8 +3,7 @@ development: url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:#{ENV.fetch('SOLR_DEVELOPMENT_PORT', 8983)}/solr/hydra-development" %> test: &test adapter: solr - url: http://localhost:<%= ENV['SOLR_TEST_PORT'] || 8985 %>/solr/hydra-test + url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:#{ENV.fetch('SOLR_TEST_PORT', 8985)}/solr/hydra-test" %> production: adapter: solr url: <%= ENV['SOLR_URL'] || "http://127.0.0.1:8983/solr/blacklight-core" %> - From f717767f96976978e6367b04ae31051b43cc39b5 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Wed, 3 May 2017 10:48:16 -0700 Subject: [PATCH 27/57] Remove environment quotes to fix problem with newer docker engines --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index f67040ff57..ac2468812f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -90,7 +90,7 @@ services: volumes: - fcrepo:/data environment: - - JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=\"classpath:/config/minimal-default/repository.json\"" + - JAVA_OPTS=${JAVA_OPTS} -Dfcrepo.modeshape.configuration="classpath:/config/minimal-default/repository.json" networks: internal: From c176743f5e1be94402d56d3b1939c83d99339893 Mon Sep 17 00:00:00 2001 From: Gary Geisler Date: Wed, 3 May 2017 11:00:29 -0700 Subject: [PATCH 28/57] Indent admin menu submenu items --- app/assets/stylesheets/hyku.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/assets/stylesheets/hyku.scss b/app/assets/stylesheets/hyku.scss index 9c2a5e2813..099752ae84 100644 --- a/app/assets/stylesheets/hyku.scss +++ b/app/assets/stylesheets/hyku.scss @@ -101,6 +101,12 @@ footer.navbar { .h5 { padding: $nav-link-padding; } + + &.maximized { + .admin-sidebar ul > li a { + padding-left: 52px; + } + } } .panel-tab-wrapper { From 46be6a06164cd2d7d78137dc9a6b86257dc67c8c Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Wed, 3 May 2017 11:32:43 -0500 Subject: [PATCH 29/57] Update Hyrax, Blacklight and Others --- Gemfile | 2 +- Gemfile.lock | 82 +++++++++++++++++++++++++--------------------------- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/Gemfile b/Gemfile index 9ca11d8f2f..b8dd45b5b0 100644 --- a/Gemfile +++ b/Gemfile @@ -72,7 +72,7 @@ end gem 'blacklight', '~> 6.7' gem 'hyrax', git: 'https://github.com/projecthydra-labs/hyrax.git' -gem 'rsolr', '~> 1.1.2' +gem 'rsolr', '~> 1.0' gem 'devise' gem 'devise-guests', '~> 0.3' diff --git a/Gemfile.lock b/Gemfile.lock index 162540ac1e..84db3dcee2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/projecthydra-labs/hyrax.git - revision: 7a28c9b16d75386dfcbcd34deb58dc968d06d010 + revision: 02575feaee86b9b12d3f2f81fd49f8f36b4280cf specs: hyrax (2.0.0.alpha) active-fedora (>= 11.1.3) @@ -8,13 +8,12 @@ GIT active_fedora-noid (~> 2.0, >= 2.0.2) almond-rails (~> 0.1) awesome_nested_set (~> 3.1) - blacklight (~> 6.6, < 6.8.0) + blacklight (~> 6.9) blacklight-gallery (~> 0.7) breadcrumbs_on_rails (~> 3.0) browse-everything (>= 0.10.5) carrierwave (~> 1.0) clipboard-rails (~> 1.5) - daemons (~> 1.1) dry-equalizer (~> 0.2) dry-struct (~> 0.1) dry-validation (~> 0.9) @@ -46,7 +45,6 @@ GIT signet tinymce-rails (~> 4.1) tinymce-rails-imageupload (~> 4.0.17.beta) - yaml_db (~> 0.2) GEM remote: https://rubygems.org/ @@ -127,13 +125,13 @@ GEM execjs awesome_nested_set (3.1.2) activerecord (>= 4.0.0, < 5.1) - aws-sdk (2.9.11) - aws-sdk-resources (= 2.9.11) - aws-sdk-core (2.9.11) + aws-sdk (2.9.14) + aws-sdk-resources (= 2.9.14) + aws-sdk-core (2.9.14) aws-sigv4 (~> 1.0) jmespath (~> 1.0) - aws-sdk-resources (2.9.11) - aws-sdk-core (= 2.9.11) + aws-sdk-resources (2.9.14) + aws-sdk-core (= 2.9.14) aws-sigv4 (1.0.0) babel-source (5.8.35) babel-transpiler (0.7.0) @@ -141,7 +139,7 @@ GEM execjs (~> 2.0) bcrypt (3.1.11) bindex (0.5.0) - blacklight (6.7.3) + blacklight (6.9.0) bootstrap-sass (~> 3.2) deprecation globalid @@ -163,7 +161,7 @@ GEM autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) breadcrumbs_on_rails (3.0.1) - browse-everything (0.12.0) + browse-everything (0.13.0) addressable (~> 2.5) aws-sdk bootstrap-sass @@ -180,14 +178,14 @@ GEM builder (3.2.3) byebug (9.0.6) cancancan (1.16.0) - capybara (2.13.0) + capybara (2.14.0) addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - carrierwave (1.0.0) + carrierwave (1.1.0) activemodel (>= 4.0.0) activesupport (>= 4.0.0) mime-types (>= 1.16) @@ -210,7 +208,7 @@ GEM activesupport (>= 3.0) deep_merge (~> 1.1.1) connection_pool (2.2.1) - coveralls (0.8.20) + coveralls (0.8.21) json (>= 1.8, < 3) simplecov (~> 0.14.1) term-ansicolor (~> 1.3) @@ -231,7 +229,7 @@ GEM railties (>= 4.1.0, < 5.1) responders warden (~> 1.2.3) - devise-guests (0.5.0) + devise-guests (0.6.0) devise devise-i18n (1.1.2) diff-lcs (1.3) @@ -255,7 +253,7 @@ GEM dry-equalizer (~> 0.2) dry-types (~> 0.9, >= 0.9.0) ice_nine (~> 0.11) - dry-types (0.9.4) + dry-types (0.10.2) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1) dry-container (~> 0.3) @@ -263,7 +261,7 @@ GEM dry-equalizer (~> 0.2) dry-logic (~> 0.4, >= 0.4.0) inflecto (~> 0.0.0, >= 0.0.2) - dry-validation (0.10.5) + dry-validation (0.10.6) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1, >= 0.1.3) dry-core (~> 0.2, >= 0.2.1) @@ -290,8 +288,8 @@ GEM activesupport (>= 4.0) flot-rails (0.0.7) jquery-rails - font-awesome-rails (4.7.0.1) - railties (>= 3.2, < 5.1) + font-awesome-rails (4.7.0.2) + railties (>= 3.2, < 5.2) globalid (0.4.0) activesupport (>= 4.2.0) google-api-client (0.11.1) @@ -317,7 +315,7 @@ GEM tilt hamster (3.0.0) concurrent-ruby (~> 1.0) - hashdiff (0.3.2) + hashdiff (0.3.4) hiredis (0.6.1) honeybadger (2.7.2) htmlentities (4.3.4) @@ -345,7 +343,7 @@ GEM deprecation mime-types (> 2.0, < 4.0) mini_magick (>= 3.2, < 5) - hydra-editor (3.2.0) + hydra-editor (3.2.1) active-fedora (>= 9.0.0) almond-rails (~> 0.1) cancancan (~> 1.8) @@ -396,9 +394,9 @@ GEM jquery-ui-rails (5.0.5) railties (>= 3.2.16) json (2.1.0) - json-ld (2.1.2) + json-ld (2.1.3) multi_json (~> 1.12) - rdf (~> 2.1) + rdf (~> 2.2) json-schema (2.8.0) addressable (>= 2.4) jwt (1.5.6) @@ -433,13 +431,13 @@ GEM logging (2.2.2) little-plugger (~> 1.1) multi_json (~> 1.10) - lograge (0.4.1) - actionpack (>= 4, < 5.1) - activesupport (>= 4, < 5.1) - railties (>= 4, < 5.1) + lograge (0.5.0) + actionpack (>= 4, <= 5.1.0) + activesupport (>= 4, <= 5.1.0) + railties (>= 4, <= 5.1.0) loofah (2.0.3) nokogiri (>= 1.5.9) - mail (2.6.4) + mail (2.6.5) mime-types (>= 1.16, < 4) mailboxer (0.14.0) carrierwave (>= 0.5.8) @@ -515,7 +513,7 @@ GEM peek sidekiq pg (0.20.0) - poltergeist (1.14.0) + poltergeist (1.15.0) capybara (~> 2.1) cliver (~> 0.3.1) websocket-driver (>= 0.2.0) @@ -524,12 +522,13 @@ GEM powerpack (0.1.1) public_suffix (2.0.5) puma (3.8.2) - qa (1.0.0) + qa (1.1.0) activerecord-import deprecation faraday nokogiri (~> 1.6) rails (>= 4.2.0, < 6.0) + rdf rack (2.0.1) rack-protection (1.5.3) rack @@ -564,7 +563,8 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rainbow (2.2.1) + rainbow (2.2.2) + rake rake (12.0.0) rdf (2.2.6) hamster (~> 3.0) @@ -602,9 +602,10 @@ GEM declarative (< 0.1.0) declarative-option (< 0.2.0) uber (< 0.2.0) - responders (2.3.0) - railties (>= 4.2.0, < 5.1) - retriable (3.0.1) + responders (2.4.0) + actionpack (>= 4.2.0, < 5.3) + railties (>= 4.2.0, < 5.3) + retriable (3.0.2) riiif (1.4.0) railties (>= 4.2, < 6) rolify (5.1.0) @@ -654,7 +655,7 @@ GEM scss_lint (0.53.0) rake (>= 0.9, < 13) sass (~> 3.4.20) - secure_headers (3.6.2) + secure_headers (3.6.3) useragent select2-rails (3.5.10) thor (~> 0.14) @@ -681,7 +682,7 @@ GEM httmultiparty httparty (>= 0.11.0) oauth2 (>= 0.9.2) - slop (4.4.1) + slop (4.4.3) solr_wrapper (1.0.0) faraday ruby-progressbar @@ -713,14 +714,14 @@ GEM thread_safe (0.3.6) tilt (2.0.7) tins (1.13.2) - tinymce-rails (4.5.6) + tinymce-rails (4.5.7) railties (>= 3.1.1) tinymce-rails-imageupload (4.0.17.beta) railties (>= 3.2, < 6) tinymce-rails (~> 4.0) turbolinks (5.0.1) turbolinks-source (~> 5) - turbolinks-source (5.0.0) + turbolinks-source (5.0.2) twitter-typeahead-rails (0.11.1.pre.corejavascript) actionpack (>= 3.1) jquery-rails @@ -749,9 +750,6 @@ GEM xml-simple (1.1.5) xpath (2.0.0) nokogiri (~> 1.3) - yaml_db (0.5.0) - rails (>= 3.0, < 5.1) - rake (>= 0.8.7) zk (1.9.6) zookeeper (~> 1.4.0) zookeeper (1.4.11) @@ -800,7 +798,7 @@ DEPENDENCIES rails-controller-testing riiif (~> 1.1) rolify - rsolr (~> 1.1.2) + rsolr (~> 1.0) rspec rspec-rails (>= 3.6.0.beta2) rubocop (~> 0.47.0) From fe9b9ec8cfb30d4a0845864fe5072aaeb3975147 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Wed, 3 May 2017 15:30:48 -0700 Subject: [PATCH 30/57] Trim comment We don't use sqlite here, even in development. --- config/database.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/config/database.yml b/config/database.yml index 9696993d91..1cc6b32b73 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,9 +1,3 @@ -# SQLite version 3.x -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem 'sqlite3' -# default: &default adapter: postgresql pool: 5 From 1351a2f2426ee7ddb7bba07d7f1ba27cd048d7cd Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Wed, 3 May 2017 15:12:02 -0500 Subject: [PATCH 31/57] Update to rsolr 2.0 Also update iiif_manifest and faraday --- Gemfile | 4 ++-- Gemfile.lock | 17 +++++++++-------- app/models/solr_endpoint.rb | 10 ++++++++-- spec/models/solr_endpoint_spec.rb | 21 ++++++++++++++++----- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/Gemfile b/Gemfile index b8dd45b5b0..3236346b42 100644 --- a/Gemfile +++ b/Gemfile @@ -72,7 +72,7 @@ end gem 'blacklight', '~> 6.7' gem 'hyrax', git: 'https://github.com/projecthydra-labs/hyrax.git' -gem 'rsolr', '~> 1.0' +gem 'rsolr', '~> 2.0' gem 'devise' gem 'devise-guests', '~> 0.3' @@ -103,7 +103,7 @@ gem 'zk' gem 'mods', '~> 2.1' gem 'riiif', '~> 1.1' -gem 'iiif_manifest', '~> 0.1.2' +gem 'iiif_manifest', '~> 0.2.0' group :aws, :test do gem 'carrierwave-aws' diff --git a/Gemfile.lock b/Gemfile.lock index 84db3dcee2..db9160490b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -278,7 +278,7 @@ GEM factory_girl_rails (4.8.0) factory_girl (~> 4.8.0) railties (>= 3.0.0) - faraday (0.9.2) + faraday (0.11.0) multipart-post (>= 1.2, < 3) faraday_middleware (0.11.0.1) faraday (>= 0.7.4, < 1.0) @@ -368,13 +368,13 @@ GEM i18n-debug (1.1.0) i18n (< 1) ice_nine (0.11.2) - iiif-presentation (0.1.0) + iiif-presentation (0.2.0) activesupport (>= 3.2.18) - faraday (~> 0.9.0) + faraday (>= 0.9) json - iiif_manifest (0.1.2) + iiif_manifest (0.2.0) activesupport (>= 4) - iiif-presentation (~> 0.1.0) + iiif-presentation (~> 0.2.0) inflecto (0.0.2) is_it_working (1.1.0) iso-639 (0.2.8) @@ -609,8 +609,9 @@ GEM riiif (1.4.0) railties (>= 4.2, < 6) rolify (5.1.0) - rsolr (1.1.2) + rsolr (2.0.0) builder (>= 2.1.2) + faraday rspec (1.3.2) rspec-core (3.6.0.beta2) rspec-support (= 3.6.0.beta2) @@ -778,7 +779,7 @@ DEPENDENCIES honeybadger (~> 2.0) hyrax! i18n-debug - iiif_manifest (~> 0.1.2) + iiif_manifest (~> 0.2.0) is_it_working jbuilder (~> 2.0) jquery-rails @@ -798,7 +799,7 @@ DEPENDENCIES rails-controller-testing riiif (~> 1.1) rolify - rsolr (~> 1.0) + rsolr (~> 2.0) rspec rspec-rails (>= 3.6.0.beta2) rubocop (~> 0.47.0) diff --git a/app/models/solr_endpoint.rb b/app/models/solr_endpoint.rb index 326eeea2ff..a50048ac04 100644 --- a/app/models/solr_endpoint.rb +++ b/app/models/solr_endpoint.rb @@ -1,12 +1,18 @@ +# frozen_string_literal: true + class SolrEndpoint < Endpoint store :options, accessors: [:url, :collection] def connection - RSolr.connect(connection_options) + # We remove the adapter, otherwise RSolr 2 will try to use it as a Faraday middleware + RSolr.connect(connection_options.without('adapter')) end + # @return [Hash] options for the RSolr connection. def connection_options - options.reverse_merge(Blacklight.connection_config).reverse_merge(ActiveFedora::SolrService.instance.conn.options) + bl_defaults = Blacklight.connection_config + af_defaults = ActiveFedora::SolrService.instance.conn.options + options.reverse_merge(bl_defaults).reverse_merge(af_defaults) end def ping diff --git a/spec/models/solr_endpoint_spec.rb b/spec/models/solr_endpoint_spec.rb index dca12b9f83..9850fc4edf 100644 --- a/spec/models/solr_endpoint_spec.rb +++ b/spec/models/solr_endpoint_spec.rb @@ -1,16 +1,27 @@ RSpec.describe SolrEndpoint do - subject { described_class.new url: 'http://example.com/solr/' } + subject(:instance) { described_class.new url: 'http://example.com/solr/' } describe '#connection_options' do + subject(:options) { instance.connection_options } it 'merges the model attributes with the application settings' do - expect(subject.connection_options).to include url: 'http://example.com/solr/', read_timeout: 120 + expect(options).to include url: 'http://example.com/solr/', read_timeout: 120 end end describe '#connection' do - it 'initializes an RSolr connection with the model options' do - expect(subject.connection).to be_a_kind_of RSolr::Client - expect(subject.connection.uri.to_s).to eq 'http://example.com/solr/' + subject { instance.connection } + let(:result) { double } + + before do + allow(RSolr).to receive(:connect) + .with("read_timeout" => 120, + "open_timeout" => 120, + "url" => "http://example.com/solr/") + .and_return(result) + end + + it 'returns the initialized connection (without an adapter option)' do + expect(subject).to be result end end From 1a86411b4f25a6495060abfb7f1d539a45fc35ff Mon Sep 17 00:00:00 2001 From: "Michael J. Giarlo" Date: Thu, 4 May 2017 10:07:29 -0500 Subject: [PATCH 32/57] Update Hyrax. Fixes #1040. --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index db9160490b..cbf2420346 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/projecthydra-labs/hyrax.git - revision: 02575feaee86b9b12d3f2f81fd49f8f36b4280cf + revision: ea4453b464e58e0a0988228bee3653240ddba805 specs: hyrax (2.0.0.alpha) active-fedora (>= 11.1.3) From 70c2ca3946d4d4093e185db9c32282311ff6477d Mon Sep 17 00:00:00 2001 From: "Michael J. Giarlo" Date: Fri, 5 May 2017 10:52:43 -0700 Subject: [PATCH 33/57] Only show system status menu item to admins Fixes #967 --- app/presenters/hyku/menu_presenter.rb | 4 ++-- app/views/hyrax/dashboard/_sidebar.html.erb | 10 ++++++---- spec/presenters/hyku/menu_presenter_spec.rb | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/presenters/hyku/menu_presenter.rb b/app/presenters/hyku/menu_presenter.rb index 6208405fdb..6aabf15b32 100644 --- a/app/presenters/hyku/menu_presenter.rb +++ b/app/presenters/hyku/menu_presenter.rb @@ -35,8 +35,8 @@ def show_configuration? can?(:manage, Hyku::Group) end - # Returns true if we ought to show the user the 'Tasks' section of the menu - def show_tasks? + # Returns true if we ought to show the user Admin-only areas of the menu + def show_admin_menu_items? can?(:read, :admin_dashboard) end end diff --git a/app/views/hyrax/dashboard/_sidebar.html.erb b/app/views/hyrax/dashboard/_sidebar.html.erb index 8bbb2fb374..e5911713b8 100644 --- a/app/views/hyrax/dashboard/_sidebar.html.erb +++ b/app/views/hyrax/dashboard/_sidebar.html.erb @@ -21,8 +21,10 @@ <%= menu.nav_link(hyrax.dashboard_path) do %> <%= t('hyrax.admin.sidebar.activity_summary') %> <% end %> - <%= menu.nav_link(main_app.status_path) do %> - <%= t('hyrax.admin.sidebar.system_status') %> + <% if menu.show_admin_menu_items? %> + <%= menu.nav_link(main_app.status_path) do %> + <%= t('hyrax.admin.sidebar.system_status') %> + <% end %> <% end %> <% end %> @@ -61,11 +63,11 @@ <%= t('hyrax.admin.sidebar.works') %> <% end %> - <% if menu.show_tasks? %> + <% if menu.show_admin_menu_items? %>
  • <%= t('hyrax.admin.sidebar.tasks') %>
  • <% if Site.account && can?(:manage, Site.account) %> <%= menu.nav_link(main_app.edit_admin_account_path) do %> - Account + Account <% end %> <% end %> diff --git a/spec/presenters/hyku/menu_presenter_spec.rb b/spec/presenters/hyku/menu_presenter_spec.rb index d6f1a3e20a..46429b1a03 100644 --- a/spec/presenters/hyku/menu_presenter_spec.rb +++ b/spec/presenters/hyku/menu_presenter_spec.rb @@ -76,8 +76,8 @@ end end - describe "#show_tasks?" do - subject { instance.show_tasks? } + describe "#show_admin_menu_items?" do + subject { instance.show_admin_menu_items? } context "for a regular user" do before do From e9430e27cd82343fcf7ed08d051b7a78629dce35 Mon Sep 17 00:00:00 2001 From: "Michael J. Giarlo" Date: Fri, 5 May 2017 11:26:28 -0700 Subject: [PATCH 34/57] Add missing Chinese translations Fixes #1060 --- config/locales/blacklight.zh.yml | 3 + config/locales/devise.zh.yml | 8 ++ config/locales/en.yml | 2 +- config/locales/generic_work.zh.yml | 8 ++ config/locales/hyrax.zh.yml | 18 +++++ config/locales/image.zh.yml | 8 ++ config/locales/simple_form.zh.yml | 47 +++++++++++ config/locales/zh.yml | 122 +++++++++++++++++++++++++++++ 8 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 config/locales/blacklight.zh.yml create mode 100644 config/locales/devise.zh.yml create mode 100644 config/locales/generic_work.zh.yml create mode 100644 config/locales/hyrax.zh.yml create mode 100644 config/locales/image.zh.yml create mode 100644 config/locales/simple_form.zh.yml create mode 100644 config/locales/zh.yml diff --git a/config/locales/blacklight.zh.yml b/config/locales/blacklight.zh.yml new file mode 100644 index 0000000000..0d6316a0a1 --- /dev/null +++ b/config/locales/blacklight.zh.yml @@ -0,0 +1,3 @@ +zh: + blacklight: + application_name: '俳句' diff --git a/config/locales/devise.zh.yml b/config/locales/devise.zh.yml new file mode 100644 index 0000000000..f4b87743d8 --- /dev/null +++ b/config/locales/devise.zh.yml @@ -0,0 +1,8 @@ +zh: + devise: + registrations: + new: + sign_up: 创建帐号 + sign_up_header: 创建一个新账户 + shared: + sign_up: 创建帐号 diff --git a/config/locales/en.yml b/config/locales/en.yml index 91d9012d6e..054857e756 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -77,7 +77,7 @@ en: failure: 'Group could not be created' update: success: '%{group} updated' - failure: '%{group} could not be updated updated' + failure: '%{group} could not be updated' destroy: success: '%{group} destroyed' failure: '%{group} could not be destroyed' diff --git a/config/locales/generic_work.zh.yml b/config/locales/generic_work.zh.yml new file mode 100644 index 0000000000..4f4707e981 --- /dev/null +++ b/config/locales/generic_work.zh.yml @@ -0,0 +1,8 @@ +zh: + hyrax: + icons: + generic_work: 'fa fa-file-text-o' + select_type: + generic_work: + name: "通用工作" + description: "通用工作类型。 如果下面的更具体的工作类型不适合您要添加的工作,请选择此项。" diff --git a/config/locales/hyrax.zh.yml b/config/locales/hyrax.zh.yml new file mode 100644 index 0000000000..455a31a04f --- /dev/null +++ b/config/locales/hyrax.zh.yml @@ -0,0 +1,18 @@ +zh: + hyrax: + product_name: "俳句" + product_twitter_handle: "@HydraInABox" + institution_name: "机构" + institution_name_full: "机构名称" + account_name: "我的机构帐户标识符" + directory: + suffix: "@hydrainabox.org" + footer: + copyright_html: "版权所有 © 2017 Project Hydra 根据Apache许可证2.0版许可" + service_html: 的服务Hydra项目. + simple_form: + hints: + defaults: + extent: "工作的程度(大小,持续时间,数量等)。" + labels: + extent: "程度" diff --git a/config/locales/image.zh.yml b/config/locales/image.zh.yml new file mode 100644 index 0000000000..1db0f94d21 --- /dev/null +++ b/config/locales/image.zh.yml @@ -0,0 +1,8 @@ +zh: + hyrax: + icons: + image: 'fa fa-picture-o' + select_type: + image: + name: "图片" + description: "单页或多页图像工作。" diff --git a/config/locales/simple_form.zh.yml b/config/locales/simple_form.zh.yml new file mode 100644 index 0000000000..4b90e2d794 --- /dev/null +++ b/config/locales/simple_form.zh.yml @@ -0,0 +1,47 @@ +zh: + simple_form: + "yes": '是' + "no": '没有' + cancel: '取消' + required: + text: '需要' + mark: '*' + # You can uncomment the line below if you need to overwrite the whole required html. + # When using html, text and mark won't be used. + # html: '*' + error_notification: + default_message: "请查看以下问题:" + # Examples + labels: + hyku_group: + description: '描述' + group_search: + q: '搜索' + user_search: + uq: '搜索用户' + add_user_to_group: + user_ids: '用户名' + page_size: + per: '显示' + # defaults: + # password: 'Password' + # user: + # new: + # email: 'E-mail to sign in.' + # edit: + # email: 'E-mail.' + hints: + hyku_group: + description: '小组角色的简要总结' + # defaults: + # username: 'User name to sign in.' + # password: 'No special characters, please.' + # include_blanks: + # defaults: + # age: 'Rather not say' + # prompts: + # defaults: + # age: 'Select your age' + placeholders: + user_search: + uq: '名称或用户名' diff --git a/config/locales/zh.yml b/config/locales/zh.yml new file mode 100644 index 0000000000..0c7ea6c7ea --- /dev/null +++ b/config/locales/zh.yml @@ -0,0 +1,122 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + +zh: + application: + tagline: 下一代存储库解决方案 + activerecord: + attributes: + site: + institution_name_full: 完整的机构名称 + status: + index: + services: '服务' + service: + ok: '好' + down: '下' + helpers: + submit: + add_user_to_group: + submit: '加' + group_search: + submit: '走' + page_size: + submit: '更新' + revoke_membership: + submit: '去掉' + user_search: + submit: '走' + hyku: + footer: + admin_login: '管理员登录' + proprietor: + accounts: + nav: '帐号' + admin: + title: '行政' + flash: + access_denied: '您无权查看此页面' + groups: + describe_quantity_html: "此存储库中有%{number}组。" + describe_singular_quantity_html: "此存储库中有 1组。" + action: + create: '创建新组' + edit: '编辑组和用户' + members: + description: '组成员承担分配给此组的所有权限。' + per_page: '更新' + remove: + confirmation: '您确定要移除此群组吗?' + description: '这个行动是不可逆转的。 它将删除通过此组分配的组成员的所有权限。' + submit: '去掉' + search: + clear: '重启' + flash: + create: + success: '%{group}创建' + invalid: '组必须有一个名称' + failure: '无法创建组' + update: + success: '%{group}更新' + failure: '%{group}无法更新' + destroy: + success: '%{group}销毁' + failure: '%{group}不能被毁灭' + label: + actions: '操作' + created_at: '创建日期' + members: '用户' + name: '名称' + per_page: '每页' + nav: + attributes: '描述' + delete: '去掉' + index: '返回管理组' + members: '用户' + title: + add_user: '将用户添加到组' + delete: '删除组 "%{group}"' + edit: '编辑组' + index: '管理组' + list_members: '当前组成员' + members: '小组成员' + new: '新组' + remove: '删除组' + users: + label: + name: '名称' + user_key: '用户名' + date_joined: '加盟' + last_login: '最后访问' + hyrax: + admin: + sidebar: + accounts: '帐号' + activity_summary: '活动摘要' + content_blocks: '内容块' + labels: '标签' + manage_groups: '管理组' + manage_roles_and_permissions: '定义角色和权限' + manage_users: '管理用户' + repository_activity: '存储库活动' + roles_and_permissions: '用户和组' + system_status: '系统状态' + technical: '技术' From b845bc81e94e9e829e6b173660e3dd65b75f2ed7 Mon Sep 17 00:00:00 2001 From: "Michael J. Giarlo" Date: Sat, 6 May 2017 09:34:57 -0700 Subject: [PATCH 35/57] Update Hyrax and pull in new Blacklight translations from latest Hyrax --- Gemfile.lock | 33 +++++++++++++------------ config/locales/blacklight.en.yml | 42 ++++++++++++++++++++++++++++++++ config/locales/blacklight.es.yml | 42 ++++++++++++++++++++++++++++++++ config/locales/blacklight.zh.yml | 42 ++++++++++++++++++++++++++++++++ 4 files changed, 143 insertions(+), 16 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cbf2420346..acb1b4fb86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/projecthydra-labs/hyrax.git - revision: ea4453b464e58e0a0988228bee3653240ddba805 + revision: 993b9d0d8e37669c7779204a1c08a93f2f1205e4 specs: hyrax (2.0.0.alpha) active-fedora (>= 11.1.3) @@ -104,7 +104,7 @@ GEM activemodel (= 5.0.2) activesupport (= 5.0.2) arel (~> 7.0) - activerecord-import (0.18.1) + activerecord-import (0.18.2) activerecord (>= 3.2) activesupport (5.0.2) concurrent-ruby (~> 1.0, >= 1.0.2) @@ -121,17 +121,17 @@ GEM arel (7.1.4) ast (2.3.0) atomic (1.1.99) - autoprefixer-rails (6.7.7.2) + autoprefixer-rails (7.0.0) execjs - awesome_nested_set (3.1.2) - activerecord (>= 4.0.0, < 5.1) - aws-sdk (2.9.14) - aws-sdk-resources (= 2.9.14) - aws-sdk-core (2.9.14) + awesome_nested_set (3.1.3) + activerecord (>= 4.0.0, < 5.2) + aws-sdk (2.9.15) + aws-sdk-resources (= 2.9.15) + aws-sdk-core (2.9.15) aws-sigv4 (~> 1.0) jmespath (~> 1.0) - aws-sdk-resources (2.9.14) - aws-sdk-core (= 2.9.14) + aws-sdk-resources (2.9.15) + aws-sdk-core (= 2.9.15) aws-sigv4 (1.0.0) babel-source (5.8.35) babel-transpiler (0.7.0) @@ -241,19 +241,20 @@ GEM dry-container (0.6.0) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.2.4) + dry-core (0.3.0) concurrent-ruby (~> 1.0) dry-equalizer (0.2.0) dry-logic (0.4.1) dry-container (~> 0.2, >= 0.2.6) dry-core (~> 0.2) dry-equalizer (~> 0.2) - dry-struct (0.2.1) + dry-struct (0.3.0) dry-configurable (~> 0.1) + dry-core (~> 0.3) dry-equalizer (~> 0.2) dry-types (~> 0.9, >= 0.9.0) ice_nine (~> 0.11) - dry-types (0.10.2) + dry-types (0.10.3) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1) dry-container (~> 0.3) @@ -292,7 +293,7 @@ GEM railties (>= 3.2, < 5.2) globalid (0.4.0) activesupport (>= 4.2.0) - google-api-client (0.11.1) + google-api-client (0.11.2) addressable (>= 2.5.1) googleauth (~> 0.5) httpclient (>= 2.8.1, < 3.0) @@ -343,7 +344,7 @@ GEM deprecation mime-types (> 2.0, < 4.0) mini_magick (>= 3.2, < 5) - hydra-editor (3.2.1) + hydra-editor (3.3.1) active-fedora (>= 9.0.0) almond-rails (~> 0.1) cancancan (~> 1.8) @@ -715,7 +716,7 @@ GEM thread_safe (0.3.6) tilt (2.0.7) tins (1.13.2) - tinymce-rails (4.5.7) + tinymce-rails (4.6.0) railties (>= 3.1.1) tinymce-rails-imageupload (4.0.17.beta) railties (>= 3.2, < 6) diff --git a/config/locales/blacklight.en.yml b/config/locales/blacklight.en.yml index 4da353be2c..691cfef205 100644 --- a/config/locales/blacklight.en.yml +++ b/config/locales/blacklight.en.yml @@ -1,3 +1,45 @@ en: blacklight: application_name: 'Hyku' + search: + fields: + facet: + based_near_sim: Location + creator_sim: Creator + file_format_sim: Format + generic_type_sim: Type + keyword_sim: Keyword + language_sim: Language + publisher_sim: Publisher + subject_sim: Subject + index: + based_near_tesim: Location + contributor_tesim: Contributor + creator_tesim: Creator + date_created_tesim: Date Created + date_modified_dtsi: Date Modified + date_uploaded_dtsi: Date Uploaded + description_tesim: Description + file_format_tesim: File Format + identifier_tesim: Identifier + keyword_tesim: Keyword + language_tesim: Language + publisher_tesim: Publisher + rights_tesim: Rights + subject_tesim: Subject + show: + based_near_tesim: Location + contributor_tesim: Contributor + creator_tesim: Creator + date_created_tesim: Date Created + date_modified_dtsi: Date Modified + date_uploaded_dtsi: Date Uploaded + description_tesim: Description + file_format_tesim: File Format + identifier_tesim: Identifier + keyword_tesim: Keyword + language_tesim: Language + publisher_tesim: Publisher + rights_tesim: Rights + subject_tesim: Subject + title_tesim: Title diff --git a/config/locales/blacklight.es.yml b/config/locales/blacklight.es.yml index 41cee9f54c..8c226dac67 100644 --- a/config/locales/blacklight.es.yml +++ b/config/locales/blacklight.es.yml @@ -1,3 +1,45 @@ es: blacklight: application_name: 'Hyku' + search: + fields: + facet: + based_near_sim: Ubicación + creator_sim: Creador + file_format_sim: Formato + generic_type_sim: Tipo + keyword_sim: Palabra clave + language_sim: Idioma + publisher_sim: Editor + subject_sim: Tema + index: + based_near_tesim: Ubicación + contributor_tesim: Contribuidor + creator_tesim: Creador + date_created_tesim: Fecha de Creacion + date_modified_dtsi: Fecha Modificada + date_uploaded_dtsi: Fecha de Subida + description_tesim: Descripción + file_format_tesim: Formato de Archivo + identifier_tesim: Identificador + keyword_tesim: Palabra clave + language_tesim: Idioma + publisher_tesim: Editor + rights_tesim: Derechos + subject_tesim: Tema + show: + based_near_tesim: Ubicación + contributor_tesim: Contribuidor + creator_tesim: Creador + date_created_tesim: Fecha de Creacion + date_modified_dtsi: Fecha Modificada + date_uploaded_dtsi: Fecha de Subida + description_tesim: Descripción + file_format_tesim: Formato de Archivo + identifier_tesim: Identificador + keyword_tesim: Palabra clave + language_tesim: Idioma + publisher_tesim: Editor + rights_tesim: Derechos + subject_tesim: Tema + title_tesim: Título diff --git a/config/locales/blacklight.zh.yml b/config/locales/blacklight.zh.yml index 0d6316a0a1..668d1b181b 100644 --- a/config/locales/blacklight.zh.yml +++ b/config/locales/blacklight.zh.yml @@ -1,3 +1,45 @@ zh: blacklight: application_name: '俳句' + search: + fields: + facet: + based_near_sim: 位置 + creator_sim: 创造者 + file_format_sim: 文件格式 + generic_type_sim: 类型 + keyword_sim: 关键词 + language_sim: 语言 + publisher_sim: 出版者 + subject_sim: 学科 + index: + based_near_tesim: 位置 + contributor_tesim: 贡献者 + creator_tesim: 创造者 + date_created_tesim: 创建日期 + date_modified_dtsi: 修改日期 + date_uploaded_dtsi: 日期上传 + description_tesim: 描述 + file_format_tesim: 文件格式 + identifier_tesim: 识别码 + keyword_tesim: 关键词 + language_tesim: 语言 + publisher_tesim: 出版者 + rights_tesim: 权 + subject_tesim: 学科 + show: + based_near_tesim: 位置 + contributor_tesim: 贡献者 + creator_tesim: 创造者 + date_created_tesim: 创建日期 + date_modified_dtsi: 修改日期 + date_uploaded_dtsi: 日期上传 + description_tesim: 描述 + file_format_tesim: 文件格式 + identifier_tesim: 识别码 + keyword_tesim: 关键词 + language_tesim: 语言 + publisher_tesim: 出版者 + rights_tesim: 权 + subject_tesim: 学科 + title_tesim: 标题 From b29ab3272ad3ae78cdb46971f40969835f9d70e8 Mon Sep 17 00:00:00 2001 From: "Darren L. Weber, Ph.D" Date: Mon, 8 May 2017 11:06:35 -0700 Subject: [PATCH 36/57] User - remove comment reference to account --- app/models/user.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index f8f415fe42..16e79d1037 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -18,8 +18,7 @@ class User < ActiveRecord::Base before_create :add_default_roles # Method added by Blacklight; Blacklight uses #to_s on your - # user class to get a user-displayable login/identifier for - # the account. + # user class to get a user-displayable login/identifier. def to_s email end From 9a0ae1b7e1e01bc7d8fb351f4ec1d77e7b896eea Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Mon, 8 May 2017 13:32:03 -0700 Subject: [PATCH 37/57] Configure tenant-specific upload paths when running under multitenancy --- config/initializers/hyrax.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/initializers/hyrax.rb b/config/initializers/hyrax.rb index 1e62cad978..2307c82629 100644 --- a/config/initializers/hyrax.rb +++ b/config/initializers/hyrax.rb @@ -97,7 +97,9 @@ # Temporary path to hold uploads before they are ingested into FCrepo. # This must be a lambda that returns a Pathname - # config.upload_path = ->() { Rails.root + 'tmp' + 'uploads' } + if Settings.multitenancy.enabled + config.upload_path = ->() { Rails.root + 'tmp' + 'uploads' + Apartment::Tenant.current } + end # Location on local file system where derivatives will be stored. # If you use a multi-server architecture, this MUST be a shared volume. From 1cbf2c3ae60142ec0d6f010783f6103f721b6bb2 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Mon, 8 May 2017 13:33:30 -0700 Subject: [PATCH 38/57] Use an S3 bucket file path that doesn't start with a slash --- config/initializers/hyrax.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/initializers/hyrax.rb b/config/initializers/hyrax.rb index 2307c82629..a924903502 100644 --- a/config/initializers/hyrax.rb +++ b/config/initializers/hyrax.rb @@ -98,7 +98,13 @@ # Temporary path to hold uploads before they are ingested into FCrepo. # This must be a lambda that returns a Pathname if Settings.multitenancy.enabled - config.upload_path = ->() { Rails.root + 'tmp' + 'uploads' + Apartment::Tenant.current } + config.upload_path = ->() do + if Settings.s3.upload_bucket + "uploads/#{Apartment::Tenant.current}" + else + Rails.root + 'tmp' + 'uploads' + Apartment::Tenant.current + end + end end # Location on local file system where derivatives will be stored. From 4469d3fa7d5a11dd12429f609b255ed80fb48a35 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Wed, 3 May 2017 22:13:41 -0500 Subject: [PATCH 39/57] Update to jquery3 --- app/assets/javascripts/application.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index d169de1d07..2bcdd3eb96 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -10,7 +10,7 @@ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // -//= require jquery +//= require jquery3 //= require jquery_ujs //= require dataTables/jquery.dataTables //= require dataTables/bootstrap/3/jquery.dataTables.bootstrap From a6df61e0f498082c20a0cbc733830258364df830 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Mon, 8 May 2017 13:54:18 -0700 Subject: [PATCH 40/57] Test with Ruby 2.4.1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 20f7f724c0..f24d363925 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ notifications: email: false dist: trusty rvm: - - 2.4.0 + - 2.4.1 # We provide AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY encrypted by travis here env: From 11f25bb42b278d29ec95ab88bc303351bac9f5b4 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 8 May 2017 14:06:07 -0700 Subject: [PATCH 41/57] Test methods individually Because these have bearing on our rails-level detection for unique cname. See: https://github.com/projecthydra-labs/hyku/issues/1012#issuecomment-297899330 --- app/models/account.rb | 8 +++++--- spec/models/account_spec.rb | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index 06c560900a..250d78d7df 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -2,19 +2,21 @@ class Account < ActiveRecord::Base # @param [String] piece the tenant piece of the canonical name # @return [String] full canonical name + # @raise [ArgumentError] if piece contains a trailing dot # @see Settings.multitenancy.default_host def self.default_cname(piece) return unless piece + raise ArgumentError, "param '#{piece}' must not contain trailing dots" if piece =~ /\.\Z/ default_host = Settings.multitenancy.default_host || "%{tenant}.#{admin_host}" - format(default_host, tenant: piece.parameterize) + canonical_cname(format(default_host, tenant: piece.parameterize)) end # Canonicalize the account cname or request host for comparison # @param [String] cname distinct part of host name # @return [String] canonicalized host name def self.canonical_cname(cname) - # DNS host names are case-insensitive. Convert complete domain names to relative names. - cname &&= cname.downcase.sub(/\.\Z/, '') + # DNS host names are case-insensitive. Trim trailing dot(s). + cname &&= cname.downcase.sub(/\.*\Z/, '') cname end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index b568fa5a26..de37830cb0 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -13,6 +13,28 @@ end end + describe '.default_cname' do + it 'chokes on trailing dots' do + expect { described_class.default_cname('foobar.') }.to raise_error ArgumentError + # Important because we otherwise allow cname collision by treating "foobar." and "foobar-" equivalently + end + + it 'returns canonicalized value' do + allow(Settings.multitenancy).to receive(:default_host).and_return("%{tenant}.DEMO.hydrainabox.org.") + expect(described_class.default_cname('foobar')).to eq 'foobar.demo.hydrainabox.org' + expect(described_class.default_cname('fooBAR')).to eq 'foobar.demo.hydrainabox.org' + expect(described_class.default_cname('ONE.two.3')).to eq 'one-two-3.demo.hydrainabox.org' + end + end + + describe '.canonical_cname' do + it 'lowercases and strips trailing dots' do + expect(described_class.canonical_cname('foobar')).to eq 'foobar' + expect(described_class.canonical_cname('fooBAR...')).to eq 'foobar' + expect(described_class.canonical_cname('ONE.two.3')).to eq 'one.two.3' + end + end + describe '.admin_host' do it 'uses the configured setting' do allow(Settings.multitenancy).to receive(:admin_host).and_return('admin-host') From faac222aa569a46d360a54a3adf15733b9ec5191 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 8 May 2017 17:59:44 -0700 Subject: [PATCH 42/57] DB constraint on cname for uniqueness --- ...70509005132_add_index_to_accounts_cname.rb | 5 ++++ db/schema.rb | 3 ++- spec/models/account_spec.rb | 23 +++++++++++++------ 3 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 db/migrate/20170509005132_add_index_to_accounts_cname.rb diff --git a/db/migrate/20170509005132_add_index_to_accounts_cname.rb b/db/migrate/20170509005132_add_index_to_accounts_cname.rb new file mode 100644 index 0000000000..2acf0022c6 --- /dev/null +++ b/db/migrate/20170509005132_add_index_to_accounts_cname.rb @@ -0,0 +1,5 @@ +class AddIndexToAccountsCname < ActiveRecord::Migration[5.0] + def change + add_index :accounts, :cname, unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 20beb440b5..ea97ab63db 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170502000659) do +ActiveRecord::Schema.define(version: 20170509005132) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -25,6 +25,7 @@ t.string "name" t.integer "redis_endpoint_id" t.index ["cname", "tenant"], name: "index_accounts_on_cname_and_tenant", using: :btree + t.index ["cname"], name: "index_accounts_on_cname", unique: true, using: :btree t.index ["fcrepo_endpoint_id"], name: "index_accounts_on_fcrepo_endpoint_id", unique: true, using: :btree t.index ["redis_endpoint_id"], name: "index_accounts_on_redis_endpoint_id", unique: true, using: :btree t.index ["solr_endpoint_id"], name: "index_accounts_on_solr_endpoint_id", unique: true, using: :btree diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index de37830cb0..65c16c45b3 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -159,13 +159,21 @@ end end - it 'prevents duplicate cname and tenant values' do - account1 = described_class.create(name: 'example', tenant: 'example_tenant', cname: 'example.dev') - account2 = described_class.create(name: 'example', tenant: 'example_tenant', cname: 'example.dev') - expect(account1.errors).to be_empty - expect(account2.errors).not_to be_empty - expect(account2.errors.messages).to match a_hash_including(:tenant, :cname) - expect(account2.errors.messages).not_to include(:name) + describe 'prevents duplicate cname and tenant values' do + let!(:account1) { described_class.create(name: 'example', tenant: 'example_tenant', cname: 'example.dev') } + it 'on create' do + account2 = described_class.create(name: 'example', tenant: 'example_tenant', cname: 'example.dev') + expect(account1.errors).to be_empty + expect(account2.errors).not_to be_empty + expect(account2.errors.messages).to match a_hash_including(:tenant, :cname) + expect(account2.errors.messages).not_to include(:name) + end + it 'on save' do + account2 = described_class.new(tenant: 'other_tenant', cname: account1.cname) + expect(account2.save).to be_falsey + expect(account2.errors).not_to be_empty + expect(account2.errors.messages).to match a_hash_including(:cname) + end end it 'prevents duplicate cname from only name' do @@ -190,6 +198,7 @@ it 'solr_endpoint' do account2 = described_class.new(name: 'other', solr_endpoint: endpoint) expect { account2.save }.to raise_error(ActiveRecord::RecordNotUnique) + # Note: this is different than just populating account2.errors, because it is a FK end end end From a8753fdc1bed98abd0b78721a95f52ccc998a3f3 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 9 May 2017 08:03:14 -0700 Subject: [PATCH 43/57] Revert "Fix extra space below top bar" This reverts commit a40366b50242adb88f9a2f851912eb8ee444b74c. --- app/assets/stylesheets/hyku.scss | 13 +++++++++++++ app/assets/stylesheets/variables.scss | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/hyku.scss b/app/assets/stylesheets/hyku.scss index 099752ae84..fb54fd770b 100644 --- a/app/assets/stylesheets/hyku.scss +++ b/app/assets/stylesheets/hyku.scss @@ -1,4 +1,16 @@ #masthead { + @media (min-width: $screen-sm-min) { + &.navbar { + min-height: 35px; + } + + .navbar-nav > li > a, + .navbar-brand { + height: 35px; + padding-top: 7.5px; + } + } + #logo { margin-left: 10px; } @@ -12,6 +24,7 @@ } } + .jumbotron { background: image_url('white-cloud-background.jpg') repeat-x; background-color: $gray-lighter; diff --git a/app/assets/stylesheets/variables.scss b/app/assets/stylesheets/variables.scss index 393891c328..78d355674f 100644 --- a/app/assets/stylesheets/variables.scss +++ b/app/assets/stylesheets/variables.scss @@ -9,5 +9,3 @@ $jumbotron-button-background-color: #7ab55c; $features-section-background-color: #f4f4f4; $features-section-border-color: #ddd; - -$navbar-height: 35px; From a340658bd86e9a570b3d76a4b8f397648e43f2fb Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 9 May 2017 08:05:12 -0700 Subject: [PATCH 44/57] Use a 50px top nav bar --- app/assets/stylesheets/hyku.scss | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/app/assets/stylesheets/hyku.scss b/app/assets/stylesheets/hyku.scss index fb54fd770b..0dbb740438 100644 --- a/app/assets/stylesheets/hyku.scss +++ b/app/assets/stylesheets/hyku.scss @@ -1,16 +1,4 @@ #masthead { - @media (min-width: $screen-sm-min) { - &.navbar { - min-height: 35px; - } - - .navbar-nav > li > a, - .navbar-brand { - height: 35px; - padding-top: 7.5px; - } - } - #logo { margin-left: 10px; } From 0de209a9283f8a97706dff5680765b1d370b3e49 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 9 May 2017 11:11:19 -0700 Subject: [PATCH 45/57] Remove `SETTINGS__MULTITENANCY__ENABLED` setting Not only is the docker-ified application not set up for that, it is interpreted in railsconfig-land as the string `"false"` (which is truth-y) --- docker-compose.base.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.base.yml b/docker-compose.base.yml index 5ac3cd25b8..3113322fe1 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -25,7 +25,6 @@ services: - SETTINGS__ACTIVE_JOB__QUEUE_ADAPTER=sidekiq - SETTINGS__SOLR__URL=http://solr:8983/solr/ - SETTINGS__ZOOKEEPER__CONNECTION_STR=zookeeper_cluster:2181/configs - - SETTINGS__MULTITENANCY__ENABLED=false - RAILS_ENV=production - RAILS_SERVE_STATIC_FILES=true - RAILS_LOG_TO_STDOUT=true From 2618eef5778ac28a917920ebfd0a456464037511 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 9 May 2017 11:19:06 -0700 Subject: [PATCH 46/57] Update to fits 1.1.0 --- .ebextensions/fits.config | 6 +++--- Dockerfile | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.ebextensions/fits.config b/.ebextensions/fits.config index 940d7d8fcb..f139b0004d 100644 --- a/.ebextensions/fits.config +++ b/.ebextensions/fits.config @@ -1,8 +1,8 @@ sources: - /opt/fits: http://s3.amazonaws.com/hybox-deployment-artifacts/fits-0.10.2.zip + /opt/fits: http://s3.amazonaws.com/hybox-deployment-artifacts/fits-1.1.0.zip container_commands: 01_symlink_fits: - command: ln -sf /opt/fits/fits-0.10.2/fits.sh /usr/local/bin/fits.sh + command: ln -sf /opt/fits/fits-1.1.0/fits.sh /usr/local/bin/fits.sh 02_chmod_fits: - command: chmod a+x /opt/fits/fits-0.10.2/*.sh + command: chmod a+x /opt/fits/fits-1.1.0/*.sh diff --git a/Dockerfile b/Dockerfile index 917424ab65..617879be39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ RUN apt-get update -qq && \ apt-get install -y build-essential libpq-dev nodejs libreoffice imagemagick unzip && \ rm -rf /var/lib/apt/lists/* RUN mkdir -p /opt/fits && \ - curl -fSL -o /opt/fits-0.6.2.zip http://projects.iq.harvard.edu/files/fits/files/fits-0.6.2.zip && \ - cd /opt && unzip fits-0.6.2.zip && chmod +X fits-0.6.2/fits.sh + curl -fSL -o /opt/fits-1.1.0.zip http://projects.iq.harvard.edu/files/fits/files/fits-1.1.0.zip && \ + cd /opt && unzip fits-1.1.0.zip && chmod +X fits-1.1.0/fits.sh RUN mkdir /data WORKDIR /data @@ -14,4 +14,3 @@ RUN bundle install ADD . /data RUN bundle exec rake assets:precompile EXPOSE 3000 - From 17e62c20fa55828c2c9282d1bd96563558a1d77d Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 9 May 2017 11:42:33 -0700 Subject: [PATCH 47/57] Update docker to use fcrepo 4.7 --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ac2468812f..7d4cbe6aa0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,13 +84,13 @@ services: internal: fcrepo: - image: cbeer/fcrepo4 + image: cbeer/fcrepo4:4.7 expose: - 8983 volumes: - fcrepo:/data environment: - - JAVA_OPTS=${JAVA_OPTS} -Dfcrepo.modeshape.configuration="classpath:/config/minimal-default/repository.json" + - JAVA_OPTS=${JAVA_OPTS} -Dfcrepo.modeshape.configuration="classpath:/config/file-simple/repository.json" -Dfcrepo.object.directory="/data/objects" -Dfcrepo.binary.directory="/data/binaries" networks: internal: From 2ad3694b0be4c12fc8756ef1f9cb2b13517bcb4e Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 9 May 2017 12:34:59 -0700 Subject: [PATCH 48/57] Check for well-formedness of account object before switching --- app/models/account.rb | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index 250d78d7df..3e6800fa01 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -62,9 +62,10 @@ def self.single_tenant_default # Make all the account specific connections active def switch! - solr_endpoint.switch! if solr_endpoint - fcrepo_endpoint.switch! if fcrepo_endpoint - redis_endpoint.switch! if redis_endpoint + confirm_endpoints! + solr_endpoint.switch! + fcrepo_endpoint.switch! + redis_endpoint.switch! end def switch @@ -74,14 +75,22 @@ def switch reset! end + # does not use confirm_endpoints! because we can still nil-ify settings def reset! - solr_endpoint.reset! if solr_endpoint - fcrepo_endpoint.reset! if fcrepo_endpoint - redis_endpoint.reset! if redis_endpoint + solr_endpoint.reset! + fcrepo_endpoint.reset! + redis_endpoint.reset! end private + # @raise [RuntimeError] if missing any endpoint + def confirm_endpoints! + raise "Account #{cname} is missing solr_endpoint, cannot switch!" unless solr_endpoint + raise "Account #{cname} is missing fcrepo_endpoint, cannot switch!" unless fcrepo_endpoint + raise "Account #{cname} is missing redis_endpoint, cannot switch!" unless redis_endpoint + end + def default_cname(piece = name) self.class.default_cname(piece) end From 76c3be4da5e8bb5c874fbcfa3adf1465a46a2c4f Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Tue, 9 May 2017 17:12:31 -0700 Subject: [PATCH 49/57] Convert Endpoint instance method `reset!` to class method Because nothing the methods do relies on instance data. Therefore, accessing them shouldn't require, e.g., the `SolrEndpoint` object. Thus `@account.reset!` doesn't require checking for Account well-formedness. --- app/models/account.rb | 6 +++--- app/models/fcrepo_endpoint.rb | 2 +- app/models/redis_endpoint.rb | 2 +- app/models/solr_endpoint.rb | 2 +- spec/models/account_spec.rb | 12 +++++++++++- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index 3e6800fa01..e83b338085 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -77,9 +77,9 @@ def switch # does not use confirm_endpoints! because we can still nil-ify settings def reset! - solr_endpoint.reset! - fcrepo_endpoint.reset! - redis_endpoint.reset! + SolrEndpoint.reset! + FcrepoEndpoint.reset! + RedisEndpoint.reset! end private diff --git a/app/models/fcrepo_endpoint.rb b/app/models/fcrepo_endpoint.rb index afc2240976..719be1178a 100644 --- a/app/models/fcrepo_endpoint.rb +++ b/app/models/fcrepo_endpoint.rb @@ -5,7 +5,7 @@ def switch! ActiveFedora::Fedora.register(options.symbolize_keys) end - def reset! + def self.reset! ActiveFedora::Fedora.reset! end diff --git a/app/models/redis_endpoint.rb b/app/models/redis_endpoint.rb index 53f50ec4d7..1ff5416935 100644 --- a/app/models/redis_endpoint.rb +++ b/app/models/redis_endpoint.rb @@ -6,7 +6,7 @@ def switch! end # Reset the Redis namespace back to the default value - def reset! + def self.reset! Hyrax.config.redis_namespace = Settings.redis.default_namespace end diff --git a/app/models/solr_endpoint.rb b/app/models/solr_endpoint.rb index a50048ac04..b612c495f3 100644 --- a/app/models/solr_endpoint.rb +++ b/app/models/solr_endpoint.rb @@ -27,7 +27,7 @@ def switch! Blacklight.default_index = nil end - def reset! + def self.reset! ActiveFedora::SolrService.reset! Blacklight.connection_config = nil Blacklight.default_index = nil diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index de37830cb0..bbfe69abef 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -98,6 +98,10 @@ subject.switch! end + after do + subject.reset! + end + it 'switches to the account-specific connection' do subject.switch do expect(ActiveFedora::SolrService.instance.conn.uri.to_s).to eq 'http://example.com/solr/' @@ -111,11 +115,17 @@ subject.switch do # no-op end - expect(ActiveFedora::SolrService.instance.conn.uri.to_s).to eq 'http://127.0.0.1:8985/solr/hydra-test/' expect(ActiveFedora.fedora.host).to eq 'http://127.0.0.1:8986/rest' expect(Hyrax.config.redis_namespace).to eq previous_redis_namespace end + + context 'with missing endpoint' do + it 'throws exception on switch!' do + subject.solr_endpoint = nil + expect { subject.switch! }.to raise_error(RuntimeError) + end + end end describe '#save' do From 77f5394b75be5680c8001d77342450ccb57b9ed9 Mon Sep 17 00:00:00 2001 From: "Michael J. Giarlo" Date: Wed, 10 May 2017 09:54:18 -0700 Subject: [PATCH 50/57] Update Hyrax and other deps --- Gemfile.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index acb1b4fb86..4186c8a156 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/projecthydra-labs/hyrax.git - revision: 993b9d0d8e37669c7779204a1c08a93f2f1205e4 + revision: 1d0bd8ff9149e496a5d52301fa1ca5aa8d33bcc4 specs: hyrax (2.0.0.alpha) active-fedora (>= 11.1.3) @@ -121,17 +121,17 @@ GEM arel (7.1.4) ast (2.3.0) atomic (1.1.99) - autoprefixer-rails (7.0.0) + autoprefixer-rails (7.0.1) execjs awesome_nested_set (3.1.3) activerecord (>= 4.0.0, < 5.2) - aws-sdk (2.9.15) - aws-sdk-resources (= 2.9.15) - aws-sdk-core (2.9.15) + aws-sdk (2.9.16) + aws-sdk-resources (= 2.9.16) + aws-sdk-core (2.9.16) aws-sigv4 (~> 1.0) jmespath (~> 1.0) - aws-sdk-resources (2.9.15) - aws-sdk-core (= 2.9.15) + aws-sdk-resources (2.9.16) + aws-sdk-core (= 2.9.16) aws-sigv4 (1.0.0) babel-source (5.8.35) babel-transpiler (0.7.0) @@ -161,7 +161,7 @@ GEM autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) breadcrumbs_on_rails (3.0.1) - browse-everything (0.13.0) + browse-everything (0.13.1) addressable (~> 2.5) aws-sdk bootstrap-sass @@ -451,7 +451,7 @@ GEM mimemagic (0.3.2) mini_magick (4.7.0) mini_portile2 (2.1.0) - minitest (5.10.1) + minitest (5.10.2) mods (2.1.0) iso-639 nokogiri @@ -463,7 +463,7 @@ GEM redic nio4r (2.0.0) noid (0.9.0) - nokogiri (1.7.1) + nokogiri (1.7.2) mini_portile2 (~> 2.1.0) nom-xml (0.6.0) activesupport (>= 3.2.18) @@ -530,7 +530,7 @@ GEM nokogiri (~> 1.6) rails (>= 4.2.0, < 6.0) rdf - rack (2.0.1) + rack (2.0.2) rack-protection (1.5.3) rack rack-test (0.6.3) @@ -551,9 +551,9 @@ GEM actionpack (~> 5.x) actionview (~> 5.x) activesupport (~> 5.x) - rails-dom-testing (2.0.2) - activesupport (>= 4.2.0, < 6.0) - nokogiri (~> 1.6) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) rails_autolink (1.1.6) @@ -610,7 +610,7 @@ GEM riiif (1.4.0) railties (>= 4.2, < 6) rolify (5.1.0) - rsolr (2.0.0) + rsolr (2.0.1) builder (>= 2.1.2) faraday rspec (1.3.2) From fac2ca6994895313ea21ec9d4d50f415c6405dbd Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Wed, 10 May 2017 11:32:10 -0700 Subject: [PATCH 51/57] Add distinct exception classes and tests for each --- app/models/account.rb | 10 +++++++--- spec/models/account_spec.rb | 12 ++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index e83b338085..ea98ea4315 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -86,9 +86,9 @@ def reset! # @raise [RuntimeError] if missing any endpoint def confirm_endpoints! - raise "Account #{cname} is missing solr_endpoint, cannot switch!" unless solr_endpoint - raise "Account #{cname} is missing fcrepo_endpoint, cannot switch!" unless fcrepo_endpoint - raise "Account #{cname} is missing redis_endpoint, cannot switch!" unless redis_endpoint + raise MissingSolrException, "Account #{cname} is missing solr_endpoint, cannot switch!" unless solr_endpoint + raise MissingFcrepoException, "Account #{cname} is missing fcrepo_endpoint, cannot switch!" unless fcrepo_endpoint + raise MissingRedisException, "Account #{cname} is missing redis_endpoint, cannot switch!" unless redis_endpoint end def default_cname(piece = name) @@ -99,3 +99,7 @@ def canonicalize_cname self.cname &&= self.class.canonical_cname(cname) end end + +class MissingSolrException < RuntimeError; end +class MissingFcrepoException < RuntimeError; end +class MissingRedisException < RuntimeError; end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index bbfe69abef..5fa9527534 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -121,9 +121,17 @@ end context 'with missing endpoint' do - it 'throws exception on switch!' do + it 'Solr, throws exception on switch!' do subject.solr_endpoint = nil - expect { subject.switch! }.to raise_error(RuntimeError) + expect { subject.switch! }.to raise_error(MissingSolrException) + end + it 'Fcrepo, throws exception on switch!' do + subject.fcrepo_endpoint = nil + expect { subject.switch! }.to raise_error(MissingFcrepoException) + end + it 'Redis, throws exception on switch!' do + subject.redis_endpoint = nil + expect { subject.switch! }.to raise_error(MissingRedisException) end end end From 918ccaed0828ba5d963046ba1511667f4fd7d7b0 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Wed, 10 May 2017 11:51:10 -0700 Subject: [PATCH 52/57] Update dependencies --- Gemfile | 7 +-- Gemfile.lock | 59 ++++++++++--------- config/environments/production.rb | 1 + .../better_active_elastic_job_adapter.rb | 8 --- .../better_active_elastic_job_adapter_spec.rb | 1 + 5 files changed, 36 insertions(+), 40 deletions(-) diff --git a/Gemfile b/Gemfile index 3236346b42..1f049cdd7e 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,7 @@ group :development, :test do gem 'i18n-debug', require: false gem 'rspec' - gem 'rspec-rails', '>= 3.6.0.beta2' + gem 'rspec-rails', '>= 3.6.0' gem 'coveralls', require: false gem 'simplecov', require: false @@ -110,8 +110,7 @@ group :aws, :test do end group :aws do - # TODO: Version 2.0 causes a failure in spec/lib/active_job/queue_adapters/better_active_elastic_job_adapter_spec.rb - gem 'active_elastic_job', '~> 1.7' + gem 'active_elastic_job', '~> 2.0' end gem 'peek-sidekiq' @@ -119,4 +118,4 @@ gem 'sidekiq' gem 'secure_headers' -gem 'honeybadger', '~> 2.0' +gem 'honeybadger', '~> 3.0' diff --git a/Gemfile.lock b/Gemfile.lock index 4186c8a156..2c66d86b61 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/projecthydra-labs/hyrax.git - revision: 1d0bd8ff9149e496a5d52301fa1ca5aa8d33bcc4 + revision: a025f560ed7f32cf069799357cbf7771e34374d9 specs: hyrax (2.0.0.alpha) active-fedora (>= 11.1.3) @@ -88,7 +88,7 @@ GEM active_attr (0.9.0) activemodel (>= 3.0.2, < 5.1) activesupport (>= 3.0.2, < 5.1) - active_elastic_job (1.7.0) + active_elastic_job (2.0.1) aws-sdk (~> 2) rails (>= 4.2) active_fedora-noid (2.0.2) @@ -217,7 +217,7 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) daemons (1.2.4) - database_cleaner (1.5.3) + database_cleaner (1.6.1) declarative (0.0.9) declarative-option (0.1.0) deep_merge (1.1.1) @@ -318,7 +318,7 @@ GEM concurrent-ruby (~> 1.0) hashdiff (0.3.4) hiredis (0.6.1) - honeybadger (2.7.2) + honeybadger (3.1.2) htmlentities (4.3.4) httmultiparty (0.3.16) httparty (>= 0.7.3) @@ -379,9 +379,9 @@ GEM inflecto (0.0.2) is_it_working (1.1.0) iso-639 (0.2.8) - jbuilder (2.6.3) - activesupport (>= 3.0.0, < 5.2) - multi_json (~> 1.2) + jbuilder (2.6.4) + activesupport (>= 3.0.0) + multi_json (>= 1.2) jmespath (1.3.1) jquery-datatables-rails (3.4.0) actionpack (>= 3.1) @@ -531,7 +531,7 @@ GEM rails (>= 4.2.0, < 6.0) rdf rack (2.0.2) - rack-protection (1.5.3) + rack-protection (2.0.0) rack rack-test (0.6.3) rack (>= 1.0) @@ -574,7 +574,7 @@ GEM rdf (~> 2.0) rdf-isomorphic (2.0.0) rdf (~> 2.0) - rdf-rdfa (2.2.0) + rdf-rdfa (2.2.1) haml (~> 4.0) htmlentities (~> 4.3) rdf (~> 2.2) @@ -610,27 +610,30 @@ GEM riiif (1.4.0) railties (>= 4.2, < 6) rolify (5.1.0) - rsolr (2.0.1) + rsolr (2.0.2) builder (>= 2.1.2) faraday - rspec (1.3.2) - rspec-core (3.6.0.beta2) - rspec-support (= 3.6.0.beta2) - rspec-expectations (3.6.0.beta2) + rspec (3.6.0) + rspec-core (~> 3.6.0) + rspec-expectations (~> 3.6.0) + rspec-mocks (~> 3.6.0) + rspec-core (3.6.0) + rspec-support (~> 3.6.0) + rspec-expectations (3.6.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (= 3.6.0.beta2) - rspec-mocks (3.6.0.beta2) + rspec-support (~> 3.6.0) + rspec-mocks (3.6.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (= 3.6.0.beta2) - rspec-rails (3.6.0.beta2) + rspec-support (~> 3.6.0) + rspec-rails (3.6.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (= 3.6.0.beta2) - rspec-expectations (= 3.6.0.beta2) - rspec-mocks (= 3.6.0.beta2) - rspec-support (= 3.6.0.beta2) - rspec-support (3.6.0.beta2) + rspec-core (~> 3.6.0) + rspec-expectations (~> 3.6.0) + rspec-mocks (~> 3.6.0) + rspec-support (~> 3.6.0) + rspec-support (3.6.0) rubocop (0.47.1) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) @@ -657,7 +660,7 @@ GEM scss_lint (0.53.0) rake (>= 0.9, < 13) sass (~> 3.4.20) - secure_headers (3.6.3) + secure_headers (3.6.4) useragent select2-rails (3.5.10) thor (~> 0.14) @@ -723,7 +726,7 @@ GEM tinymce-rails (~> 4.0) turbolinks (5.0.1) turbolinks-source (~> 5) - turbolinks-source (5.0.2) + turbolinks-source (5.0.3) twitter-typeahead-rails (0.11.1.pre.corejavascript) actionpack (>= 3.1) jquery-rails @@ -761,7 +764,7 @@ PLATFORMS DEPENDENCIES active-fedora (>= 11.1.4) - active_elastic_job (~> 1.7) + active_elastic_job (~> 2.0) apartment blacklight (~> 6.7) byebug @@ -777,7 +780,7 @@ DEPENDENCIES factory_girl_rails fcrepo_wrapper (~> 0.4) flipflop (~> 2.3) - honeybadger (~> 2.0) + honeybadger (~> 3.0) hyrax! i18n-debug iiif_manifest (~> 0.2.0) @@ -802,7 +805,7 @@ DEPENDENCIES rolify rsolr (~> 2.0) rspec - rspec-rails (>= 3.6.0.beta2) + rspec-rails (>= 3.6.0) rubocop (~> 0.47.0) rubocop-rspec (~> 1.10.0) sass-rails (~> 5.0) diff --git a/config/environments/production.rb b/config/environments/production.rb index 28f9b0ac42..7c243abd9b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -58,6 +58,7 @@ # Use a real queuing backend for Active Job (and separate queues per environment) require 'active_job/queue_adapters/better_active_elastic_job_adapter' config.active_job.queue_adapter = Settings.active_job.queue_adapter + config.active_elastic_job.secret_key_base = Rails.application.secrets[:secret_key_base] # config.active_job.queue_name_prefix = "hyku_#{Rails.env}" config.action_mailer.perform_caching = false diff --git a/lib/active_job/queue_adapters/better_active_elastic_job_adapter.rb b/lib/active_job/queue_adapters/better_active_elastic_job_adapter.rb index 371d26743b..46ab8a4227 100644 --- a/lib/active_job/queue_adapters/better_active_elastic_job_adapter.rb +++ b/lib/active_job/queue_adapters/better_active_elastic_job_adapter.rb @@ -3,14 +3,6 @@ module ActiveJob module QueueAdapters class BetterActiveElasticJobAdapter < ActiveElasticJobAdapter - def enqueue(*args) - self.class.enqueue(*args) - end - - def enqueue_at(*args) - self.class.enqueue_at(*args) - end - class << self def aws_sqs_client @aws_sqs_client ||= Aws::SQS::Client.new diff --git a/spec/lib/active_job/queue_adapters/better_active_elastic_job_adapter_spec.rb b/spec/lib/active_job/queue_adapters/better_active_elastic_job_adapter_spec.rb index 724362fc1f..13f4775918 100644 --- a/spec/lib/active_job/queue_adapters/better_active_elastic_job_adapter_spec.rb +++ b/spec/lib/active_job/queue_adapters/better_active_elastic_job_adapter_spec.rb @@ -8,6 +8,7 @@ before do allow(Settings.active_job_queue).to receive(:url).and_return(queue_url) + Rails.application.config.active_elastic_job.secret_key_base = Rails.application.secrets[:secret_key_base] allow(described_class).to receive(:aws_sqs_client).and_return(aws_sqs_client) end From 97d6077f376ff6ef7f7e891451dbd83fccff17ae Mon Sep 17 00:00:00 2001 From: "Michael J. Giarlo" Date: Wed, 10 May 2017 12:56:33 -0700 Subject: [PATCH 53/57] Update Hyrax to pick up commit w/ fix to FileSet labels Fixes #1021. --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2c66d86b61..45f12ab7e5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/projecthydra-labs/hyrax.git - revision: a025f560ed7f32cf069799357cbf7771e34374d9 + revision: 2f7ab5f7c6dd3d49a1d5a78dc7b412de0d51e74d specs: hyrax (2.0.0.alpha) active-fedora (>= 11.1.3) From c310a4130a548b871c798faffb6ad2b9de740636 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Wed, 10 May 2017 13:50:08 -0700 Subject: [PATCH 54/57] fcrepo runs on port 8080 in docker --- docker-compose.base.yml | 2 +- docker-compose.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.base.yml b/docker-compose.base.yml index 3113322fe1..c23397ab31 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -20,7 +20,7 @@ services: environment: - REDIS_HOST=redis_cluster - DATABASE_URL=postgresql://postgres@db/postgres - - FEDORA_URL=http://fcrepo:8983/fedora/rest + - FEDORA_URL=http://fcrepo:8080/fedora/rest - SOLR_URL=http://solr:8983/solr/ - SETTINGS__ACTIVE_JOB__QUEUE_ADAPTER=sidekiq - SETTINGS__SOLR__URL=http://solr:8983/solr/ diff --git a/docker-compose.yml b/docker-compose.yml index 7d4cbe6aa0..db83106c04 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -86,7 +86,7 @@ services: fcrepo: image: cbeer/fcrepo4:4.7 expose: - - 8983 + - 8080 volumes: - fcrepo:/data environment: @@ -107,7 +107,7 @@ services: - REDIS_HOST=redis_cluster - REDIS_SENTINEL_HOST=redis_sentinel - DATABASE_URL=postgresql://postgres@db/postgres - - FEDORA_URL=http://fcrepo:8983/fedora/rest + - FEDORA_URL=http://fcrepo:8080/fedora/rest - SOLR_URL=http://solr:8983/solr/ - SETTINGS__ACTIVE_JOB__QUEUE_ADAPTER=sidekiq - SETTINGS__SOLR__URL=http://solr:8983/solr/ From a754c7afae56fdb05d484a183c890c6150e64e39 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Wed, 10 May 2017 14:12:37 -0700 Subject: [PATCH 55/57] The fedora webapp is mounted at /fcrepo with cbeer/fcrepo4 image --- docker-compose.base.yml | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.base.yml b/docker-compose.base.yml index c23397ab31..c3c0beca12 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -20,7 +20,7 @@ services: environment: - REDIS_HOST=redis_cluster - DATABASE_URL=postgresql://postgres@db/postgres - - FEDORA_URL=http://fcrepo:8080/fedora/rest + - FEDORA_URL=http://fcrepo:8080/fcrepo/rest - SOLR_URL=http://solr:8983/solr/ - SETTINGS__ACTIVE_JOB__QUEUE_ADAPTER=sidekiq - SETTINGS__SOLR__URL=http://solr:8983/solr/ diff --git a/docker-compose.yml b/docker-compose.yml index db83106c04..cd168f8479 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -107,7 +107,7 @@ services: - REDIS_HOST=redis_cluster - REDIS_SENTINEL_HOST=redis_sentinel - DATABASE_URL=postgresql://postgres@db/postgres - - FEDORA_URL=http://fcrepo:8080/fedora/rest + - FEDORA_URL=http://fcrepo:8080/fcrepo/rest - SOLR_URL=http://solr:8983/solr/ - SETTINGS__ACTIVE_JOB__QUEUE_ADAPTER=sidekiq - SETTINGS__SOLR__URL=http://solr:8983/solr/ From 986cafb7b0a28278be405906b86d8c709aa61609 Mon Sep 17 00:00:00 2001 From: "Michael J. Giarlo" Date: Thu, 11 May 2017 11:28:59 -0700 Subject: [PATCH 56/57] Update Hyku workflow to match Hyrax --- config/workflows/mediated_deposit_workflow.json | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/config/workflows/mediated_deposit_workflow.json b/config/workflows/mediated_deposit_workflow.json index e6d1fc991d..b1fab98769 100644 --- a/config/workflows/mediated_deposit_workflow.json +++ b/config/workflows/mediated_deposit_workflow.json @@ -4,6 +4,7 @@ "name": "one_step_mediated_deposit", "label": "One-step mediated deposit workflow", "description": "A single-step workflow for mediated deposit in which all deposits must be approved by a reviewer. Reviewer may also send deposits back to the depositor.", + "allows_access_grant": false, "actions": [ { "name": "deposit", @@ -21,7 +22,7 @@ ] }, { "name": "request_changes", - "from_states": [{"names": ["complete", "pending_review"], "roles": ["approving"]}], + "from_states": [{"names": ["deposited", "pending_review"], "roles": ["approving"]}], "transition_to": "changes_required", "notifications": [ { @@ -36,7 +37,7 @@ }, { "name": "approve", "from_states": [{"names": ["pending_review"], "roles": ["approving"]}], - "transition_to": "complete", + "transition_to": "deposited", "notifications": [ { "notification_type": "email", @@ -58,6 +59,12 @@ "to": ["approving"] } ] + }, { + "name": "comment_only", + "from_states": [ + { "names": ["pending_review", "deposited"], "roles": ["approving"] }, + { "names": ["changes_required"], "roles": ["depositing"] } + ] } ] } From 0d9c991ea6a8a813da3c03b5577571e382029cf0 Mon Sep 17 00:00:00 2001 From: Daniel Pierce Date: Thu, 11 May 2017 17:08:49 -0400 Subject: [PATCH 57/57] Restores indexing of descriptive metadata. --- app/indexers/work_indexer.rb | 1 + spec/indexers/work_indexer_spec.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/indexers/work_indexer.rb b/app/indexers/work_indexer.rb index 9b979d868d..c13b285722 100644 --- a/app/indexers/work_indexer.rb +++ b/app/indexers/work_indexer.rb @@ -1,3 +1,4 @@ class WorkIndexer < Hyrax::WorkIndexer + include Hyrax::IndexesBasicMetadata self.thumbnail_path_service = IIIFThumbnailPathService end diff --git a/spec/indexers/work_indexer_spec.rb b/spec/indexers/work_indexer_spec.rb index 8f3b5eef23..cb91bfb332 100644 --- a/spec/indexers/work_indexer_spec.rb +++ b/spec/indexers/work_indexer_spec.rb @@ -3,4 +3,8 @@ subject { described_class.thumbnail_path_service } it { is_expected.to eq IIIFThumbnailPathService } end + describe 'rdf_service' do + subject { described_class.new(FactoryGirl.build(:work)).rdf_service } + it { is_expected.to eq Hyrax::BasicMetadataIndexer } + end end