zizia 1.0.1 → 2.0.0.alpha.01

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +9 -0
  3. data/.travis.yml +1 -0
  4. data/README.md +24 -3
  5. data/Rakefile +4 -0
  6. data/app/assets/config/zizia_manifest.js +2 -0
  7. data/app/assets/images/zizia/.keep +0 -0
  8. data/app/assets/javascripts/zizia/application.js +13 -0
  9. data/app/assets/stylesheets/zizia/application.css +15 -0
  10. data/app/controllers/zizia/application_controller.rb +6 -0
  11. data/app/controllers/zizia/csv_imports_controller.rb +53 -0
  12. data/app/controllers/zizia/importer_documentation_controller.rb +12 -0
  13. data/app/helpers/importer_documentation_helper.rb +13 -0
  14. data/app/helpers/zizia/application_helper.rb +14 -0
  15. data/app/jobs/zizia/application_job.rb +5 -0
  16. data/app/jobs/zizia/start_csv_import_job.rb +16 -0
  17. data/app/mailers/zizia/application_mailer.rb +7 -0
  18. data/app/models/zizia/application_record.rb +6 -0
  19. data/app/models/zizia/csv_import.rb +21 -0
  20. data/app/uploaders/zizia/csv_manifest_uploader.rb +66 -0
  21. data/app/views/importer_documentation/guide.html.erb +1 -0
  22. data/app/views/layouts/zizia/application.html.erb +14 -0
  23. data/app/views/zizia/csv_imports/_actions.html.erb +3 -0
  24. data/app/views/zizia/csv_imports/_collection_selection.html.erb +3 -0
  25. data/app/views/zizia/csv_imports/_error.html.erb +10 -0
  26. data/app/views/zizia/csv_imports/_file_upload.html.erb +3 -0
  27. data/app/views/zizia/csv_imports/_form.html.erb +75 -0
  28. data/app/views/zizia/csv_imports/_no_collection.html.erb +7 -0
  29. data/app/views/zizia/csv_imports/_record_count.html.erb +7 -0
  30. data/app/views/zizia/csv_imports/_start_import_form.html.erb +9 -0
  31. data/app/views/zizia/csv_imports/index.html.erb +21 -0
  32. data/app/views/zizia/csv_imports/new.html.erb +2 -0
  33. data/app/views/zizia/csv_imports/preview.html.erb +76 -0
  34. data/app/views/zizia/csv_imports/show.html.erb +31 -0
  35. data/bin/rails +15 -0
  36. data/config/routes.rb +9 -0
  37. data/db/migrate/migrate/20190116214128_create_csv_imports.rb +10 -0
  38. data/db/migrate/migrate/20190116220312_add_manifest_to_csv_imports.rb +6 -0
  39. data/db/migrate/migrate/20190124153654_add_fedora_collection_id_to_csv_imports.rb +6 -0
  40. data/docs/customizing_metadata.md +43 -0
  41. data/lib/zizia/engine.rb +20 -0
  42. data/lib/zizia/input_record.rb +2 -2
  43. data/lib/zizia/version.rb +1 -1
  44. data/lib/zizia.rb +19 -17
  45. data/spec/controllers/importer_documentation_controller_spec.rb +14 -0
  46. data/spec/dummy/.gitignore +23 -0
  47. data/spec/dummy/Gemfile +57 -0
  48. data/spec/dummy/README.md +24 -0
  49. data/spec/dummy/Rakefile +6 -0
  50. data/spec/dummy/app/assets/config/manifest.js +3 -0
  51. data/spec/dummy/app/assets/csv/import_manifest.csv +1 -0
  52. data/spec/dummy/app/assets/images/.keep +0 -0
  53. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  54. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  55. data/spec/dummy/app/assets/javascripts/channels/.keep +0 -0
  56. data/spec/dummy/app/assets/markdown/importer_guide.md +256 -0
  57. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  58. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  59. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  60. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  61. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  62. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  63. data/spec/dummy/app/jobs/application_job.rb +2 -0
  64. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  65. data/spec/dummy/app/models/application_record.rb +3 -0
  66. data/spec/dummy/app/models/concerns/.keep +0 -0
  67. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  68. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  69. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  70. data/spec/dummy/bin/bundle +3 -0
  71. data/spec/dummy/bin/rails +9 -0
  72. data/spec/dummy/bin/rake +9 -0
  73. data/spec/dummy/bin/setup +38 -0
  74. data/spec/dummy/bin/spring +17 -0
  75. data/spec/dummy/bin/update +29 -0
  76. data/spec/dummy/bin/yarn +11 -0
  77. data/spec/dummy/config/application.rb +18 -0
  78. data/spec/dummy/config/boot.rb +3 -0
  79. data/spec/dummy/config/cable.yml +10 -0
  80. data/spec/dummy/config/database.yml +25 -0
  81. data/spec/dummy/config/environment.rb +5 -0
  82. data/spec/dummy/config/environments/development.rb +54 -0
  83. data/spec/dummy/config/environments/production.rb +91 -0
  84. data/spec/dummy/config/environments/test.rb +42 -0
  85. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  86. data/spec/dummy/config/initializers/assets.rb +14 -0
  87. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  88. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  89. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  90. data/spec/dummy/config/initializers/inflections.rb +16 -0
  91. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  92. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  93. data/spec/dummy/config/locales/en.yml +33 -0
  94. data/spec/dummy/config/puma.rb +56 -0
  95. data/spec/dummy/config/routes.rb +4 -0
  96. data/spec/dummy/config/secrets.yml +32 -0
  97. data/spec/dummy/config/spring.rb +6 -0
  98. data/spec/dummy/config.ru +5 -0
  99. data/spec/dummy/db/schema.rb +24 -0
  100. data/spec/dummy/db/seeds.rb +7 -0
  101. data/spec/dummy/lib/assets/.keep +0 -0
  102. data/spec/dummy/lib/tasks/.keep +0 -0
  103. data/spec/dummy/log/.keep +0 -0
  104. data/spec/dummy/package.json +5 -0
  105. data/spec/dummy/public/404.html +67 -0
  106. data/spec/dummy/public/422.html +67 -0
  107. data/spec/dummy/public/500.html +66 -0
  108. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  109. data/spec/dummy/public/apple-touch-icon.png +0 -0
  110. data/spec/dummy/public/favicon.ico +0 -0
  111. data/spec/dummy/public/robots.txt +1 -0
  112. data/spec/dummy/test/application_system_test_case.rb +5 -0
  113. data/spec/dummy/test/controllers/.keep +0 -0
  114. data/spec/dummy/test/fixtures/.keep +0 -0
  115. data/spec/dummy/test/fixtures/files/.keep +0 -0
  116. data/spec/dummy/test/helpers/.keep +0 -0
  117. data/spec/dummy/test/integration/.keep +0 -0
  118. data/spec/dummy/test/mailers/.keep +0 -0
  119. data/spec/dummy/test/models/.keep +0 -0
  120. data/spec/dummy/test/system/.keep +0 -0
  121. data/spec/dummy/test/test_helper.rb +10 -0
  122. data/spec/dummy/vendor/.keep +0 -0
  123. data/spec/models/csv_import_spec.rb +18 -0
  124. data/spec/spec_helper.rb +10 -0
  125. data/spec/views/importer_documentation/guide.html.erb_spec.rb +9 -0
  126. data/spec/zizia_spec.rb +13 -0
  127. data/zizia.gemspec +12 -6
  128. metadata +226 -25
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
@@ -0,0 +1,24 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 20190124153654) do
14
+
15
+ create_table "zizia_csv_imports", force: :cascade do |t|
16
+ t.integer "user_id"
17
+ t.datetime "created_at", null: false
18
+ t.datetime "updated_at", null: false
19
+ t.string "manifest"
20
+ t.string "fedora_collection_id"
21
+ t.index ["user_id"], name: "index_zizia_csv_imports_on_user_id"
22
+ end
23
+
24
+ end
@@ -0,0 +1,7 @@
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 rails db:seed command (or created alongside the database with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7
+ # Character.create(name: 'Luke', movie: movies.first)
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "my_app",
3
+ "private": true,
4
+ "dependencies": {}
5
+ }
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
File without changes
@@ -0,0 +1 @@
1
+ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
@@ -0,0 +1,5 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
7
+ fixtures :all
8
+
9
+ # Add more helper methods to be used by all tests here...
10
+ end
File without changes
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Zizia::CsvImport, type: :model do
5
+ subject(:csv_import) { described_class.new }
6
+
7
+ it 'has a CSV manifest' do
8
+ expect(csv_import.manifest).to be_a Zizia::CsvManifestUploader
9
+ end
10
+
11
+ context '#queue_start_job' do
12
+ it 'queues a job to start the import' do
13
+ expect do
14
+ csv_import.queue_start_job
15
+ end.to have_enqueued_job(Zizia::StartCsvImportJob)
16
+ end
17
+ end
18
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'pry' unless ENV['CI']
4
+
4
5
  ENV['environment'] ||= 'test'
