active-fedora 11.0.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -2
  3. data/.rubocop_todo.yml +73 -18
  4. data/.travis.yml +8 -9
  5. data/CONTRIBUTING.md +66 -20
  6. data/History.txt +51 -0
  7. data/README.md +11 -14
  8. data/active-fedora.gemspec +14 -13
  9. data/lib/active_fedora/aggregation/base_extension.rb +3 -1
  10. data/lib/active_fedora/aggregation/list_source.rb +1 -1
  11. data/lib/active_fedora/associations/association.rb +1 -2
  12. data/lib/active_fedora/associations/basic_contains_association.rb +12 -0
  13. data/lib/active_fedora/associations/builder/association.rb +1 -2
  14. data/lib/active_fedora/associations/collection_association.rb +3 -3
  15. data/lib/active_fedora/associations/collection_proxy.rb +10 -10
  16. data/lib/active_fedora/associations/contained_finder.rb +2 -1
  17. data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +1 -1
  18. data/lib/active_fedora/associations/null_validator.rb +1 -2
  19. data/lib/active_fedora/associations/rdf.rb +1 -1
  20. data/lib/active_fedora/attached_files.rb +4 -0
  21. data/lib/active_fedora/attribute_methods.rb +1 -1
  22. data/lib/active_fedora/attributes/property_builder.rb +7 -5
  23. data/lib/active_fedora/caching_connection.rb +1 -1
  24. data/lib/active_fedora/cleaner.rb +1 -1
  25. data/lib/active_fedora/common.rb +10 -0
  26. data/lib/active_fedora/containers/container.rb +1 -2
  27. data/lib/active_fedora/core.rb +12 -5
  28. data/lib/active_fedora/errors.rb +4 -0
  29. data/lib/active_fedora/fedora.rb +19 -5
  30. data/lib/active_fedora/file/attributes.rb +5 -0
  31. data/lib/active_fedora/file.rb +3 -3
  32. data/lib/active_fedora/file_configurator.rb +5 -5
  33. data/lib/active_fedora/file_io.rb +120 -0
  34. data/lib/active_fedora/fixity_service.rb +36 -5
  35. data/lib/active_fedora/indexers/null_indexer.rb +1 -2
  36. data/lib/active_fedora/indexing/default_descriptors.rb +128 -0
  37. data/lib/active_fedora/indexing/descendant_fetcher.rb +105 -0
  38. data/lib/active_fedora/indexing/descriptor.rb +44 -0
  39. data/lib/active_fedora/indexing/field_mapper.rb +146 -0
  40. data/lib/active_fedora/indexing/inserter.rb +40 -0
  41. data/lib/active_fedora/indexing/map.rb +11 -3
  42. data/lib/active_fedora/indexing/suffix.rb +81 -0
  43. data/lib/active_fedora/indexing.rb +39 -15
  44. data/lib/active_fedora/indexing_service.rb +8 -3
  45. data/lib/active_fedora/inheritance.rb +1 -1
  46. data/lib/active_fedora/initializing_connection.rb +1 -1
  47. data/lib/active_fedora/ldp_resource.rb +1 -2
  48. data/lib/active_fedora/model_classifier.rb +1 -1
  49. data/lib/active_fedora/null_logger.rb +13 -0
  50. data/lib/active_fedora/orders/ordered_list.rb +1 -1
  51. data/lib/active_fedora/persistence.rb +16 -3
  52. data/lib/active_fedora/property.rb +1 -2
  53. data/lib/active_fedora/railtie.rb +6 -2
  54. data/lib/active_fedora/rake_support.rb +1 -1
  55. data/lib/active_fedora/rdf/field_map.rb +2 -2
  56. data/lib/active_fedora/rdf/field_map_entry.rb +15 -7
  57. data/lib/active_fedora/rdf/indexing_service.rb +15 -13
  58. data/lib/active_fedora/rdf/value_caster.rb +15 -0
  59. data/lib/active_fedora/rdf.rb +1 -0
  60. data/lib/active_fedora/relation/finder_methods.rb +28 -40
  61. data/lib/active_fedora/solr_hit.rb +1 -1
  62. data/lib/active_fedora/solr_service.rb +20 -2
  63. data/lib/active_fedora/type/value.rb +2 -4
  64. data/lib/active_fedora/version.rb +1 -1
  65. data/lib/active_fedora/with_metadata/metadata_node.rb +4 -1
  66. data/lib/active_fedora.rb +23 -9
  67. data/lib/generators/active_fedora/config/fedora/templates/.fcrepo_wrapper +1 -1
  68. data/lib/generators/active_fedora/config/solr/templates/solr/config/schema.xml +0 -6
  69. data/lib/generators/active_fedora/config/solr/templates/solr.yml +3 -3
  70. data/spec/integration/associations_spec.rb +8 -8
  71. data/spec/integration/attached_files_spec.rb +2 -3
  72. data/spec/integration/base_spec.rb +43 -39
  73. data/spec/integration/basic_contains_association_spec.rb +16 -3
  74. data/spec/integration/collection_association_spec.rb +1 -1
  75. data/spec/integration/direct_container_spec.rb +2 -2
  76. data/spec/integration/fedora_solr_sync_spec.rb +1 -1
  77. data/spec/integration/file_spec.rb +46 -13
  78. data/spec/integration/generators/fedora_generator_spec.rb +1 -1
  79. data/spec/integration/generators/solr_generator_spec.rb +1 -1
  80. data/spec/integration/has_and_belongs_to_many_associations_spec.rb +2 -2
  81. data/spec/integration/has_many_associations_spec.rb +4 -5
  82. data/spec/integration/indexing/descendant_fetcher_spec.rb +64 -0
  83. data/spec/integration/indexing_spec.rb +22 -2
  84. data/spec/integration/indirect_container_spec.rb +2 -2
  85. data/spec/integration/query_result_builder_spec.rb +2 -2
  86. data/spec/integration/scoping_spec.rb +20 -14
  87. data/spec/integration/solr_hit_spec.rb +1 -1
  88. data/spec/integration/versionable_spec.rb +2 -2
  89. data/spec/lib/active_fedora/null_logger_spec.rb +10 -0
  90. data/spec/unit/active_fedora/indexing/inserter_spec.rb +30 -0
  91. data/spec/unit/attached_files_spec.rb +36 -8
  92. data/spec/unit/attributes_spec.rb +8 -14
  93. data/spec/unit/base_spec.rb +7 -7
  94. data/spec/unit/builder/has_and_belongs_to_many_spec.rb +1 -1
  95. data/spec/unit/callback_spec.rb +2 -2
  96. data/spec/unit/change_set_spec.rb +1 -2
  97. data/spec/unit/collection_proxy_spec.rb +2 -1
  98. data/spec/unit/core/fedora_id_translator_spec.rb +2 -2
  99. data/spec/unit/core/fedora_uri_translator_spec.rb +2 -2
  100. data/spec/unit/core/logger_spec.rb +18 -0
  101. data/spec/unit/core_spec.rb +46 -12
  102. data/spec/unit/default_model_mapper_spec.rb +1 -1
  103. data/spec/unit/fedora_spec.rb +12 -0
  104. data/spec/unit/file_configurator_spec.rb +0 -9
  105. data/spec/unit/file_io_spec.rb +137 -0
  106. data/spec/unit/file_path_builder_spec.rb +3 -3
  107. data/spec/unit/file_spec.rb +70 -26
  108. data/spec/unit/files_hash_spec.rb +1 -2
  109. data/spec/unit/filter_spec.rb +2 -2
  110. data/spec/unit/finder_methods_spec.rb +1 -1
  111. data/spec/unit/fixity_service_spec.rb +65 -5
  112. data/spec/unit/has_and_belongs_to_many_association_spec.rb +1 -2
  113. data/spec/unit/has_many_association_spec.rb +2 -2
  114. data/spec/unit/indexing/map/index_object_spec.rb +25 -0
  115. data/spec/unit/indexing/map_spec.rb +27 -0
  116. data/spec/unit/indexing_spec.rb +3 -4
  117. data/spec/unit/inheritance_spec.rb +28 -1
  118. data/spec/unit/model_classifier_spec.rb +1 -1
  119. data/spec/unit/pathing_spec.rb +1 -2
  120. data/spec/unit/query_result_builder_spec.rb +1 -2
  121. data/spec/unit/query_spec.rb +4 -4
  122. data/spec/unit/rdf/indexing_service_spec.rb +18 -4
  123. data/spec/unit/reflection_spec.rb +2 -2
  124. data/spec/unit/solr_hit_spec.rb +1 -2
  125. data/spec/unit/solr_service_spec.rb +52 -4
  126. data/spec/unit/sparql_insert_spec.rb +1 -1
  127. data/spec/unit/validations_spec.rb +27 -4
  128. data/spec/unit/with_metadata/metadata_node_spec.rb +26 -1
  129. metadata +99 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a3e4470dd33d72dc20a0794fd42e8a08d96363f
