curate 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. data/app/assets/images/blacklight/bg.png +0 -0
  2. data/app/assets/images/blacklight/border.png +0 -0
  3. data/app/assets/images/blacklight/bul_sq_gry.gif +0 -0
  4. data/app/assets/images/blacklight/checkmark.gif +0 -0
  5. data/app/assets/images/blacklight/logo.png +0 -0
  6. data/app/assets/images/blacklight/magnifying_glass.gif +0 -0
  7. data/app/assets/images/blacklight/remove.gif +0 -0
  8. data/app/assets/images/blacklight/separator.gif +0 -0
  9. data/app/assets/images/blacklight/start_over.gif +0 -0
  10. data/app/assets/javascripts/curate.js +38 -0
  11. data/app/assets/javascripts/help_modal.js +36 -0
  12. data/app/assets/javascripts/manage_repeating_fields.js +65 -0
  13. data/app/assets/javascripts/toggle_details.js +10 -0
  14. data/app/assets/stylesheets/blacklight.css.scss +6 -0
  15. data/app/assets/stylesheets/curate.css.scss +23 -0
  16. data/app/assets/stylesheets/downloads.css.scss +3 -0
  17. data/app/assets/stylesheets/global-variables.scss +303 -0
  18. data/app/assets/stylesheets/help_requests.css.scss +3 -0
  19. data/app/assets/stylesheets/layout/positioning.css.scss +59 -0
  20. data/app/assets/stylesheets/modules.scss +5 -0
  21. data/app/assets/stylesheets/modules/action_bar.css.scss +14 -0
  22. data/app/assets/stylesheets/modules/emphatic_action_area.css.scss +14 -0
  23. data/app/assets/stylesheets/modules/forms.css.scss +39 -0
  24. data/app/assets/stylesheets/modules/multi_value_fields.css.scss +13 -0
  25. data/app/assets/stylesheets/modules/site_search.css.scss +26 -0
  26. data/app/assets/stylesheets/style/theme.css.scss +44 -0
  27. data/app/assets/stylesheets/style/typography.css.scss +130 -0
  28. data/app/repository_models/curation_concern/model.rb +40 -0
  29. data/app/repository_models/curation_concern/with_generic_files.rb +16 -0
  30. data/lib/curate/railtie.rb +9 -0
  31. data/lib/curate/version.rb +1 -1
  32. data/lib/generators/curate/curation_concern/USAGE +14 -0
  33. data/lib/generators/curate/curation_concern/curation_concern_generator.rb +55 -0
  34. data/lib/generators/curate/curation_concern/templates/curation_concern.rb.erb +46 -0
  35. data/lib/generators/curate/curation_concern/templates/curation_concern_factory.rb.erb +13 -0
  36. data/lib/generators/curate/curation_concern/templates/curation_concern_serializer.rb.erb +8 -0
  37. data/lib/generators/curate/curation_concern/templates/curation_concern_serializer_spec.rb.erb +11 -0
  38. data/lib/generators/curate/curation_concern/templates/curation_concern_spec.rb.erb +9 -0
  39. data/lib/generators/curate/curation_concern/templates/metadata_datastream.rb.erb +67 -0
  40. data/lib/generators/curate/curation_concern/templates/metadata_datastream_spec.rb.erb +7 -0
  41. data/spec/dummy/app/controllers/curation_concern/mock_curation_concerns_controller.rb +9 -0
  42. data/spec/dummy/config/routes.rb +1 -1
  43. data/spec/dummy/log/test.log +20535 -0
  44. data/spec/features/error_handlers_spec.rb +36 -0
  45. data/spec/routing/classify_concerns_routing_spec.rb +15 -0
  46. data/spec/routing/common_objects_routing_spec.rb +10 -0
  47. data/spec/routing/downloads_routing_spec.rb +17 -0
  48. data/spec/routing/generic_files_routing_spec.rb +79 -0
  49. data/spec/routing/help_requests_routing_spec.rb +11 -0
  50. data/spec/support/mock_curation_concern.rb +26 -38
  51. data/spec/validators/future_date_validator_spec.rb +35 -0
  52. metadata +75 -4
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe_options = {type: :feature}
4
+ if ENV['JS']
5
+ describe_options[:js] = true
6
+ end
7
+
8
+ describe 'error behavior', describe_options do
9
+ before(:each) do
10
+ @initial_consider_all_requests_local = Rails.configuration.consider_all_requests_local
11
+ Rails.configuration.consider_all_requests_local = false
12
+ end
13
+ after(:each) do
14
+ Rails.configuration.consider_all_requests_local = @initial_consider_all_requests_local
15
+ end
16
+
17
+ it 'handles non-existent noid for common objects with 404' do
18
+ visit('/show/invalid_noid')
19
+ expect(page).to have_content('The page you are looking for may have been removed, had its name changed, or is temporarily unavailable.')
20
+ expect(page).to have_content("Not Found")
21
+ end
22
+
23
+ let(:curation_concern_type) { :mock_curation_concern }
24
+ let(:user) { FactoryGirl.create(:user) }
25
+ let(:visibility) { AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED }
26
+ let(:curation_concern) {
27
+ FactoryGirl.create_curation_concern(
28
+ curation_concern_type, user, {visibility: visibility}
29
+ )
30
+ }
31
+ it 'handles unauthorized pages'do
32
+ visit("/concern/#{curation_concern_type.to_s.pluralize}/#{curation_concern.to_param}")
33
+ expect(page).to have_content("Unauthorized")
34
+ expect(page).to have_content("You are not authorized to access the page.")
35
+ end
36
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'classify_concerns routing' do
4
+ it "routes GET /classify_concerns/new" do
5
+ expect(
6
+ get: "/classify_concerns/new"
7
+ ).to route_to(controller: "classify_concerns",action: "new")
8
+ end
9
+
10
+ it "routes POST /classify_concerns" do
11
+ expect(
12
+ post: "/classify_concerns"
13
+ ).to route_to(controller: "classify_concerns", action: "create")
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe '/purl routing' do
4
+ it "routes GET /purl/:id" do
5
+ param_id = "12a34b56c"
6
+ expect(get: "/show/#{param_id}").to(
7
+ route_to(controller: "common_objects", action: "show", id: param_id)
8
+ )
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'downloads routing' do
4
+ let(:noid) { '1a2b3c' }
5
+
6
+ it "routes GET /downloads/:id" do
7
+ expect(
8
+ get: "/downloads/#{noid}"
9
+ ).to(
10
+ route_to(
11
+ controller: "downloads",
12
+ action: "show",
13
+ id: noid
14
+ )
15
+ )
16
+ end
17
+ end
@@ -0,0 +1,79 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'generic files routing' do
4
+ let(:parent_id) { '1a2b3c' }
5
+ let(:child_id) { '1a2b3c4d5e' }
6
+
7
+ it "routes GET /concern/related_files/:id" do
8
+ expect(
9
+ get: "/concern/generic_files/#{child_id}"
10
+ ).to(
11
+ route_to(
12
+ controller: "curation_concern/generic_files",
13
+ action: "show",
14
+ id: child_id
15
+ )
16
+ )
17
+ end
18
+
19
+ it "routes GET /concern/related_files/:id/edit" do
20
+ expect(
21
+ get: "/concern/generic_files/#{child_id}/edit"
22
+ ).to(
23
+ route_to(
24
+ controller: "curation_concern/generic_files",
25
+ action: "edit",
26
+ id: child_id
27
+ )
28
+ )
29
+ end
30
+
31
+ it "routes GET /concern/related_files/:id" do
32
+ expect(
33
+ put: "/concern/generic_files/#{child_id}"
34
+ ).to(
35
+ route_to(
36
+ controller: "curation_concern/generic_files",
37
+ action: "update",
38
+ id: child_id
39
+ )
40
+ )
41
+ end
42
+
43
+ it "routes GET /concern/container/:parent_id/related_files/new" do
44
+ expect(
45
+ get: "/concern/container/#{parent_id}/generic_files/new"
46
+ ).to(
47
+ route_to(
48
+ controller: "curation_concern/generic_files",
49
+ action: "new",
50
+ parent_id: parent_id
51
+ )
52
+ )
53
+ end
54
+
55
+ it "routes POST /concern/container/:parent_id/related_files" do
56
+ expect(
57
+ post: "/concern/container/#{parent_id}/generic_files"
58
+ ).to(
59
+ route_to(
60
+ controller: "curation_concern/generic_files",
61
+ action: "create",
62
+ parent_id: parent_id
63
+ )
64
+ )
65
+ end
66
+
67
+ it "routes DELETE /concern/container/:parent_id/related_files" do
68
+ expect(
69
+ delete: "/concern/generic_files/#{child_id}"
70
+ ).to(
71
+ route_to(
72
+ controller: "curation_concern/generic_files",
73
+ action: "destroy",
74
+ id: child_id
75
+ )
76
+ )
77
+ end
78
+
79
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'help requests routing' do
4
+
5
+ it "routes GET /help_requests/new" do
6
+ expect(
7
+ get: "/help_requests/new"
8
+ ).to route_to(controller: "help_requests", action: "new")
9
+ end
10
+
11
+ end
@@ -1,29 +1,31 @@
1
1
  class MockCurationConcern < ActiveFedora::Base