6
+ # Configure Rails Envinronment
7
+ ENV['RAILS_ENV'] = 'test'
8
+ require File.expand_path('../../spec/dummy/config/environment', __FILE__)
9
+ require 'rails/all'
10
+ require 'rspec/rails'
11
+
12
+ ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
13
+
14
+ ActiveJob::Base.queue_adapter = :test
5
15
 
6
16
  require 'bundler/setup'
7
17
  require 'active_fedora'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe "importer_documentation/guide.html.erb", type: :view do
5
+ it 'renders as html' do
6
+ render
7
+ expect(rendered).to match(/<h1 id="title">Title<\/h1>/)
8
+ end
9
+ end
data/spec/zizia_spec.rb CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
+ class FakeMetadataMapper
6
+ end
7
+
5
8
  describe Zizia do
6
9
  describe '#config' do
7
10
  it 'can set a default error stream' do
@@ -15,5 +18,15 @@ describe Zizia do
15
18
  .to change { described_class.config.default_info_stream }
16
19
  .to(STDOUT)
17
20
  end
21
+
22
+ it 'has a default metadata mapper' do
23
+ expect(described_class.config.metadata_mapper_class).to eq Zizia::HyraxBasicMetadataMapper
24
+ end
25
+
26
+ it 'can set a default metadata mapper' do
27
+ expect { described_class.config { |c| c.metadata_mapper_class = FakeMetadataMapper } }
28
+ .to change { described_class.config.metadata_mapper_class }
29
+ .to(FakeMetadataMapper)
30
+ end
18
31
  end