4
- data.tar.gz: 9e7b438a6b8a23515de79c50b3f44dc2df2a6d3f
3
+ metadata.gz: bedac14828094879a2772f8ab082a5ff0af2ac44
4
+ data.tar.gz: efd5b61d006fd8a7f2c99105d7cd11bf00b7c5b8
5
5
  SHA512:
6
- metadata.gz: f86db04efd279c3412c1e57fa8449f7fbef3ac6cb83143314b573edaf559dfca3bc0bab762ada09c87c0f86759aea537f812bd194c3361f8adbea78385abbfe3
7
- data.tar.gz: fd864a26944cc8e5ca33b313a1a2544dcfa965e46005a16c6a4833755f85e82ab349e36470347c02eef601b979213c3877c2691153a41c81429595337dc68ead
6
+ metadata.gz: e56690ae20fd41c22ef507fc89a8c2350ac956cded3bd72d7d46ff43e181ccfe9224e3e40535ab5716b64a34efea98d87bbd7d364fa14c5b9f879cacf65be99f
7
+ data.tar.gz: 18ccc767a70af04dff33580ef2785483adbc3f0e51d8ae382ab65cf49db741b9cca8042c1cf7c59613aa6bcdbe4a0f91839a9a55b6d786c3b08dc74c2bd7f67c
data/.rubocop.yml CHANGED
@@ -36,6 +36,7 @@ Metrics/BlockNesting:
36
36
  Metrics/CyclomaticComplexity:
37
37
  Exclude:
38
38
  - 'lib/active_fedora.rb'
39
+ - 'lib/active_fedora/core.rb'
39
40
  - 'lib/active_fedora/reflection.rb'
40
41
  - 'lib/active_fedora/relation/finder_methods.rb'
41
42
  - 'lib/active_fedora/query_result_builder.rb'
@@ -49,6 +50,8 @@ Metrics/CyclomaticComplexity:
49
50
  - 'lib/active_fedora/file.rb'
50
51
  - 'lib/active_fedora/attribute_methods.rb'
51
52
  - 'lib/active_fedora/scoping/named.rb'
53
+ - 'lib/active_fedora/indexing/field_mapper.rb'
54
+ - 'lib/active_fedora/indexing/suffix.rb'
52
55
  - 'lib/active_fedora/inheritance.rb'
53
56
 
54
57
  Metrics/PerceivedComplexity:
@@ -65,6 +68,7 @@ Metrics/PerceivedComplexity:
65
68
  - 'lib/active_fedora/associations/collection_association.rb'
66
69
  - 'lib/active_fedora/attribute_methods.rb'
67
70
  - 'lib/active_fedora/scoping/named.rb'
71
+ - 'lib/active_fedora/indexing/field_mapper.rb'
68
72
  - 'lib/active_fedora/inheritance.rb'
69
73
 
70
74
  Metrics/ModuleLength:
@@ -105,7 +109,6 @@ Style/AndOr:
105
109
  Style/AccessorMethodName:
106
110
  Exclude:
107
111
  - 'lib/active_fedora/with_metadata/metadata_node.rb'
108
- - 'lib/active_fedora/predicates.rb'
109
112
  - 'lib/active_fedora/fedora_attributes.rb'
110
113
  - 'lib/active_fedora/attribute_methods/dirty.rb'
111
114
  - 'lib/active_fedora/associations/has_many_association.rb'
@@ -127,6 +130,7 @@ Style/PredicateName:
127
130
  - 'lib/active_fedora/association_hash.rb'
128
131
  - 'lib/active_fedora/aggregation/list_source.rb'
129
132
  - 'lib/active_fedora/associations/builder/aggregation.rb'
133
+ - 'lib/active_fedora/indexing/suffix.rb'
130
134
 
131
135
  Style/GuardClause:
132
136
  Exclude:
@@ -206,7 +210,6 @@ Style/ClassVars:
206
210
  - 'spec/unit/finder_methods_spec.rb'
207
211
  - 'spec/unit/base_spec.rb'
208
212
  - 'spec/integration/indexing_spec.rb'
209
- - 'lib/active_fedora/predicates.rb'
210
213
  - 'lib/active_fedora/identifiable.rb'
211
214
 
212
215
  Style/SignalException:
@@ -220,6 +223,10 @@ Style/ZeroLengthPredicate:
220
223
  Exclude:
221
224
  - 'lib/active_fedora/file/attributes.rb'
222
225
 
226
+ Performance/RedundantMerge:
227
+ Exclude:
228
+ - 'lib/active_fedora/railtie.rb'
229
+
223
230
  Rails:
224
231
  Enabled: true
225
232
 
@@ -261,3 +268,6 @@ RSpec/DescribedClass:
261
268
 
262
269
  RSpec/NotToNot:
263
270
  Enabled: false
271
+
272
+ RSpec/MessageSpies:
273
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,20 +1,23 @@
1
- require: rubocop-rspec
2
-
3
1
  # This configuration was generated by
4
2
  # `rubocop --auto-gen-config`
5
- # on 2016-08-25 16:34:38 -0700 using RuboCop version 0.42.0.
3
+ # on 2017-02-28 19:30:31 -0600 using RuboCop version 0.47.1.
6
4
  # The point is for the user to remove these configuration records
7
5
  # one by one as the offenses are removed from the code base.
8
6
  # Note that changes in the inspected code, or installation of new
9
7
  # versions of RuboCop, may require this file to be generated again.
10
8
 
11
- # Offense count: 116
12
- # Configuration parameters: Max.
13
- RSpec/ExampleLength:
9
+ # Offense count: 211
10
+ # Configuration parameters: CountComments, ExcludedMethods.
11
+ Metrics/BlockLength:
12
+ Max: 577
13
+
14
+ # Offense count: 65
15
+ RSpec/BeforeAfterAll:
14
16
  Enabled: false
15
17
 