2
2
  class MetadataDatastream < ActiveFedora::NtriplesRDFDatastream
3
- map_predicates do |map|
4
- map.title(in: RDF::DC) do |index|
5
- index.as :searchable, :displayable
3
+ map_predicates do |map|
4
+ map.title(in: RDF::DC) do |index|
5
+ index.as :searchable, :displayable
6
+ end
7
+ map.created(in: RDF::DC)
8
+ map.creator(in: RDF::DC) do |index|
9
+ index.as :searchable, :facetable, :displayable
10
+ end
11
+ map.date_uploaded(to: "dateSubmitted", in: RDF::DC) do |index|
12
+ index.type :date
13
+ index.as :searchable, :displayable, :sortable
14
+ end
15
+ map.date_modified(to: "modified", in: RDF::DC) do |index|
16
+ index.type :date
17
+ index.as :searchable, :displayable, :sortable
18
+ end
19
+ map.part(:to => "hasPart", in: RDF::DC)
20
+ map.archived_object_type({in: RDF::DC, to: 'type'}) do |index|
21
+ index.as :searchable, :displayable, :facetable
22
+ end
23
+ map.identifier({in: RDF::DC})
6
24
  end
7
- map.created(in: RDF::DC)
8
- map.creator(in: RDF::DC) do |index|
9
- index.as :searchable, :facetable, :displayable
10
- end
11
- map.date_uploaded(to: "dateSubmitted", in: RDF::DC) do |index|
12
- index.type :date
13
- index.as :searchable, :displayable, :sortable
14
- end
15
- map.date_modified(to: "modified", in: RDF::DC) do |index|
16
- index.type :date
17
- index.as :searchable, :displayable, :sortable
18
- end
19
- map.part(:to => "hasPart", in: RDF::DC)
20
- map.identifier({in: RDF::DC})
21
25
  end