19
32
  end
data/zizia.gemspec CHANGED
@@ -17,17 +17,23 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.required_ruby_version = '>= 2.3.4'
19
19
 
20
- gem.add_dependency 'active-fedora', '>= 11.5.2'
20
+ gem.add_dependency 'active-fedora'
21
+ gem.add_dependency 'rails', '~> 5.1.7'
22
+ gem.add_dependency 'carrierwave'
23
+ gem.add_dependency 'redcarpet'
21
24
 
22
- gem.add_development_dependency 'yard', '~> 0.9'
23
- gem.add_development_dependency 'bixby', '~> 1.0'
24
- gem.add_development_dependency 'hyrax-spec', '~> 0.2'
25
- gem.add_development_dependency 'rspec', '~> 3.6'
26
- gem.add_development_dependency 'coveralls', '~> 0.8'
25
+ gem.add_development_dependency 'yard'
26
+ gem.add_development_dependency 'bixby'
27
+ gem.add_development_dependency 'hyrax', '~> 2.5'
28
+ gem.add_development_dependency 'hyrax-spec'
29
+ gem.add_development_dependency 'rspec'
30
+ gem.add_development_dependency 'rspec-rails'
31
+ gem.add_development_dependency 'coveralls'
27
32
  gem.add_development_dependency 'solr_wrapper', '~> 2.1'
28
33
  gem.add_development_dependency 'fcrepo_wrapper', '~> 0.9'
29
34
  gem.add_development_dependency 'byebug'
30
35
  gem.add_development_dependency 'rake'
36
+ gem.add_development_dependency 'sqlite3'
31
37
 
32
38
  gem.files = `git ls-files`.split("\n")
33
39
  gem.test_files = `git ls-files -- {spec}/*`.split("\n")