16
- # Offense count: 40
17
- RSpec/LeadingSubject:
18
+ # Offense count: 114
19
+ # Configuration parameters: Max.
20
+ RSpec/ExampleLength:
18
21
  Enabled: false
19
22
 
20
23
  # Offense count: 15
@@ -32,24 +35,76 @@ RSpec/MessageChain:
32
35
  Exclude:
33
36
  - 'spec/unit/file_spec.rb'
34
37
 
35
- # Offense count: 218
36
- # Configuration parameters: EnforcedStyle, SupportedStyles.
37
- # SupportedStyles: allow, expect
38
- RSpec/MessageExpectation:
39
- Enabled: false
40
-
41
- # Offense count: 238
38
+ # Offense count: 241
42
39
  RSpec/MultipleExpectations:
43
40
  Max: 8
44
41
 
45
- # Offense count: 394
46
- # Configuration parameters: MaxNesting.
42
+ # Offense count: 181
43
+ # Configuration parameters: Max.
47
44
  RSpec/NestedGroups:
48
45
  Enabled: false
49
46
 
47
+ # Offense count: 24
48
+ RSpec/ScatteredSetup:
49
+ Exclude:
50
+ - 'spec/integration/base_spec.rb'
51
+ - 'spec/integration/direct_container_spec.rb'
52
+ - 'spec/integration/has_and_belongs_to_many_associations_spec.rb'
53
+ - 'spec/integration/indexing_spec.rb'
54
+ - 'spec/integration/indirect_container_spec.rb'
55
+ - 'spec/integration/json_serialization_spec.rb'
56
+ - 'spec/unit/attached_files_spec.rb'
57
+ - 'spec/unit/base_spec.rb'
58
+ - 'spec/unit/loadable_from_json_spec.rb'
59
+ - 'spec/unit/rdf/indexing_service_spec.rb'
60
+
50
61
  # Offense count: 94
51
62
  RSpec/SubjectStub:
52
- Enabled: false
63
+ Exclude:
64
+ - 'spec/integration/associations_spec.rb'
65
+ - 'spec/integration/autosave_association_spec.rb'
66
+ - 'spec/integration/versionable_spec.rb'
67
+ - 'spec/unit/attached_files_spec.rb'
68
+ - 'spec/unit/base_extra_spec.rb'
69
+ - 'spec/unit/file_configurator_spec.rb'
70
+ - 'spec/unit/file_spec.rb'
71
+ - 'spec/unit/has_and_belongs_to_many_association_spec.rb'
72
+ - 'spec/unit/persistence_spec.rb'
73
+ - 'spec/unit/solr_config_options_spec.rb'
74
+ - 'spec/unit/validations_spec.rb'
53
75
 
76
+ # Offense count: 20
77
+ # Configuration parameters: IgnoreSymbolicNames.
54
78
  RSpec/VerifiedDoubles:
79
+ Exclude:
80
+ - 'spec/unit/association_hash_spec.rb'
81
+ - 'spec/unit/files_hash_spec.rb'
82
+ - 'spec/unit/query_spec.rb'
83
+ - 'spec/unit/schema_indexing_strategy_spec.rb'
84
+ - 'spec/unit/solr_config_options_spec.rb'
85
+ - 'spec/unit/solr_service_spec.rb'
86
+
87
+ # Offense count: 3
88
+ Rails/FilePath:
89
+ Exclude:
90
+ - 'lib/active_fedora/file_configurator.rb'
91
+ - 'spec/unit/file_configurator_spec.rb'
92
+
93
+ # Offense count: 2
94
+ Security/MarshalLoad:
95
+ Exclude:
96
+ - 'spec/integration/marshal_spec.rb'
97
+
98
+ # Offense count: 20
99
+ # Configuration parameters: MinBodyLength.
100
+ Style/GuardClause:
55
101
  Enabled: false
102
+
103
+ # Offense count: 20
104
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
105
+ # SupportedStyles: snake_case, normalcase, non_integer
106
+ Style/VariableNumber:
107
+ Exclude:
108
+ - 'spec/integration/associations_spec.rb'
109
+ - 'spec/unit/ordered_spec.rb'
110
+ - 'spec/unit/orders/ordered_list_spec.rb'
data/.travis.yml CHANGED
@@ -1,16 +1,15 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  sudo: false
4
- rvm:
5
- - 2.3.0
6
-
7
- notifications:
8
- irc: "irc.freenode.org#projecthydra"
9
-
10
- env:
11
- - "RAILS_VERSION=4.2.6"
12
-
4
+ rvm: 2.4.1
5
+ matrix:
6
+ include:
7
+ - rvm: 2.3.4
8
+ env: "RAILS_VERSION=4.2.8"
9
+ - env: "RAILS_VERSION=5.1.1"
13
10
  global_env:
14
11
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
12
+ before_install:
13
+ - gem update --system
15
14
  before_script:
16
15
  - jdk_switcher use oraclejdk8
data/CONTRIBUTING.md CHANGED
@@ -3,6 +3,13 @@
3
3
  We want your help to make Project Hydra great.