22
- end
23
- include Hydra::ModelMixins::CommonMetadata
24
- include Sufia::ModelMethods
25
- include Sufia::Noid
26
- include Sufia::GenericFile::Permissions
26
+
27
+ include CurationConcern::Model
28
+ include CurationConcern::WithGenericFiles
27
29
  include CurationConcern::Embargoable
28
30
  include CurationConcern::WithAccessRight
29
31
 
@@ -39,23 +41,9 @@ end
39
41
  :date_uploaded,
40
42
  :date_modified,
41
43
  :creator,
42
- :identifier,
44
+ :identifier
43
45
  ],
44
46
  unique: true
45
47
  )
46
48
 
47
- has_many :generic_files, property: :is_part_of
48
-
49
- after_destroy :after_destroy_cleanup
50
- def after_destroy_cleanup
51
- generic_files.each(&:destroy)
52
- end
53
-
54
- def human_readable_type
55
- self.class.to_s.demodulize.titleize
56
- end
57
- def to_param
58
- pid.split(':').last
59
- end
60
-
61
- end
49
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ class Validatable
4
+ include ActiveModel::Validations
5
+ attr_accessor :embargo_release_date
6
+ validates :embargo_release_date, future_date: true
7
+ end
8
+
9
+ describe FutureDateValidator do
10
+
11
+ subject { Validatable.new }
12
+
13
+ before { subject.embargo_release_date = embargo_release_date }
14
+
15
+ context 'with today as embargo release date' do
16
+ let(:embargo_release_date) { Date.today.to_s }
17
+ it { should have(1).error_on(:embargo_release_date) }
18
+ end
19
+
20
+ context 'with past date as embargo release date' do
21
+ let(:embargo_release_date) { (Date.today - 2).to_s }
22
+ it { should have(1).error_on(:embargo_release_date) }
23
+ end
24
+
25
+ context 'invalid date as embargo release date' do
26
+ let(:embargo_release_date) { "invalid_ date" }
27
+ it { should have(1).error_on(:embargo_release_date) }
28
+ end
29
+
30
+ context 'future date as embargo release date' do
31
+ let(:embargo_release_date) { (Date.today + 2).to_s }
32
+ it { should have(:no).error_on(:embargo_release_date) }
33
+ end
34
+
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-11 00:00:00.000000000 Z
12
+ date: 2013-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -395,6 +395,22 @@ dependencies:
395
395
  - - '>='
396
396
  - !ruby/object:Gem::Version
397
397
  version: '0'
398
+ - !ruby/object:Gem::Dependency
399
+ name: capybara
400
+ requirement: !ruby/object:Gem::Requirement
401
+ none: false
402
+ requirements:
403
+ - - '>='
404
+ - !ruby/object:Gem::Version
405
+ version: '0'
406
+ type: :development
407
+ prerelease: false
408
+ version_requirements: !ruby/object:Gem::Requirement
409
+ none: false
410
+ requirements:
411
+ - - '>='
412
+ - !ruby/object:Gem::Version
413
+ version: '0'
398
414
  description: A data curation Ruby on Rails engine built on Hydra and Sufia
399
415
  email:
400
416
  - jeremy.n.friesen@gmail.com
@@ -402,6 +418,33 @@ executables: []
402
418
  extensions: []
403
419
  extra_rdoc_files: []
404
420
  files:
421
+ - app/assets/images/blacklight/bg.png
422
+ - app/assets/images/blacklight/border.png
423
+ - app/assets/images/blacklight/bul_sq_gry.gif
424
+ - app/assets/images/blacklight/checkmark.gif
425
+ - app/assets/images/blacklight/logo.png
426
+ - app/assets/images/blacklight/magnifying_glass.gif
427
+ - app/assets/images/blacklight/remove.gif
428
+ - app/assets/images/blacklight/separator.gif
429
+ - app/assets/images/blacklight/start_over.gif
430
+ - app/assets/javascripts/curate.js
431
+ - app/assets/javascripts/help_modal.js
432
+ - app/assets/javascripts/manage_repeating_fields.js
433
+ - app/assets/javascripts/toggle_details.js
434
+ - app/assets/stylesheets/blacklight.css.scss
435
+ - app/assets/stylesheets/curate.css.scss
436
+ - app/assets/stylesheets/downloads.css.scss
437
+ - app/assets/stylesheets/global-variables.scss
438
+ - app/assets/stylesheets/help_requests.css.scss
439
+ - app/assets/stylesheets/layout/positioning.css.scss
440
+ - app/assets/stylesheets/modules/action_bar.css.scss
441
+ - app/assets/stylesheets/modules/emphatic_action_area.css.scss
442
+ - app/assets/stylesheets/modules/forms.css.scss
443
+ - app/assets/stylesheets/modules/multi_value_fields.css.scss
444
+ - app/assets/stylesheets/modules/site_search.css.scss
445
+ - app/assets/stylesheets/modules.scss
446
+ - app/assets/stylesheets/style/theme.css.scss
447
+ - app/assets/stylesheets/style/typography.css.scss
405
448
  - app/controllers/application_controller.rb