4
4
  There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
5
5
 
6
+ ## Code of Conduct
7
+
8
+ The Hydra community is dedicated to providing a welcoming and positive experience for all its
9
+ members, whether they are at a formal gathering, in a social setting, or taking part in activities
10
+ online. Please see our [Code of Conduct](https://wiki.duraspace.org/display/hydra/Code+of+Conduct)
11
+ for more information.
12
+
6
13
  ## Hydra Project Intellectual Property Licensing and Ownership
7
14
 
8
15
  All code contributors must have an Individual Contributor License Agreement (iCLA) on file with the Hydra Project Steering Group.
@@ -16,8 +23,10 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
16
23
 
17
24
  * Reporting Issues
18
25
  * Making Changes
26
+ * Documenting Code
27
+ * Committing Changes
19
28
  * Submitting Changes
20
- * Merging Changes
29
+ * Reviewing and Merging Changes
21
30
 
22
31
  ### Reporting Issues
23
32
 
@@ -38,8 +47,28 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
38
47
  * Then checkout the new branch with `git checkout fix/master/my_contribution`.
39
48
  * Please avoid working directly on the `master` branch.
40
49
  * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
50
+ * Make sure you have added sufficient tests and documentation for your changes.
51
+ * Test functionality with RSpec; est features / UI with Capybara.
52
+ * Run _all_ the tests to assure nothing else was accidentally broken.
53
+
54
+ ### Documenting Code
55
+
56
+ * All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
57
+ * Documentation should seek to answer the question "why does this code exist?"
58
+ * Document private / protected methods as desired.
59
+ * If you are working in a file with no prior documentation, do try to document as you gain understanding of the code.
60
+ * If you don't know exactly what a bit of code does, it is extra likely that it needs to be documented. Take a stab at it and ask for feedback in your pull request. You can use the 'blame' button on GitHub to identify the original developer of the code and @mention them in your comment.
61
+ * This work greatly increases the usability of the code base and supports the on-ramping of new committers.
62
+ * We will all be understanding of one another's time constraints in this area.
63
+ * YARD examples:
64
+ * [Hydra::Works::RemoveGenericFile](https://github.com/projecthydra-labs/hydra-works/blob/master/lib/hydra/works/services/generic_work/remove_generic_file.rb)
65
+ * [ActiveTriples::LocalName::Minter](https://github.com/ActiveTriples/active_triples-local_name/blob/master/lib/active_triples/local_name/minter.rb)
66
+ * [Getting started with YARD](http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md)
67
+
68
+ ### Committing changes
69
+
41
70
  * Make commits of logical units.
42
- * Your commit should include a high level description of your work in HISTORY.textile
71
+ * Your commit should include a high level description of your work in HISTORY.textile
43
72
  * Check for unnecessary whitespace with `git diff --check` before committing.
44
73
  * Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
45
74
  * If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
@@ -60,7 +89,9 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
60
89
 
61
90
  class PostsController
62
91
  def index
63
- respond_with Post.limit(10)
92
+ respond_to do |wants|
93
+ wants.html { render 'index' }
94
+ end
64
95
  end
65
96
  end
66
97
 
@@ -72,38 +103,53 @@ You should also add yourself to the `CONTRIBUTORS.md` file in the root of the pr
72
103
  long to fit in 72 characters
73
104
  ```
74
105
 
75
- * Make sure you have added the necessary tests for your changes.
76
- * Run _all_ the tests to assure nothing else was accidentally broken.
77
- * When you are ready to submit a pull request
78
-
79
106
  ### Submitting Changes
80
107
 
81
- [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
82
-
83
108
  * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
84
109
  * Make sure your branch is up to date with its parent branch (i.e. master)
85
110
  * `git checkout master`
86
111
  * `git pull --rebase`
87
112
  * `git checkout <your-branch>`
88
113
  * `git rebase master`
89
- * It is likely a good idea to run your tests again.
90
- * Squash the commits for your branch into one commit
91
- * `git rebase --interactive HEAD~<number-of-commits>` ([See Github help](https://help.github.com/articles/interactive-rebase))
92
- * To determine the number of commits on your branch: `git log master..<your-branch> --oneline | wc -l`
114
+ * It is a good idea to run your tests again.
115
+ * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
116
+ * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
117
+ * `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
93
118
  * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
94
119
  * Push your changes to a topic branch in your fork of the repository.
95
120
  * Submit a pull request from your fork to the project.
96
121
 
97
- ### Merging Changes
122
+ ### Reviewing and Merging Changes
123
+
124
+ We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
125
+ Common checks that may occur in our repositories:
126
+
127
+ 1. Travis CI - where our automated tests are running
128
+ 2. Hound CI - where we check for style violations
129
+ 3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
130
+ 4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
131
+
132
+ If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
133
+
134
+ *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (Travis CI is usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
135
+
136
+ #### Things to Consider When Reviewing
137
+
138
+ First, the person contributing the code is putting themselves out there. Be mindful of what you say in a review.
139
+
140
+ * Ask clarifying questions
141
+ * State your understanding and expectations
142
+ * Provide example code or alternate solutions, and explain why
143
+
144
+ This is your chance for a mentoring moment of another developer. Take time to give an honest and thorough review of what has changed. Things to consider:
98
145
 
99
- * It is considered "poor from" to merge your own request.
100
- * Please take the time to review the changes and get a sense of what is being changed. Things to consider:
101
146
  * Does the commit message explain what is going on?
102
- * Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
147
+ * Does the code changes have tests? _Not all changes need new tests, some changes are refactors_
148
+ * Do new or changed methods, modules, and classes have documentation?
103
149
  * Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
104
- * Did the Travis tests complete successfully?
105
- * If you are uncertain, bring other contributors into the conversation by creating a comment that includes their @username.
106
- * If you like the pull request, but want others to chime in, create a +1 comment and tag a user.
150
+ * Does the description of the new/changed specs match your understanding of what the spec is doing?
151
+
152
+ If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
107
153
 
108
154
  # Additional Resources
109
155
 
data/History.txt CHANGED
@@ -1,3 +1,54 @@
1
+ v11.1.2
2
+ 2017-01-25: Eager load all the code in eager_load blocks [Justin Coyne]
3
+
4
+ 2017-01-25: Eager load ActiveFedora [Justin Coyne]
5
+
6
+ 2017-01-24: Ensuring up to date system gems [Jeremy Friesen]
7
+
8
+ 2017-01-18: Warn if you don't pass :rows to SolrService.query [Justin Coyne]
9
+
10
+ 2017-01-13: Ensuring NullLogger responds to logging questions [Jeremy Friesen]
11
+
12
+ v11.1.1
13
+ 2017-01-13: Don't modify passed in attributes [Justin Coyne]
14
+
15
+ 2017-01-13: When rails initializes, set the log if it previously was a
16
+ NullLogger [Justin Coyne]
17
+
18
+ v11.1.0
19
+ 2017-01-12: Casting an RDF::URI to a RDF::URI is unnecessary [Justin Coyne]
20
+
21
+ 2017-01-06: Replace deprecated Fixnum with Integer [Justin Coyne]
22
+
23
+ 2017-01-06: Pin rubocop-rspec to 1.8.0 [Justin Coyne]
24
+
25
+ 2017-01-06: Add Ruby 2.4.0 to the test matrix [Justin Coyne]
26
+
27
+ 2016-12-19: Removing invalid namespaces from tests [Esmé Cowles]
28
+
29
+ 2016-12-16: Correct the documentation [Justin Coyne]
30
+
31
+ 2016-11-14: Use base_uri instead of relying on id_to_uri [Chris Colvard]
32
+
33
+ 2016-11-14: Add base_uri convenience method [Chris Colvard]
34
+
35
+ 2016-11-09: There is no need to pin rake anylonger [Justin Coyne]
36
+
37
+ 2016-10-28: Allow logger to be set by default. Fixes #1170 [Justin Coyne]
38
+
39
+ 2016-10-28: Add return value YARD doc [Justin Coyne]
40
+
41
+ 2016-10-28: Update to latest Rubocop [Adam Wead]
42
+
43
+ 2016-10-27: Stop spamming IRC with Travis builds [Michael J. Giarlo]
44
+
45
+ 2016-10-19: Changing file to accept any object that responds to URI including
46
+ another File object or a Version [Carolyn Cole]
47
+
48
+ 2016-09-30: Test with rsolr 2.x [Chris Beer]
49
+
50
+ 2016-09-22: Use ActiveFedora::NullLogger [Adam Wead]
51
+
1
52
  v9.10.1
2
53
  2016-03-26: Fix #reflect_on_association. [Trey Pendragon]
3
54
 
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  Description
2
2
  -----------
3
3
 
4
- [![Build Status](https://travis-ci.org/projecthydra/active_fedora.png?branch=master)](https://travis-ci.org/projecthydra/active\_fedora)
4
+ [![Build Status](https://travis-ci.org/samvera/active_fedora.png?branch=master)](https://travis-ci.org/samvera/active\_fedora)
5
5
  [![Version](https://badge.fury.io/rb/active-fedora.png)](http://badge.fury.io/rb/active-fedora)
6
- [![Dependencies](https://gemnasium.com/projecthydra/active_fedora.png)](https://gemnasium.com/projecthydra/active\_fedora)
7
- [![Coverage Status](https://img.shields.io/coveralls/projecthydra/active_fedora.svg)](https://coveralls.io/r/projecthydra/active_fedora)
6
+ [![Dependencies](https://gemnasium.com/samvera/active_fedora.png)](https://gemnasium.com/samvera/active\_fedora)
7
+ [![Coverage Status](https://img.shields.io/coveralls/samvera/active_fedora.svg)](https://coveralls.io/r/samvera/active_fedora)
8
8
 
9
9
  ActiveFedora is a Ruby gem for creating and
10
10
  managing objects in the Fedora Repository Architecture
@@ -15,8 +15,8 @@ Getting Help
15
15
  ------------
16
16
 
17
17
  - Community Discussions & Mailing List are located at
18
- [http://groups.google.com/group/hydra-tech](http://groups.google.com/group/hydra-tech)
19
- - Developers hang out on IRC in \#projecthydra on freenet.
18
+ [http://groups.google.com/group/samvera-tech](http://groups.google.com/group/samvera-tech)
19
+ - Developers hang out on [slack.samvera.org](http://slack.samvera.org/)
20
20
 
21
21
  Installation
22
22
  ------------
@@ -30,7 +30,7 @@ gem install active-fedora
30
30
  Getting Started
31
31
  ---------------
32
32
 
33
- The [Dive into Hydra](https://github.com/projecthydra/hydra/wiki/Dive-into-Hydra)
33
+ The [Dive into Hydra](https://github.com/samvera/hydra/wiki/Dive-into-Hydra)
34
34
  gives you a brief tour through ActiveFedora’s features on the command line.
35
35
 
36
36
  Generators
@@ -47,21 +47,18 @@ Testing (this Gem)
47
47
 
48
48
  In order to run the RSpec tests, you need to have a copy of the
49
49
  ActiveFedora source code, and then run bundle install in the source
50
- directory. Testing requires hydra-jetty, which contains version for
51
- Fedora and Solr. Setting up and maintaining hydra-jetty for the purposes
52
- of testing this gem is all accomplished via:
50
+ directory. You can download the source code by doing the following:
53
51
 
54
52
  ```bash
55
- git clone https://github.com/projecthydra/active_fedora.git
56
- cd active_fedora # or whatever directory your clone is in
53
+ git clone https://github.com/samvera/active_fedora.git
54
+ cd active_fedora
57
55
  bundle install
58
56
  ```
59
57
 
60
58
  ### Using the continuous integration server
61
59
 
62
60
  You can test ActiveFedora using the same process as our continuous
63
- integration server. To do that, unzip a copy of hydra-jetty first. This includes copies of Fedora and Solr which are
64
- used during the testing process.
61
+ integration server. This will automatically pull down a copy of Solr and Fedora Content Repository.
65
62
 
66
63
  The `ci` rake task will download solr and fedora, start them,
67
64
  and run the tests for you.
@@ -81,7 +78,7 @@ solr_wrapper
81
78
  To start FCRepo, open another shell and run:
82
79
 
83
80
  ```bash
84
- fcrepo_wrapper -p 8984
81
+ fcrepo_wrapper -p 8986
85
82
  ```
86
83
 
87
84
  Now you’re ready to run the tests. In the directory where active\_fedora
@@ -7,34 +7,36 @@ Gem::Specification.new do |s|
7
7
  s.version = ActiveFedora::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Matt Zumwalt", "McClain Looney", "Justin Coyne"]
10
- s.email = ["matt.zumwalt@yourmediashelf.com"]
10
+ s.email = ["samvera-tech@googlegroups.com"]
11
11
  s.homepage = %q{https://github.com/projecthydra/active_fedora}
12
12
  s.summary = %q{A convenience libary for manipulating documents in the Fedora Repository.}
13
13
  s.description = %q{ActiveFedora provides for creating and managing objects in the Fedora Repository Architecture.}
14
- s.license = "APACHE2"
14
+ s.license = "Apache-2.0"
15
15
  s.required_ruby_version = '~> 2.0'
16
16
 
17
- s.add_dependency 'rsolr', '~> 1.1', '>= 1.1.2'
18
- s.add_dependency 'solrizer', '~> 3.4'
17
+ s.add_dependency 'rsolr', '>= 1.1.2', '< 3'
18
+ s.add_dependency 'solrizer', '>= 3.4', '< 5'
19
19
  s.add_dependency "activesupport", '>= 4.2.4', '< 6'
20
20
  s.add_dependency "activemodel", '>= 4.2', '< 6'
21
- s.add_dependency "active-triples", '~> 0.11.0'
21
+ s.add_dependency "active-triples", '>= 0.11.0', '< 2.0.0'
22
22
  s.add_dependency "deprecation"
23
- s.add_dependency "ldp", '~> 0.6.0'
23
+ s.add_dependency "ldp", '~> 0.7.0'
24
+ s.add_dependency "ruby-progressbar", '~> 1.0'
25
+ s.add_dependency 'faraday', '~> 0.12.1'
26
+ s.add_dependency 'faraday-encoding', '0.0.4'
24
27
 
25
28
  s.add_development_dependency "rails"
26
29
  s.add_development_dependency "rdoc"
27
30
  s.add_development_dependency "yard"
28
- # Pin rake to 10.0 due to https://github.com/lsegal/yard/issues/947
29
- s.add_development_dependency "rake", '~> 10.0'
30
- s.add_development_dependency "solr_wrapper", "~> 0.15"
31
+ s.add_development_dependency "rake"
32
+ s.add_development_dependency "solr_wrapper", "~> 1.0"
31
33
  s.add_development_dependency 'fcrepo_wrapper', '~> 0.2'
32
- s.add_development_dependency "rspec", "~> 3.0"
34
+ s.add_development_dependency "rspec", "~> 3.5"
33
35
  s.add_development_dependency "rspec-its"
34
36
  s.add_development_dependency "equivalent-xml"
35
37
  s.add_development_dependency "simplecov", '~> 0.8'
36
- s.add_development_dependency "rubocop", '~> 0.42.0'
37
- s.add_development_dependency "rubocop-rspec", '~> 1.6'
38
+ s.add_development_dependency "rubocop", '~> 0.47.1'
39
+ s.add_development_dependency "rubocop-rspec", '~> 1.12.0'
38
40
 
39
41
  s.files = `git ls-files`.split("\n")
40
42
  s.test_files = `git ls-files -- {spec}/*`.split("\n")
@@ -44,5 +46,4 @@ Gem::Specification.new do |s|
44
46
  "README.md"
45
47
  ]
46
48
  s.require_paths = ["lib"]
47
-
48
49
  end
@@ -8,7 +8,9 @@ module ActiveFedora::Aggregation
8
8
 
9
9
  def ordered_by_ids
10
10
  if id.present?
11
- ActiveFedora::SolrService.query("{!join from=proxy_in_ssi to=id}ordered_targets_ssim:#{id}").map { |x| x["id"] }
11
+ query = "{!join from=proxy_in_ssi to=id}ordered_targets_ssim:#{id}"
12
+ rows = ActiveFedora::SolrService::MAX_ROWS
13
+ ActiveFedora::SolrService.query(query, rows: rows).map { |x| x["id"] }
12
14
  else
13
15
  []
14
16
  end
@@ -80,7 +80,7 @@ module ActiveFedora
80
80
  # Set node subjects to a term in AF JUST so that AF will persist the
81
81
  # sub-graphs.
82
82
  # TODO: Find a way to fix this.
83
- self.nodes = nil
83
+ resource.set_value(:nodes, [])
84
84
  self.nodes += graph.subjects.to_a
85
85
  ordered_self.changes_committed!
86
86
  end
@@ -202,8 +202,7 @@ module ActiveFedora
202
202
  # the target is stale.
203
203
  #
204
204
  # This is only relevant to certain associations, which is why it returns nil by default.
205
- def stale_state
206
- end
205
+ def stale_state; end
207
206
 
208
207
  def build_record(attributes)
209
208
  reflection.build_association(attributes) do |record|
@@ -17,6 +17,18 @@ module ActiveFedora
17
17
  record.base_path_for_resource = owner.uri.to_s
18
18
  super
19
19
  end
20
+
21
+ def reset
22
+ # Update the membership triples (and no other triples) on the the owner's resource
23
+ if owner.persisted?
24
+ pattern = ::RDF::Query::Pattern.new(predicate: options[:predicate])
25
+ new_resource = ActiveFedora::Base.uncached do
26
+ owner.dup.reload.resource
27
+ end
28
+ owner.resource.delete_insert([pattern], new_resource.query(pattern))
29
+ end
30
+ super
31
+ end
20
32
  end
21
33
  end
22
34
  end
@@ -63,8 +63,7 @@ module ActiveFedora::Associations::Builder
63
63
  name
64
64
  end
65
65
 
66
- def self.define_extensions(_model, _name)
67
- end
66
+ def self.define_extensions(_model, _name); end
68
67
 
69
68
  def self.define_callbacks(model, reflection)
70
69
  if dependent = reflection.options[:dependent]
@@ -204,7 +204,7 @@ module ActiveFedora
204
204
  # Note that this method will _always_ remove records from the database
205
205
  # ignoring the +:dependent+ option.
206
206
  def destroy(*records)
207
- records = find(records) if records.any? { |record| record.is_a?(Fixnum) || record.is_a?(String) }
207
+ records = find(records) if records.any? { |record| record.is_a?(Integer) || record.is_a?(String) }
208
208
  delete_or_destroy(records, :destroy)
209
209
  end
210
210
 
@@ -301,11 +301,11 @@ module ActiveFedora
301
301
  def find_target
302
302
  # TODO: don't reify, just store the solr results and lazily reify.
303
303
  # For now, we set a hard limit of 1000 results.
304
- records = ActiveFedora::QueryResultBuilder.reify_solr_results(load_from_solr(rows: 1000))
304
+ records = ActiveFedora::QueryResultBuilder.reify_solr_results(load_from_solr(rows: SolrService::MAX_ROWS))
305
305
  records.each { |record| set_inverse_instance(record) }
306
306
  records
307
307
  rescue ObjectNotFoundError, Ldp::Gone => e
308
- ActiveFedora::Base.logger.error "Solr and Fedora may be out of sync:\n" + e.message if ActiveFedora::Base.logger
308
+ ActiveFedora::Base.logger.error "Solr and Fedora may be out of sync:\n" + e.message
309
309
  reset
310
310
  []
311
311
  end