406
449
  - app/controllers/catalog_controller.rb
407
450
  - app/controllers/classify_concerns_controller.rb
@@ -433,7 +476,9 @@ files:
433
476
  - app/models/solr_document.rb
434
477
  - app/repository_datastreams/file_content_datastream.rb
435
478
  - app/repository_models/curation_concern/embargoable.rb
479
+ - app/repository_models/curation_concern/model.rb
436
480
  - app/repository_models/curation_concern/with_access_right.rb
481
+ - app/repository_models/curation_concern/with_generic_files.rb
437
482
  - app/repository_models/generic_file.rb
438
483
  - app/services/anti_virus_scanner.rb
439
484
  - app/services/curation_concern/base_actor.rb
@@ -558,8 +603,18 @@ files:
558
603
  - app/workers/doi_worker.rb
559
604
  - config/routes.rb
560
605
  - lib/curate/engine.rb
606
+ - lib/curate/railtie.rb
561
607
  - lib/curate/version.rb
562
608
  - lib/curate.rb
609
+ - lib/generators/curate/curation_concern/curation_concern_generator.rb
610
+ - lib/generators/curate/curation_concern/templates/curation_concern.rb.erb
611
+ - lib/generators/curate/curation_concern/templates/curation_concern_factory.rb.erb
612
+ - lib/generators/curate/curation_concern/templates/curation_concern_serializer.rb.erb
613
+ - lib/generators/curate/curation_concern/templates/curation_concern_serializer_spec.rb.erb
614
+ - lib/generators/curate/curation_concern/templates/curation_concern_spec.rb.erb
615
+ - lib/generators/curate/curation_concern/templates/metadata_datastream.rb.erb
616
+ - lib/generators/curate/curation_concern/templates/metadata_datastream_spec.rb.erb
617
+ - lib/generators/curate/curation_concern/USAGE
563
618
  - lib/tasks/curate_tasks.rake
564
619
  - LICENSE
565
620
  - Rakefile
@@ -578,6 +633,7 @@ files:
578
633
  - spec/dummy/app/assets/javascripts/application.js
579
634
  - spec/dummy/app/assets/stylesheets/application.css
580
635
  - spec/dummy/app/controllers/application_controller.rb
636
+ - spec/dummy/app/controllers/curation_concern/mock_curation_concerns_controller.rb
581
637
  - spec/dummy/app/helpers/application_helper.rb
582
638
  - spec/dummy/app/models/solr_document.rb
583
639
  - spec/dummy/app/models/user.rb
@@ -653,6 +709,7 @@ files:
653
709
  - spec/factories/help_requests.rb
654
710
  - spec/factories/mock_curation_concerns.rb
655
711
  - spec/factories/users.rb
712
+ - spec/features/error_handlers_spec.rb
656
713
  - spec/helpers/application_helper_spec.rb
657
714
  - spec/helpers/common_objects_helper_spec.rb
658
715
  - spec/models/access_right_spec.rb
@@ -667,6 +724,11 @@ files:
667
724
  - spec/models/repo_object_spec.rb
668
725
  - spec/repository_models/curation_concern/embargoable_spec.rb
669
726
  - spec/repository_models/generic_file_spec.rb
727
+ - spec/routing/classify_concerns_routing_spec.rb
728
+ - spec/routing/common_objects_routing_spec.rb
729
+ - spec/routing/downloads_routing_spec.rb
730
+ - spec/routing/generic_files_routing_spec.rb
731
+ - spec/routing/help_requests_routing_spec.rb
670
732
  - spec/services/anti_virus_scanner_spec.rb
671
733
  - spec/services/curation_concern/base_actor_spec.rb
672
734
  - spec/services/curation_concern/generic_file_actor_spec.rb
@@ -677,6 +739,7 @@ files:
677
739
  - spec/support/mock_curation_concern.rb
678
740
  - spec/support/shared/shared_examples_is_embargoable.rb
679
741
  - spec/support/shared/shared_examples_with_access_rights.rb
742
+ - spec/validators/future_date_validator_spec.rb
680
743
  - spec/workers/characterize_job_spec.rb
681
744
  homepage: https://github.com/ndlib/curate
682
745
  licenses: []
@@ -692,7 +755,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
692
755
  version: '0'
693
756
  segments:
694
757
  - 0
695
- hash: -1069347292941721312
758
+ hash: 2061838481868737631
696
759
  required_rubygems_version: !ruby/object:Gem::Requirement
697
760
  none: false
698
761
  requirements:
@@ -701,7 +764,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
701
764
  version: '0'
702
765
  segments:
703
766
  - 0
704
- hash: -1069347292941721312
767
+ hash: 2061838481868737631
705
768
  requirements: []
706
769
  rubyforge_project:
707
770
  rubygems_version: 1.8.25
@@ -723,6 +786,7 @@ test_files:
723
786
  - spec/dummy/app/assets/javascripts/application.js
724
787
  - spec/dummy/app/assets/stylesheets/application.css
725
788
  - spec/dummy/app/controllers/application_controller.rb
789
+ - spec/dummy/app/controllers/curation_concern/mock_curation_concerns_controller.rb
726
790
  - spec/dummy/app/helpers/application_helper.rb
727
791
  - spec/dummy/app/models/solr_document.rb
728
792
  - spec/dummy/app/models/user.rb
@@ -798,6 +862,7 @@ test_files:
798
862
  - spec/factories/help_requests.rb
799
863
  - spec/factories/mock_curation_concerns.rb
800
864
  - spec/factories/users.rb
865
+ - spec/features/error_handlers_spec.rb
801
866
  - spec/helpers/application_helper_spec.rb
802
867
  - spec/helpers/common_objects_helper_spec.rb
803
868
  - spec/models/access_right_spec.rb
@@ -812,6 +877,11 @@ test_files:
812
877
  - spec/models/repo_object_spec.rb
813
878
  - spec/repository_models/curation_concern/embargoable_spec.rb
814
879
  - spec/repository_models/generic_file_spec.rb
880
+ - spec/routing/classify_concerns_routing_spec.rb
881
+ - spec/routing/common_objects_routing_spec.rb
882
+ - spec/routing/downloads_routing_spec.rb
883
+ - spec/routing/generic_files_routing_spec.rb
884
+ - spec/routing/help_requests_routing_spec.rb
815
885
  - spec/services/anti_virus_scanner_spec.rb
816
886
  - spec/services/curation_concern/base_actor_spec.rb
817
887
  - spec/services/curation_concern/generic_file_actor_spec.rb
@@ -822,4 +892,5 @@ test_files:
822
892
  - spec/support/mock_curation_concern.rb
823
893
  - spec/support/shared/shared_examples_is_embargoable.rb
824
894
  - spec/support/shared/shared_examples_with_access_rights.rb
895
+ - spec/validators/future_date_validator_spec.rb
825
896
  - spec/workers/characterize_job_spec.rb